In my Chrome Extension's manifest.json file I have:
"permissions": [
"https://*/*/*.jpg",
"storage"
],
but it works on all the https urls...
Related
I am trying to download the CRX file for the DarkReader extension with the manifest in version 3. The extension page: https://chrome.google.com/webstore/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh/
Using the answers in the following question I can only obtain the manifest in version 2:
How to download a CRX file from the Chrome web store for a given ID?
❯ head darkreader/manifest.json
{
"update_url": "https://clients2.google.com/service/update2/crx",
"manifest_version": 2,
"name": "Dark Reader",
The URL I am using:
https://clients2.google.com/service/update2/crx?response=redirect&prodversion=103.0.5060.53&acceptformat=crx2,crx3&x=id%3Deimadpbcbfnmbkopoojfekhnkhdbieeh%26uc
Thank you!
I am building a chrome extension, but I want to use react to build it. I am not sure how I need to configure my manifest.json in order to get it to work.
This is my manifest.json file...
{
"name": "Get pages source",
"version": "1.0",
"manifest_version": 2,
"description": "Get pages source from a popup",
"browser_action": {
"default_popup": "./src/index.html"
},
"permissions": ["tabs", "<all_urls>"]
}
Now the way that I run my app locally, is with the following script in package.json...
"scripts": {
"dev": "webpack-dev-server --content-base src --inline --hot"
}
My app displays on localhost:8080. However, I want the app to open up when I click on my extension. How can I do this? Do I need to reference the path to the localhost?
At the moment, when I run my extension, the index.html file gets loaded but nothing is rendered. Can someone explain how to do this?
EDIT
I also tried the following but it did not work...
"browser_action": {
"default_popup": "http://localhost:8080/src/index.html"
},
Change default_popup in manifest.json to "src/index.html".
Always build your code before packing extension and use webpack instead of webpack-dev-server
Also babel-core and webpack-dev-server were missing from package.json
Here is the screenshot of working extension:
Screenshot of development:
Make a new folder when you publish your extension which excludes node_modules folders ( only after you npm run build )
Here is the link with the updated code: https://drive.google.com/open?id=0ByrxEyIevnFmNXlDZERaRTBMSlE
Please don't forget to run npm install and npm run build before loading unpacked extension.
Comment if any further help needed.
I have a Angular2/typescript app I am developing in VSCode. I use Gulp to build the typescript files and gulp-sourcemap to create map files. Attaching/launching chrome works well after some tinkering with the chrome debug extension for VSCode, but I cannot get the breakpoints to hit. I run the website with "dnx web", but I don't think that should matter.
My folder structure is like this:
project/wwwroot/index.html
project/wwwroot/app/myfile.js
project/wwwroot/app/myfile.js.map
project/scripts/myfile.ts
My launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8001/portfolios",
"runtimeArgs": [
"--new-window", //Open in new window
"--user-data-dir=C:/temp/",
"--remote-debugging-port=9222"
],
"webRoot": "${workspaceRoot}/wwwroot",
"sourceMaps": true
}
]
}
and my gulp build task looks like this:
gulp.task('ts', function (done) {
var files = gulp.src(tsToMove)
.pipe(sourcemaps.init())
.pipe(ts(tsConfig), undefined, ts.reporter.fullReporter());
return files.js.pipe(sourcemaps.write(".",{sourceRoot: '../scripts'}))
.pipe(gulp.dest('scripts'));
})
I have verified that maps files are generated and stored in the same folder as the js files. when building.
Thanks for any hints.
Setting the workspace location to the location of my typescript files, and not my build files, worked for me.
Unverified Breakpoint (my compiled file location)
"webRoot": "${workspaceRoot}/build/client"
Working Breakpoint (my ts file location)
"webRoot": "${workspaceRoot}/client"
I feel I should mention that I am using the Debugger for Chrome extension
So I've been messing with this for hours and finally got it working: RVCA18 was right on with his answer:
You need to make sure that webRoot is set correctly, and correctly will depend on where you are running dnx from. If from your 'project' folder, then that's your actual webRoot.
You can also use your sourcemap file. If you open the file, it has a structure something like this:
{"version":3,"sources":[],"names":[],"sourcesContent":[]}
Find the sources prop which is an array of all of your source files. For example, if I search for one of my class names, I find the source to be something like: "webpack:///./app/components/TargetCard.js". I am using webpack and have a dir structure like below (simplified):
main
app
dist
which means that my webRoot as far as VSCode is concerned should equate to the dir one level above 'app', or 'main'. This is also where I run webpack from, so it makes sense. If I open the 'main' folder in VSCode, then my ${workspaceRoot} will also be 'main', so to have the debugger find my files I should set webRoot to simply be ${workspaceRoot}.
If you are using the debugger for chrome extension I would check that you are running chrome with remote debugging?
I was able to get mine working after I started running chrome with remote debugging.
from https://code.visualstudio.com/blogs/2016/02/23/introducing-chrome-debugger-for-vs-code
For now, Chrome needs to be started with remote debugging enabled, and only supports one concurrent connection. This means if you open up DevTools inside Chrome, the connection to VS Code will get terminated by Chrome. This is slightly annoying, and we hope this issue will be fixed sometime soon.
To do this i have a batch file that opens chrome with this command.
start /d "C:\Program Files (x86)\Google\Chrome\Application" chrome.exe --remote-debugging-port=9222
I totally agree with RVCA18. It's about the webRoot Setting that was wrong.
I had VS-Code ${workspaceRoot} pointing to a subfolder (just because I opened the project like that and had no script in the top-level folder). Since the index.html that is launched is in the top level folder I had to set the following Option in launch.json
"webRoot": "${workspaceRoot}/.."
For me, the problem occured in Visual Studio Code, using addons "Debugger for Chrome" with "Live Server".
I got it to work with the following settings:
Live Server's settings.json:
"liveServer.settings.AdvanceCustomBrowserCmdLine": "chrome --user-data-dir=C:/tmp --remote-debugging-port=9222",
launch.json:
"configurations": [
{
"name": "Attach to Chrome",
"port": 9222,
"request": "attach",
"type": "pwa-chrome",
"url": "http://127.0.0.1:5500/${relativeFile}",
"sourceMaps": true,
"webRoot": "${workspaceFolder}"
},
UPDATE: Solved one part, but not other
I have the CRX updating now (it was not rebuilding).
However, Chrome will not accept the XML or CRX at an https URL.
I believe #2 is because it's a self-signed certificate. Does anyone know if there's a way around this? (This is purely for development, so hosted internally)
ORIGINAL POST:
I created a packaged extension that is hosted on my internal website, but is added to Chrome via dragging it from the desktop (because Chrome won't allow installing packaged extensions via external websites - see here: After adding ExtensionInstallSources preference with my URL to Chrome Preferences, still won't allow installing ".crx" packaged app ).
The manifest has the update_url set to an XML file located on my site. That XML file has the url for the crx file set under updatecheck codebase='...'. Both files exist on the website and are findable. I also upated the version number from 2.0.0.2 to 2.0.0.2 in both the XML file and the manifest.json. I also made a change in the index.html file of the extension.
I checked the appid and it is the same in the XML file and in Chrome.
Despite clicking the "update extensions now" button about 50 times, and waiting 10 minutes, it does not update.
NOTE: I did alias the internal ip 192.168.1.108 where the site is hosted in my hosts file as myinternal.fake but this works in both chrome and firefox so I don't think that's the issue
Update XML File (located at: https://myinternal.fake/updates/helloworld.xml)
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='akchdaojnpiglpjeiamjpacbkppcgbgj'>
<updatecheck codebase='https://myinternal.fake/helloworld.crx' version='2.0.0.2' prodversionmin='23' />
</app>
</gupdate>
manifest.json
{
"manifest_version": 2,
"name": "Hello World",
"version": "2.0.0.2",
"minimum_chrome_version": "23",
"update_url": "https://myinternal.fake/updates/helloworld.xml",
"icons":
{
"16": "icon_16.png",
"128": "icon_128.png"
},
"app":
{
"background":
{
"scripts":
[
"main.js"
]
}
}
}
EDIT: I also checked and the header is an acceptable one for Chrome (according to this: http://developer.chrome.com/dev/extensions/hosting.html). It sends the CRX file as "text/plain" and does NOT send the header X-Content-Type-Options: nosniff so it should be valid.
Also, when I changed from https to http, now when I click "update extensions now" the extension disappears for a split second which indicates it's now reading the XML, but still not accepting the update!
The issue is with self-signed certificates and Chrome. Chrome does not accept Extension updates form self-signed certificates unless they're an "accepted" authority. These steps will make it work:
Follow these steps: https://stackoverflow.com/a/15076602/857025 to export your certificate and then import it as an authority
Close Chrome
Restart Chrome
Close extensions window if opened
Reopen via "chrome://extensions" and then click "update extensions now"
It should then update your extension located on a self-signed https connection.
UPDATE This is not a perfect solution as Chrome appears to be a bit wonky in accepting self-signed certs. It randomly stops seeing updates. If I switch back to using regular http (for the update_url and the CRX's url), updates happen every time.
I checked and my cert is still a trusted authority but Chrome suddenly stopped recognizing updates, so there must be an issue with this.
By the way Google Stopped supporting updating extensions that are hosted outside of Chrome Webstore: http://blog.chromium.org/2013/11/protecting-windows-users-from-malicious.html
With Chrome Version 27.0.1448.0 dev while attempting to call
chrome.downloads.download(url:song.url);
I receive the error chrome.downloads is not available: You do not have permission to access this API. Ensure that the required permission or manifest property is included in your manifest.json.
My permissions look like.
"permissions": [
"downloads",
"https://*/*", "http://*/*",
"tabs"
],
I believe that this is an experimental feature, so you may need to request "experimental" permission as well.