Skip to content

Commit

Permalink
build to .xpi
Browse files Browse the repository at this point in the history
 - updated manuals
 - post install script
  • Loading branch information
lt-mayonesa committed Apr 21, 2019
1 parent 4423ee4 commit 4fc8350
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cache:
- node_modules

install:
- npm install esdoc esdoc-standard-plugin esdoc-ecmascript-proposal-plugin karma karma-jasmine karma-firefox-launcher karma-chrome-launcher jasmine-core karma-coverage google-closure-compiler
- npm install esdoc esdoc-standard-plugin esdoc-ecmascript-proposal-plugin karma karma-jasmine karma-firefox-launcher karma-chrome-launcher jasmine-core karma-coverage google-closure-compiler web-ext

before_script:
- export DISPLAY=:99.0
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Pull requests are welcome.
## Installation
Go to the [latest release](https://github.com/Lt-Mayonesa/browser-mpris2/releases/latest) and download both `.crx` and `.deb` artifacts.

Install the `.deb` file. This will make `chrome-mpris2` from the command line available.
Install the `.deb` file. This will make `browser-mpris2` from the command line available.

### for Chrome
Then, in Chrome, go to `Tools > Extensions` (or [chrome://extensions](chrome://extensions)) and enable `Developer mode`.
Expand All @@ -28,9 +28,9 @@ Grab the `.crx` file you downloaded and drop it on the Extensions page (if "Drop

Once the extension loaded copy the extension ID (it should be: `mcakdldkgmlakhcpdmecedogacbagdba`).

Next, open a terminal and run `chrome-mpris2 --init-chrome [EXTENSION_ID]`. ie:
Next, open a terminal and run `browser-mpris2 --init-chrome [EXTENSION_ID]`. ie:
```bash
chrome-mpris2 --init-chrome mcakdldkgmlakhcpdmecedogacbagdba
browser-mpris2 --init-chrome mcakdldkgmlakhcpdmecedogacbagdba
```
Profit

Expand All @@ -44,9 +44,9 @@ Open Firefox and go to [about:debugging#addons](about:debugging#addons).

Click on "Load temporary Add-on" button and select the `manifest.json` from the `extension/` dir of the extracted file.

Next, open a terminal and run `chrome-mpris2 --init-firefox [EXTENSION_ID]`. ie:
Next, open a terminal and run `browser-mpris2 --init-firefox [EXTENSION_ID]`. ie:
```bash
chrome-mpris2 --init-firefox 0974c166a46e1eeabfa31321730f621ab0362f05@temporary-addon
browser-mpris2 --init-firefox 0974c166a46e1eeabfa31321730f621ab0362f05@temporary-addon
```

Reload the extension and profit.
Expand Down
36 changes: 15 additions & 21 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ native=${out}"native/"

title "Step 1: Copy source files"
mkdir -p ${native}"DEBIAN" && cp -v "src/native/control" ${native}"DEBIAN/"
mkdir -p ${native}"usr/bin" && cp -v "src/native/chrome-mpris2" ${native}"usr/bin/"
cp -v "src/native/postinst" ${native}"DEBIAN/"
mkdir -p ${native}"usr/bin" && cp -v "src/native/browser-mpris2" ${native}"usr/bin/"

title "Step 2: Make script executable"
chmod +x ${native}"usr/bin/chrome-mpris2"
title "Step 2: Make scripts executable"
chmod +x ${native}"usr/bin/browser-mpris2"
chmod +x ${native}"DEBIAN/postinst"


title "PACKAGE"
Expand All @@ -95,28 +97,20 @@ cd ..
echo "Created release .zip for version $version"

if [[ "$version" != "v666" ]]; then
title "Step 3: Package extension"
title "Step 3: Package Chrome extension"
/opt/google/chrome/chrome --no-message-box --pack-extension=./dist/extension --pack-extension-key=./extension.pem
mv dist/extension.crx ${out}"browser-mpris2-${version}.crx"
echo "Create release .crx for version $version"

title "Step 4: Build .deb package"
sudo chown root:root ${native}"usr/bin/chrome-mpris2"
dpkg -b ${native} ${out}"browser-mpris2-${version}.deb"

# title "Step 4: Generate update .xml"
# echo "<?xml version='1.0' encoding='UTF-8'?>
#<gupdate xmlns='https://www.google.com/update2/response' protocol='2.0'>
# <app appid='mcakdldkgmlakhcpdmecedogacbagdba'>
# <updatecheck codebase='https://github.com/Lt-Mayonesa/browser-mpris2/releases/download/$version/browser-mpris2-$version.crx' version='"${version/v/}"' />
# </app>
#</gupdate>
#" > "${out}updates.xml";
#
# title "Step 5: Add updated URL"
# cat "${extension}manifest.json" | \
# jq '. + {update_url: "https://github.com/Lt-Mayonesa/browser-mpris2/releases/download/'${version}'/update.xml"}' \
# > ${extension}manifest.json
title "Step 4: Sign Firefox extension"
cat package.json | jq '.version = "'${version/v/}'"' > package.tmp.json && mv package.tmp.json package.json
npx web-ext sign -s dist/extension -a dist/ --api-key=${MOZ_API_KEY} --api-secret=${MOZ_API_SECRET}

title "Step 5: Build .deb package"
sudo chown root:root ${native}"usr/bin/browser-mpris2"
dpkg-deb -b ${native} ${out}"browser-mpris2-${version}.deb"

echo "Created release for version $version successfully! ✓"
fi

title "DONE ✓"
Expand Down
2 changes: 1 addition & 1 deletion manual/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Out of the box this project has support for `video` and `audio` tags in all site

By extending this projects base classes it is possible to modify the default interaction with each site for specific sites. We call them providers.

If you would like to contribute with a provider see the [how to](how_to.md) manual.
If you would like to contribute with a provider see the [how to](manual/how_to.html) manual.
8 changes: 7 additions & 1 deletion src/browser/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"manifest_version": 2,
"name": "browser-mpris2-debug",
"description": "Implements the MPRIS2 interface for Chrome and Firefox",
"version": "0.2.1",
"version": "0.3.7",
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "42.0"
}
},
"browser_action": {
"default_title": "Browser MPRIS2",
"default_popup": "popup/popup.html"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/native/control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: chrome-mpris2
Package: browser-mpris2
Version: $version
Architecture: all
Maintainer: Joaco Campero<[email protected]>
Expand Down
4 changes: 4 additions & 0 deletions src/native/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

browser-mpris2 --init-chrome "mcakdldkgmlakhcpdmecedogacbagdba"
browser-mpris2 --init-firefox "[email protected]"

0 comments on commit 4fc8350

Please sign in to comment.