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

Does the @icon item have to be a URL address? #108

Open
topkie opened this issue Jun 25, 2023 · 2 comments
Open

Does the @icon item have to be a URL address? #108

topkie opened this issue Jun 25, 2023 · 2 comments

Comments

@topkie
Copy link

topkie commented Jun 25, 2023

I have written a configuration with the @icon item as a base64-encoded image like this:

new UserscriptPlugin({
    headers: {
    // ...
    icon: 'data:image/x-icon;base64,...',
    // ...
    }
})

There is an error message like this:

[webpack-cli] HookWebpackError: Validation groups: main
An instance of Headers has failed the validation:
 - property icon has failed the following constraints: icon must be a URL address 

    at makeWebpackError (.\node_modules\.pnpm\[email protected][email protected]\node_modules\webpack\lib\HookWebpackError.js:48:9)
    at .\node_modules\.pnpm\[email protected][email protected]\node_modules\webpack\lib\Compilation.js:3068:12       
    at eval (eval at create (.\node_modules\.pnpm\[email protected]\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:34:1)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
-- inner error --
Error: Validation groups: main
An instance of Headers has failed the validation:
 - property icon has failed the following constraints: icon must be a URL address 

    at ValidateHeaders.validateHeaders (.\node_modules\.pnpm\[email protected][email protected]\node_modules\webpack-userscript\dist\features\validate-headers\impl.js:45:23)
    at .\node_modules\.pnpm\[email protected][email protected]\node_modules\webpack-userscript\dist\features\validate-headers\impl.js:17:73
    at _next0 (eval at create (.\node_modules\.pnpm\[email protected]\node_modules\tapable\lib\HookCodeFactory.js:75:10), <anonymous>:54:16)
    at eval (eval at create (.\node_modules\.pnpm\[email protected]\node_modules\tapable\lib\HookCodeFactory.js:75:10), <anonymous>:79:1)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
caused by plugins in Compilation.hooks.processAssets
Error: Validation groups: main
An instance of Headers has failed the validation:
 - property icon has failed the following constraints: icon must be a URL address 

Does the @ICON item have to be a URL address?

@momocow
Copy link
Owner

momocow commented Jun 28, 2023

Does the @ICON item have to be a URL address?

The truth is, I have no idea.

I found no clue about the use of @icon in data URI format, based on docs of the following 4 userscript engines.

TamperMonkey: userscript headers
GreaseMonkey: metadata block
GreasyFork: meta keys
ViolentMonkey: metadata block

According to tampermonkey, @icon, @iconURL and @defaulticon are substitutes of each other. Noticing the name @iconURL, that is why I defined @icon to be an URL address.

If you found any docs or use cases of @icon in data URI format, please feel free to let me know, thank you!

:)

@topkie
Copy link
Author

topkie commented Jun 28, 2023

I learned this usage from other scripts, but I found some issues about it:

Tampermonkey/tampermonkey#1500
violentmonkey/violentmonkey#1130

I have only used Tampermonkey, I hope this is helpful.

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