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 thisGitHub
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
hmm, is the result manifest correct?
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
Apparently not
On Plasmo 0.64.5, I get this output:
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
AKA the issue occurs here https://github.com/avi12/skillshare-player-control
but not here https://github.com/avi12/twitch-cp-bonus-collector
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...
the 1st one has 2 CS entry points
you will need to redeclare - only the content.ts config was recognized
Wait, Plasmo adds
PLasmoCSConfig
for any script that lives under conetnts/
even if the script doesn't declare PlasmoCSConfig
explicitly?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
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 manifestyup, it looks at the directory , not the AST
Why is it bad?
This behavior is unexpected
Can you elaborate on "unexpected"? It is very much designed that way
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"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?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
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...)Ok, then you should perhaps update CS examples
When I looked into CSUIs, all of them had
PlasmoCSConfig
yeah bc I specify a custom match in each of them
Which is giving the wrong conslusion
aight I will add an extra cs to demonstrate config is optional
Great, thanks 😁