make builds environment

This commit is contained in:
Rpsl 2021-07-27 09:38:16 +03:00
parent 7c68f691d8
commit 3ddfd67ddd
11 changed files with 27 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
.idea/
*.mov
*.mov
metube-browser-extension.pem

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

21
build.sh Executable file
View File

@ -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" ./*

Binary file not shown.

View 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);
}
})

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 783 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB