Chrome Extension manifest.json difference - google-chrome

I'm trying to create zip package for my chrome extension for chome webstore, and having difficulties to determine what kind manifest.json format that requires in the zip package.
my first attempt was to copy the manifest.json that in my extension (compiled to .crx file) into the zip package, so the content of zip package
manifest.json
myextension.crx
but this approach leads to a problem where background script cannot be loaded when try to install the extension in chrome.
my second attempt was to strip the manifest json and only leave some fields such name, description, and icon. It seems my second attempt was successful, as my extension can be installed.
Is my approach was correct? please advise.

The correct format of the manifest file is documented here. That having said, I suspect that the issue has nothing to do with your manifest file, but the structure of your zip file. When submitting a zip file, make sure that you zip the directory's content, not the directory itself.
E.g. the following structure is OK:
manifest.json
background.js
...
The following is not OK:
extension/manifest.json
extension/background.js
You've probably created the following situation, which is not OK, because it declares the background script as "background.js", while it's actually located at "extension/background.js":
manifest.js containing "background": {"scripts": ["background.js"] }
extension/background.js
Your second attempt probably worked because you had zipped the file in the correct way.

Actually you should upload a ZIP archive that contains just the root directory of your extension (nothing should be CRXed). According to the "Get Started" guide:
Create a ZIP archive of the directory that contains manifest.json and the icon. On Windows, you can do this by right-clicking myapp and choosing the menu item Send to > Compressed (zipped) folder. On Mac OS X, control-click myapp and choose Compress "myapp".
If you like to use the command line, you might enter this:
zip -r myapp.zip myapp
Note: The ZIP archive should not contain just the contents of the extension's root directory, but the root directory itself (with all its content, of course).
(BTW, I have no idea why your second attempt worked - according to the docs it shouldn't.)
UPDATE:
After trying it out myself, both approaches seem to work.
Bottom line, upload a ZIP archive with the content of your extension and not any CRXed stuff. Google will produce the CRX itself.

Related

Ship file with flatpak

I have a json file with some data that I want to ship with my application.
I want to include it on the folder /app/share/<app-name>/data/<file>.json.
I have researched, looked on the flatpak manifest documentation and the manifest of other applications, but I saw no mention to this option.
So, how would be the proper way of adding this file on the manifest?
You can do this by adding this file as part of the "sources" field in your module, and then installing it.
An example of this in the Flathub repo for Spotify. There, we definitely have a need for shipping separate files that make the integration into your DE seamless, as Spotify doesn't ship those. Concretely, let's look at the desktop launch file that is added:
The file can be found here: https://github.com/flathub/com.spotify.Client/blob/master/com.spotify.Client.desktop
You specify the relative path as a "file" source
Add the install command to the build-commands field of your module

can Chrome debugger find ts files if not served by server

I'm generating .js.map files so that I can debug my TypeScript code in Chrome. js.map files point to the correct location of the typescript in the "sources" property. sourceRoot is "", and sources is the path to the typescript code from the location of the js file on disk (using outDir in jsconfig.json so that they're placed under the WebContent tree), but the typescript is outside of the web content tree. In the debugger in Chrome, it shows that map files were detected, I see a directory tree in the Sources list in the debugger, it points to the right location on disk, and it contains all of my ts files in the right locations (visually), but opening any one of them shows empty contents. Double-clicking in the .js file in the debugger to set a bp takes me to the empty .ts file. I don't know what details to provide in order to have a chance of getting help on this. All questions welcome.
I had the same problem as you. The solution is simple.
In your build.xml you have excluded somehow these *.ts files or their parent's folder, so the server doesn't load these files. You can find the excluded files and folders inside a tag fileset excludes="" in your build.xml.
Or inside the same fileset includes="" tag you don't include these files.
See my fileset:

Convert .json to ipynb

I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"_You are currently looking at **version 1.1** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._\n",
"\n",
"---"
]
},
...
}
I've tried deleting the ".json" in the file name and it doesn't work. How can I convert this file back to something that can be opened and run as an ipython notebook? Thank you very much!
My Solution: just remove the filename extension .json. for example, change myfile.ipynb.json to myfile.ipynb. Then, you can open it by a click in jupyter notebook !
I have encounter the same problem as you did. I found a link that describe what ipynb exactly is. see here http://ipython.org/ipython-doc/rel-1.0.0/interactive/nbconvert.html. It says ipynb file is actually json file. Hope this
On the Mac you could go and
Right click on the filename.ipynb.json
Click on Get Info from the list.
From the Get Info window, find the section Name&Extension remove the extension/suffix .json from the file name.
Hope that helps!
Are you trying download this from Github? Especially on Google Chrome browsers, I've had issues download .ipynb files using right click > Save link as... I'm not sure if other browsers have this issue (Microsoft Edge, Mozilla Firefox, Safari, etc.).
This causes issues since when downloading, it doesn't completely download the file usually and it becomes corrupted so you can't download an IPython notebook that may run properly. One trick when trying to download .ipynb files on Github is to click it, click Raw, then copy everything (Ctrl + A) and paste it into a blank file (using text editors such as Notepad, Notepad++, Vim, etc.) and save it as "whatever_file_name_you_choose.ipynb". Then you should be able to properly run this file, assuming a non-corrupted file was uploaded to Github.
A lot of people with very large, complicated IPython notebooks on Github will inevitably run into this issue when simply trying to download with Save link as.... Hopefully this helps!
I opened it as/with nbviewer and then selected it all and saved it as a "txt" file that I then opened in Notepad++. I then resaved it as a file with the extension ipynb and opened it in my jupyter notebook ok.
The easy thing to do is to copy the JSON contents into a notepad and save it again with .ipynb extension
Just remove the .json file extension leaving the .ipynb one, as pointed out by the following related post: https://superuser.com/questions/1497243/why-cant-i-save-a-jupyter-notebook-as-a-ipynb. As #jackie already said, you should consider them as .json files meant only to be edited by the IPython Notebook app itself, not for hand-editing.
Use a simple trick. Let that file get downloaded automatically. Re-download it again then it will prompt you to download and replace that file. At that time, you save that by replacing .json to .ipynb
After downloading the file with ipynb.json, Take the following steps:
Go your terminal/command line window
Navigate to the directory where your file is
Type:
windows OS: rename yourfile.ipynb.json to yourfile.ipynb
Unix/Linux: mv yourfile.ipynb.json to yourfile.ipynb
This work perfectly for me.
i tried this method and it worked. Just copy, paste it in notepad and save as "file_name.ipynb". hope this works for you too.

Inject/Remove HTML via Chrome Extension

I'm making a chrome extension and on a specific web page I have a table that has commented out information.
I'd like to remove the comment syntax so that the information is displayed in the table
What kind of content script would I need to parse the HTML for the specific comment syntax and then remove it?
Also, every time I pack my extension to a .crx file the file size nearly doubles. Is this standard? My 16 kb files are turning into a 40 MB extension- I'm worried that it isn't supposed to work like that.
First off, likely when you package your extension into a .crx file, you're putting the resulting .crx file in the same folder as your source files.
Then the next time that you package the extension, instead of your source folder having just the files you want to package, it has the files you want to package plus the previous .crx file. Every time this happens you effectively (just over) double the file size. To prevent this, make sure the .crx file is getting saved to the parent directory.
As far as the uncommenting HTML goes, I would check out this answer:
Uncomment html code using javascript

Selenium ide to locate a file and store its path info from any computer

currently in my test scripts for automated file upload to browser, the paths are already defined in the value column
command type
target //input[#type='file']
value /Users/.../.../.../filename.extension
in such cases, this script is unable to run on other computers because the path would be different.
my question will be is
is there a way to locate the file in a general folder (for example file is downloaded and in the "download" folder), by using selenium ide can we get the path of the file (/Users/.../downloads/filename.extension)
store the path of the file with its extension into a notepad which i will be using it for multiple test of file uploads later on.
right now if my colleague needs to run the script from his computer, he have to manually change the value to his path.
You could use a suite file that contains a "setup" file to only change the file name in 1 place and the variable is shared across tests in the suite. You could also select an agreed up on place to store the files: c:\test_info\image.jpg.
Or you can make the file available by URL & not local, Unfortunately javascript prevents that for security: How to get the current file path in javascript
Unfortunately I can't think of any other good way unless you all have the same path in a home directory and could do something like ~/test_dir/photo.jpg