1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-28 08:28:36 -06:00

Compare commits

..

No commits in common. "d278021e1b32287deb3aa7ece0c53b1c8c603be5" and "cde3fb4c895c519d7a4c4403c0a56e153ca11eb7" have entirely different histories.

2 changed files with 30 additions and 46 deletions

View file

@ -1,37 +1,29 @@
#!/bin/env bash #!/bin/env bash
if [ "$1" == "dev" ]; then v_patch=$(cat actix/Cargo.toml | sed -rn 's/^version = "(.+)"$/\1/p')
name="chhoto-url" v_minor=$(echo $v_patch | sed -rn 's/^(.+\..+)\..+$/\1/p')
docker build -t $name . v_major=$(echo $v_minor | sed -rn 's/^(.+)\..+$/\1/p')
docker tag $name sintan1729/$name:dev
docker push sintan1729/$name:dev
elif [ "$1" == "release" ]; then name="chhoto-url"
v_patch=$(cat actix/Cargo.toml | sed -rn 's/^version = "(.+)"$/\1/p')
v_minor=$(echo $v_patch | sed -rn 's/^(.+\..+)\..+$/\1/p')
v_major=$(echo $v_minor | sed -rn 's/^(.+)\..+$/\1/p')
name="chhoto-url" docker build -t $name .
docker build -t $name . for tag in $v_major $v_minor $v_patch latest
do
docker tag $name sintan1729/$name:$tag
done
for tag in $v_major $v_minor $v_patch latest echo "Do you want to push these to Docker Hub?"
do select yn in "Yes" "No";
docker tag $name sintan1729/$name:$tag do
done if [ "$yn"="Yes" ]; then
for tag in $v_major $v_minor $v_patch latest
echo "Do you want to push these to Docker Hub?" do
select yn in "Yes" "No"; docker push sintan1729/$name:$tag
do done
if [ "$yn"="Yes" ]; then else
for tag in $v_major $v_minor $v_patch latest echo "Okay! Not pushing."
do fi
docker push sintan1729/$name:$tag break
done done
else
echo "Okay! Not pushing."
fi
break
done
fi

View file

@ -1,30 +1,22 @@
const prepSubdir = (link) => { const getSiteUrl = async () => await fetch("/api/siteurl")
let thisPage = new URL(window.location.href);
let subdir = thisPage.pathname;
let out = (subdir+link).replace('//','/');
console.log(out);
return (subdir+link).replace('//','/');
}
const getSiteUrl = async () => await fetch(prepSubdir("/api/siteurl"))
.then(res => res.text()) .then(res => res.text())
.then(text => { .then(text => {
if (text == "unset") { if (text == "unset") {
return window.location.host.replace(/\/$/,''); return window.location.host;
} }
else { else {
return text.replace(/\/$/,''); return text;
} }
}); });
const getVersion = async () => await fetch(prepSubdir("/api/version")) const getVersion = async () => await fetch("/api/version")
.then(res => res.text()) .then(res => res.text())
.then(text => { .then(text => {
return text; return text;
}); });
const refreshData = async () => { const refreshData = async () => {
let reply = await fetch(prepSubdir("/api/all")).then(res => res.text()); let reply = await fetch("/api/all").then(res => res.text());
if (reply == "logged_out") { if (reply == "logged_out") {
console.log("logged_out"); console.log("logged_out");
document.getElementById("container").style.filter = "blur(2px)" document.getElementById("container").style.filter = "blur(2px)"
@ -144,7 +136,7 @@ const deleteButton = (shortUrl) => {
if (confirm("Do you want to delete the entry " + shortUrl + "?")) { if (confirm("Do you want to delete the entry " + shortUrl + "?")) {
document.getElementById("alert-box")?.remove(); document.getElementById("alert-box")?.remove();
showAlert(" ", "black"); showAlert(" ", "black");
fetch(prepSubdir(`/api/del/${shortUrl}`), { fetch(`/api/del/${shortUrl}`, {
method: "DELETE" method: "DELETE"
}).then(_ => refreshData()); }).then(_ => refreshData());
} }
@ -170,7 +162,7 @@ const submitForm = () => {
const longUrl = form.elements["longUrl"]; const longUrl = form.elements["longUrl"];
const shortUrl = form.elements["shortUrl"]; const shortUrl = form.elements["shortUrl"];
const url = prepSubdir("/api/new"); const url = `/api/new`;
fetch(url, { fetch(url, {
method: "POST", method: "POST",
@ -196,7 +188,7 @@ const submitForm = () => {
const submitLogin = () => { const submitLogin = () => {
const password = document.getElementById("password"); const password = document.getElementById("password");
fetch(prepSubdir("/api/login"), { fetch("/api/login", {
method: "POST", method: "POST",
body: password.value body: password.value
}).then(res => { }).then(res => {