Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL Schema #18

Closed
bolte-io opened this issue Sep 18, 2021 · 7 comments
Closed

URL Schema #18

bolte-io opened this issue Sep 18, 2021 · 7 comments

Comments

@bolte-io
Copy link

Hey,

Given the URL: testproto://test/example?var1=hello&var2=world
And parsing the arguments passed to my JS, the below happens...

image

I am looking for clarification as to examples of correctly formatted URLs.
Trying to figure out how I would go about parsing these into commands, and sub command and pass variables into my application via URL query.

Can you clarify the URL schema so I know what my options are please?

@Shubham-Kumar-2000
Copy link
Owner

Can you share your registration code?

@bolte-io
Copy link
Author

bolte-io commented Sep 19, 2021

const path = require('path');
const ProtocolRegistry = require('protocol-registry');

ProtocolRegistry.register({
    protocol: 'testproto',
    command: `node ${path.join(__dirname, './index.js')} "$_URL_"`, 
    override: true, 
    terminal: true, 
    script: true
}).then(async () => {
    console.log('Success');
});

@Shubham-Kumar-2000
Copy link
Owner

There was bug in script: true which is fixed in the current version of the codebase on github.

It has been tested in windows, but testing of macos and linux are pending post which it will be live in npm.

@bolte-io
Copy link
Author

Works now with the changes you made.

image

Additional question.
Is it secure in terms of malformed URLs being able to execute code on the target machine?

@Shubham-Kumar-2000
Copy link
Owner

As from the module we don't provide any validation of url. You need to implement that on your own.

@Shubham-Kumar-2000
Copy link
Owner

We have added a efficient example to extract data from urls and verify them.
In commit : 2b40053

@Shubham-Kumar-2000
Copy link
Owner

New npm version live closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants