make builds environment
|
|
@ -1,2 +1,3 @@
|
|||
.idea/
|
||||
*.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({
|
||||
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);
|
||||
}
|
||||
})
|
||||
|
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 |