make builds environment
|
|
@ -1,2 +1,3 @@
|
||||||
.idea/
|
.idea/
|
||||||
*.mov
|
*.mov
|
||||||
|
metube-browser-extension.pem
|
||||||
|
After Width: | Height: | Size: 57 KiB |
|
|
@ -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" ./*
|
||||||
|
|
@ -5,7 +5,7 @@ chrome.runtime.onInstalled.addListener(function () {
|
||||||
chrome.contextMenus.create({
|
chrome.contextMenus.create({
|
||||||
id: 'metube',
|
id: 'metube',
|
||||||
title: "Send to MeTube",
|
title: "Send to MeTube",
|
||||||
documentUrlPatterns: [
|
targetUrlPatterns: [
|
||||||
'https://www.youtube.com/*',
|
'https://www.youtube.com/*',
|
||||||
'https://m.youtube.com/*',
|
'https://m.youtube.com/*',
|
||||||
'https://youtu.be/*'
|
'https://youtu.be/*'
|
||||||
|
|
@ -21,9 +21,7 @@ chrome.contextMenus.onClicked.addListener(function (item, tab) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = data.metube;
|
fetch(data.metube + "/add", {
|
||||||
|
|
||||||
fetch(url + "/add", {
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
|
@ -35,12 +33,14 @@ chrome.contextMenus.onClicked.addListener(function (item, tab) {
|
||||||
if (res.ok === true && res.status === 200) {
|
if (res.ok === true && res.status === 200) {
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
|
// todo fix it
|
||||||
alert("error :: code " + res.status);
|
alert("error :: code " + res.status);
|
||||||
})
|
})
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
if (result.status === "ok") {
|
if (result.status === "ok") {
|
||||||
openTab(data.metube, tab);
|
openTab(data.metube, tab);
|
||||||
} else {
|
} else {
|
||||||
|
// todo fix it
|
||||||
alert("error :: " + json);
|
alert("error :: " + json);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 783 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |