diff --git a/.gitignore b/.gitignore index 81cf67a..3f8cf48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ -*.mov \ No newline at end of file +*.mov +metube-browser-extension.pem \ No newline at end of file diff --git a/attach/screen-for-webstore.png b/attach/screen-for-webstore.png new file mode 100644 index 0000000..32c4f46 Binary files /dev/null and b/attach/screen-for-webstore.png differ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..5fdda21 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +VERSION=$(jq -r ".version" ./src/manifest.json) + +if test -z "$VERSION"; then + echo "can't parse version from manifest file" + exit +fi + +FILE=metube-browser-extension-"$VERSION".zip + +if test -f "./builds/$FILE"; then + if [ "$1" == "--force" ]; then + rm -f "./builds/$FILE" + else + echo "file ./builds/$FILE already exists. if you want to rewrite it use argument --force" + exit + fi +fi + +cd ./src && zip -9 -r ../builds/"$FILE" ./* diff --git a/builds/metube-browser-extension-1.0.zip b/builds/metube-browser-extension-1.0.zip new file mode 100644 index 0000000..b12ac05 Binary files /dev/null and b/builds/metube-browser-extension-1.0.zip differ diff --git a/background.js b/src/background.js similarity index 94% rename from background.js rename to src/background.js index 9966adb..96dbbf3 100644 --- a/background.js +++ b/src/background.js @@ -5,7 +5,7 @@ chrome.runtime.onInstalled.addListener(function () { chrome.contextMenus.create({ id: 'metube', title: "Send to MeTube", - documentUrlPatterns: [ + targetUrlPatterns: [ 'https://www.youtube.com/*', 'https://m.youtube.com/*', 'https://youtu.be/*' @@ -21,9 +21,7 @@ chrome.contextMenus.onClicked.addListener(function (item, tab) { return } - let url = data.metube; - - fetch(url + "/add", { + fetch(data.metube + "/add", { method: 'POST', headers: { 'Accept': 'application/json', @@ -35,12 +33,14 @@ chrome.contextMenus.onClicked.addListener(function (item, tab) { if (res.ok === true && res.status === 200) { return res.json(); } + // todo fix it alert("error :: code " + res.status); }) .then(function (result) { if (result.status === "ok") { openTab(data.metube, tab); } else { + // todo fix it alert("error :: " + json); } }) diff --git a/icon128.png b/src/icon128.png similarity index 100% rename from icon128.png rename to src/icon128.png diff --git a/icon16.png b/src/icon16.png similarity index 100% rename from icon16.png rename to src/icon16.png diff --git a/icon48.png b/src/icon48.png similarity index 100% rename from icon48.png rename to src/icon48.png diff --git a/manifest.json b/src/manifest.json similarity index 100% rename from manifest.json rename to src/manifest.json diff --git a/options.html b/src/options.html similarity index 100% rename from options.html rename to src/options.html diff --git a/options.js b/src/options.js similarity index 100% rename from options.js rename to src/options.js