Wrong host permissions

I just discovered that despite instructing Plasmo to only run on https://www.skillshare.com/* (https://github.com/avi12/skillshare-player-control/blob/a71baa498bf8956441f98068bcf0c343f281126b/src/content.ts#L15) I'm getting this
GitHub
skillshare-player-control/content.ts at a71baa498bf8956441f98068bcf...
Basic keyboard controls for Skillshare's player. Contribute to avi12/skillshare-player-control development by creating an account on GitHub.
19 Replies
lab
lab2y ago
hmm, is the result manifest correct?
Avi
Avi2y ago
By inspecting the output manifest, https://robwu.nl/crxviewer/?crx=https%3A%2F%2Fclients2.google.com%2Fservice%2Fupdate2%2Fcrx%3Fresponse%3Dredirect%26os%3Dwin%26arch%3Dx86-64%26os_arch%3Dx86-64%26nacl_arch%3Dx86-64%26prod%3Dchromecrx%26prodchannel%3Dunknown%26prodversion%3D9999.0.9999.0%26acceptformat%3Dcrx2%2Ccrx3%26x%3Did%253Dagbhgcomfpcfboebbfmefbicfkpnlfeg%2526uc&qf=manifest.json it indeed shows that Plasmo has inserted
{
"content_scripts": [
{
"matches": ["https://www.skillshare.com/*"],
"js": ["content.07616647.js"],
"css": []
},
{
"matches": "<all_urls>",
"js": ["skillshare-content-script-hotkeys.520fdbbb.js"],
"css": []
}
]
}
{
"content_scripts": [
{
"matches": ["https://www.skillshare.com/*"],
"js": ["content.07616647.js"],
"css": []
},
{
"matches": "<all_urls>",
"js": ["skillshare-content-script-hotkeys.520fdbbb.js"],
"css": []
}
]
}
Apparently not On Plasmo 0.64.5, I get this output:
{
"content_scripts": [
{ "matches": ["https://www.skillshare.com/*"], "js": ["content.07616647.js"], "css": [] },
{ "matches": ["<all_urls>"], "js": ["skillshare-content-script-hotkeys.520fdbbb.js"], "css": [] }
]
}
{
"content_scripts": [
{ "matches": ["https://www.skillshare.com/*"], "js": ["content.07616647.js"], "css": [] },
{ "matches": ["<all_urls>"], "js": ["skillshare-content-script-hotkeys.520fdbbb.js"], "css": [] }
]
}
And that's after deleting .plasmo/ and building Now the question is, why doesn't Plasmo stick to the permissions in the content script/CSUI? Interestingly enough, the issue doesn't occur for the other Plasmo project: https://robwu.nl/crxviewer/?crx=https%3A%2F%2Fclients2.google.com%2Fservice%2Fupdate2%2Fcrx%3Fresponse%3Dredirect%26os%3Dwin%26arch%3Dx86-64%26os_arch%3Dx86-64%26nacl_arch%3Dx86-64%26prod%3Dchromecrx%26prodchannel%3Dunknown%26prodversion%3D9999.0.9999.0%26acceptformat%3Dcrx2%2Ccrx3%26x%3Did%253Dkbbdnbaghpcjpdhbjbccadodjejlkkgg%2526uc&qf=manifest.json&qb=1 The issue isn't solved even after replacing PlasmoContentSCript with PlasmoCSConfig
Avi
Avi2y ago
GitHub
GitHub - avi12/skillshare-player-control: Basic keyboard controls f...
Basic keyboard controls for Skillshare's player. Contribute to avi12/skillshare-player-control development by creating an account on GitHub.
GitHub
GitHub - avi12/twitch-cp-bonus-collector: A browser extension that ...
A browser extension that automates clicking on the Channel Points bonus button during a Twitch live stream when it appears. - GitHub - avi12/twitch-cp-bonus-collector: A browser extension that auto...
lab
lab2y ago
the 1st one has 2 CS entry points you will need to redeclare - only the content.ts config was recognized
Avi
Avi2y ago
Wait, Plasmo adds PLasmoCSConfig for any script that lives under conetnts/ even if the script doesn't declare PlasmoCSConfig explicitly?
lab
lab2y ago
any script resides in contents are treated as a separate CS entry and yeah if a config is not exported it defaults to that match all
Avi
Avi2y ago
Regardless if PlasmoCSConfig is declared? Seems like a bad idea to me This behavior should change such that only scripts with declared PlasmoCSConfig should be added to the manifest
lab
lab2y ago
yup, it looks at the directory , not the AST Why is it bad?
Avi
Avi2y ago
This behavior is unexpected
lab
lab2y ago
Can you elaborate on "unexpected"? It is very much designed that way
Avi
Avi2y ago
I'd expect that only scripts that export PlasmoCSConfig would be turned into content scripts Rather than "if the script lives under contents/, yee shall be a content script"
lab
lab2y ago
Here's a counter example: if you have 100 scripts in contents - how can you tell which one has the config from first glance looking at that directory?
Avi
Avi2y ago
You can't, but that's why you need to investigate the project before diving in I could also say "from a first glance in a framework-free Chrome extension, how can you tell what scripts are content scripts?" You look at the manifest, there's no other way If you use TypeScript, it complicates the situation
lab
lab2y ago
with plasmo, any files inside contents/ or content.ts(x) is a CS or CSUI it's very clear-cut and if you need to have shared utils, move them to an utils/ directory (or helpers etc...)
Avi
Avi2y ago
Ok, then you should perhaps update CS examples When I looked into CSUIs, all of them had PlasmoCSConfig
Want results from more Discord servers?
Add your server