Added option to allow localhost only, and added back button to settings page. scrapped account support

This commit is contained in:
Leon Etienne (ubuntu wsl)
2020-09-30 22:41:00 +02:00
parent 2f0935cddc
commit 66882b3b67
24 changed files with 170 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
<template>
<svg viewBox="0 0 16 16" class="bi bi-gear" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<svg viewBox="-2 -2 20 20" class="bi bi-gear" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M8.837 1.626c-.246-.835-1.428-.835-1.674 0l-.094.319A1.873 1.873 0 0 1 4.377 3.06l-.292-.16c-.764-.415-1.6.42-1.184 1.185l.159.292a1.873 1.873 0 0 1-1.115 2.692l-.319.094c-.835.246-.835 1.428 0 1.674l.319.094a1.873 1.873 0 0 1 1.115 2.693l-.16.291c-.415.764.42 1.6 1.185 1.184l.292-.159a1.873 1.873 0 0 1 2.692 1.116l.094.318c.246.835 1.428.835 1.674 0l.094-.319a1.873 1.873 0 0 1 2.693-1.115l.291.16c.764.415 1.6-.42 1.184-1.185l-.159-.291a1.873 1.873 0 0 1 1.116-2.693l.318-.094c.835-.246.835-1.428 0-1.674l-.319-.094a1.873 1.873 0 0 1-1.115-2.692l.16-.292c.415-.764-.42-1.6-1.185-1.184l-.291.159A1.873 1.873 0 0 1 8.93 1.945l-.094-.319zm-2.633-.283c.527-1.79 3.065-1.79 3.592 0l.094.319a.873.873 0 0 0 1.255.52l.292-.16c1.64-.892 3.434.901 2.54 2.541l-.159.292a.873.873 0 0 0 .52 1.255l.319.094c1.79.527 1.79 3.065 0 3.592l-.319.094a.873.873 0 0 0-.52 1.255l.16.292c.893 1.64-.902 3.434-2.541 2.54l-.292-.159a.873.873 0 0 0-1.255.52l-.094.319c-.527 1.79-3.065 1.79-3.592 0l-.094-.319a.873.873 0 0 0-1.255-.52l-.292.16c-1.64.893-3.433-.902-2.54-2.541l.159-.292a.873.873 0 0 0-.52-1.255l-.319-.094c-1.79-.527-1.79-3.065 0-3.592l.319-.094a.873.873 0 0 0 .52-1.255l-.16-.292c-.892-1.64.902-3.433 2.541-2.54l.292.159a.873.873 0 0 0 1.255-.52l.094-.319z"/>
<path fill-rule="evenodd" d="M8 5.754a2.246 2.246 0 1 0 0 4.492 2.246 2.246 0 0 0 0-4.492zM4.754 8a3.246 3.246 0 1 1 6.492 0 3.246 3.246 0 0 1-6.492 0z"/>
</svg>

View File

@@ -9,26 +9,11 @@
<div class="w-full lg:w-1/2 border-right lg:pr-3">
<div class="option toggle flex justify-between items-center">
<div v-if="serverOs === 'Windows'" class="option toggle flex justify-between items-center">
<p>Show console</p>
<Toggle :isOn="false"/>
</div>
<div class="option toggle flex justify-between items-center">
<p>Use account</p>
<Toggle :isOn="false"/>
</div>
<div class="option text flex justify-between w-full items-center">
<p class="mr-3">Username</p>
<input type="text" id="username" name="username">
</div>
<div class="option text flex justify-between w-full items-center">
<p class="mr-3">Password</p>
<input type="password" id="password" name="password">
</div>
<div class="option toggle flex justify-between items-center">
<p>Limit speed</p>
<Toggle :isOn="false"/>
@@ -75,8 +60,16 @@
<Spacer height="50px"/>
<div class="button" v-on:click="clearDLCache">Clear downloads</div>
<div class="button mt-2" v-on:click="clearLogs">Clear logs</div>
<div class="flex">
<div class="flex flex-col mr-1">
<div class="button" v-on:click="clearDLCache">Clear downloads</div>
<div class="button mt-2" v-on:click="clearLogs">Clear logs</div>
<div class="button mt-2" v-if="serverOs === 'Windows'" v-on:click="updateYtdl">Update ytdl</div>
</div>
<div class="flex flex-col ml-1">
<div class="button" v-on:click="killServer">Kill server</div>
</div>
</div>
</div>
@@ -90,6 +83,12 @@
</div>
</div>
<div class="go-back hidden md:block">
<nuxt-link exact to="/">
&lt;&lt;&nbsp;Back
</nuxt-link>
</div>
</div>
</template>
@@ -110,12 +109,14 @@ export default {
computed: {
diskUsage: function() {
return this.$store.state.diskUsage.usage;
},
serverOs: function() {
return this.$store.state.serverOs.os_name;
}
},
methods: {
clearDLCache: function() {
const that = this;
axios.post("/api", {
request: "clear_download_cache",
@@ -128,7 +129,6 @@ export default {
},
clearLogs: function() {
const that = this;
axios.post("/api", {
request: "clear_logs",
@@ -139,10 +139,35 @@ export default {
});
return;
},
updateYtdl: function() {
const that = this;
axios.post("/api", {
request: "update_dep_youtubedl",
}).then(function(response){
if (response.data.status === "OK") {
that.$store.dispatch("logs/update", that);
}
});
return;
},
killServer: function() {
const that = this;
axios.post("/api", {
request: "kill_yourself",
}).then(function(response){
if (response.data.status === "OK") {
window.close();
}
});
return;
},
},
mounted() {
this.$store.dispatch("diskUsage/update", this);
this.$store.dispatch("serverOs/update", this);
return;
}
};
@@ -215,7 +240,7 @@ h2 {
font-family: ZillaSlab, serif;
font-size: 18pt;
transition: background-color 0.2s;
max-width: 200px;
width: 200px;
&:hover {
background-color: theme("colors.text-error-1");
@@ -226,4 +251,22 @@ hr {
border: none;
border-bottom: 2px solid theme("colors.gray-1");
}
@keyframes goback-floating {
0% { left: 1em; }
50% { left: 1.2em; }
0% { left: 1em; }
}
.go-back {
position: absolute;
left: 1em;
top: 1em;
font-size: 34pt;
font-family: ZillaSlab, serif;
color: theme("colors.purple-3-1");
user-select: none;
cursor: pointer;
animation: goback-floating 1s infinite;
}
</style>

View File

@@ -0,0 +1,24 @@
import axios from 'axios';
export const state = () => ({
os_name: ""
});
export const mutations = {
update(state, data) {
state.os_name = data;
},
};
export const actions = {
update(context, instance) {
axios.post("/api", {
request: "get_os_name"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("serverOs/update", response.data.os_name);
}
});
},
};