Compare commits
No commits in common. "93994d5dd77d61d4f005d42114177701461f9a9d" and "4c270d5e3883e0f6acdead1e4ddb552aa1a0e62e" have entirely different histories.
93994d5dd7
...
4c270d5e38
@ -9,6 +9,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { watchEffect } from 'vue';
|
||||||
|
|
||||||
import Navbar from './Navbar.vue';
|
import Navbar from './Navbar.vue';
|
||||||
import Login from './Login.vue';
|
import Login from './Login.vue';
|
||||||
import RouteSchedule from './RouteSchedule.vue';
|
import RouteSchedule from './RouteSchedule.vue';
|
||||||
@ -45,7 +47,10 @@
|
|||||||
].forEach(route => this.$root.$router.addRoute(route));
|
].forEach(route => this.$root.$router.addRoute(route));
|
||||||
await this.$root.$router.replace(this.$route);
|
await this.$root.$router.replace(this.$route);
|
||||||
}
|
}
|
||||||
if(value) this.heartbeat = await value.heartbeat();
|
if(value) {
|
||||||
|
this.heartbeat = await value.heartbeat();
|
||||||
|
var stop = watchEffect(() => { if(!value.connected.value) { stop(); this.client = this.server = this.user = null; } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
<div class="accordion mb-3 shadow">
|
<div class="accordion mb-3 shadow">
|
||||||
<div class="accordion-item">
|
<div class="accordion-item">
|
||||||
<h2 class="accordion-header"><button class="accordion-button" :class="{ testing: (x_server) && (x_server.production) && (x_server.production != '1') }" type="button" @click="() => show = !show"><template v-if="user">{{user[2]}}<template v-if="server"> @ {{server.domain}}</template></template><template v-else>Login</template></button></h2>
|
<h2 class="accordion-header"><button class="accordion-button" :class="{ testing: (x_server) && (x_server.production) && (x_server.production != '1') }" type="button" @click="() => show = !show"><template v-if="user">{{user[2]}}<template v-if="server"> @ {{server.domain}}</template></template><template v-else>Login</template></button></h2>
|
||||||
<div class="accordion-collapse collapse" :class="{ show: (show) || (!x_client) }">
|
<div class="accordion-collapse collapse" :class="{ show }">
|
||||||
<div class="accordion-body" v-if="!x_client"><button v-if="fail" class="btn btn-primary btn-lg" style="width: 100%;" @click="connect">Reconnect</button><button v-else class="btn btn-outline-primary btn-lg" style="width: 100%;" @click="connect">Connect</button></div>
|
<div class="accordion-body">
|
||||||
<div class="accordion-body" v-else>
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text row"><code class="col" v-if="banner"><pre>{{banner.join('\n')}}</pre></code><code class="col" v-if="user"><pre>{{user.join('\n')}}</pre></code></p>
|
<p class="card-text row"><code class="col" v-if="banner"><pre>{{banner.join('\n')}}</pre></code><code class="col" v-if="user"><pre>{{user.join('\n')}}</pre></code></p>
|
||||||
@ -45,8 +44,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { watchEffect } from 'vue';
|
|
||||||
|
|
||||||
import vistax from './vistax.mjs';
|
import vistax from './vistax.mjs';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -76,7 +73,6 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: false,
|
show: false,
|
||||||
fail: false,
|
|
||||||
x_client: this.client,
|
x_client: this.client,
|
||||||
x_server: this.server,
|
x_server: this.server,
|
||||||
x_user: this.user,
|
x_user: this.user,
|
||||||
@ -102,7 +98,7 @@
|
|||||||
}, immediate: true
|
}, immediate: true
|
||||||
},
|
},
|
||||||
client(value) { this.x_client = value; },
|
client(value) { this.x_client = value; },
|
||||||
x_client(value) { this.$emit('update:client', value); },
|
x_client(value) { this.$emit('update:client', value); if(!value) this.connect(); },
|
||||||
server(value) { this.x_server = value; },
|
server(value) { this.x_server = value; },
|
||||||
x_server(value) { this.$emit('update:server', value); },
|
x_server(value) { this.$emit('update:server', value); },
|
||||||
user(value) { this.x_user = value; },
|
user(value) { this.x_user = value; },
|
||||||
@ -111,7 +107,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
async connect() {
|
async connect() {
|
||||||
this.logout();
|
this.logout();
|
||||||
if(this.x_client = await (this.host ? vistax.Client.fromCookie(this.secret, this.host) : vistax.Client.fromCookie(this.secret))) {
|
this.x_client = await (this.host ? vistax.Client.fromCookie(this.secret, this.host) : vistax.Client.fromCookie(this.secret));
|
||||||
this.banner = await this.x_client.XUS_INTRO_MSG();
|
this.banner = await this.x_client.XUS_INTRO_MSG();
|
||||||
if((await this.x_client.userinfo()).result) try {
|
if((await this.x_client.userinfo()).result) try {
|
||||||
var user = await this.x_client.XUS_GET_USER_INFO();
|
var user = await this.x_client.XUS_GET_USER_INFO();
|
||||||
@ -124,8 +120,6 @@
|
|||||||
this.$emit('update:server', this.x_server = (await this.x_client.serverinfo()).result);
|
this.$emit('update:server', this.x_server = (await this.x_client.serverinfo()).result);
|
||||||
console.log('Backend secret', this.secret);
|
console.log('Backend secret', this.secret);
|
||||||
console.log(this.banner);
|
console.log(this.banner);
|
||||||
var stop = watchEffect(() => { if(!this.x_client.connected.value) { stop(); this.x_client = this.x_server = this.x_user = null; this.fail = true; } });
|
|
||||||
} else this.fail = true;
|
|
||||||
},
|
},
|
||||||
async login(evt) {
|
async login(evt) {
|
||||||
if(this.x_client) {
|
if(this.x_client) {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
table.table-sticky tbody tr {
|
table.table-sticky tbody tr {
|
||||||
border-top: 1px dashed #dee2e6;
|
border-top: 1px dashed #dee2e6;
|
||||||
}
|
}
|
||||||
td:nth-of-type(odd) {
|
table.table-sticky td:nth-of-type(odd) {
|
||||||
background-color: rgba(0, 0, 0, 0.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
table.table-sticky tbody th, table.table-sticky th.name {
|
table.table-sticky tbody th, table.table-sticky th.name {
|
||||||
|
4
main.py
4
main.py
@ -53,7 +53,6 @@ def application():
|
|||||||
@app.post('/v1/vista')
|
@app.post('/v1/vista')
|
||||||
def cb_connect():
|
def cb_connect():
|
||||||
params = request.json['params']
|
params = request.json['params']
|
||||||
try:
|
|
||||||
if params.get('secret') == secret:
|
if params.get('secret') == secret:
|
||||||
cid = ''.join(secrets.choice(string.ascii_lowercase + string.digits) for i in range(64))
|
cid = ''.join(secrets.choice(string.ascii_lowercase + string.digits) for i in range(64))
|
||||||
while cid in clients:
|
while cid in clients:
|
||||||
@ -62,9 +61,6 @@ def application():
|
|||||||
return jsonify({ 'result': cid, 'error': None, 'id': request.json.get('id') })
|
return jsonify({ 'result': cid, 'error': None, 'id': request.json.get('id') })
|
||||||
else:
|
else:
|
||||||
return jsonify({ 'result': None, 'error': { 'type': 'Unauthorized', 'args': [] }, 'id': request.json.get('id') })
|
return jsonify({ 'result': None, 'error': { 'type': 'Unauthorized', 'args': [] }, 'id': request.json.get('id') })
|
||||||
except Exception as ex:
|
|
||||||
logger.exception(request.url)
|
|
||||||
return jsonify({ 'result': None, 'error': { 'type': ex.__class__.__name__, 'args': ex.args }, 'id': request.json.get('id') })
|
|
||||||
|
|
||||||
@app.post('/v1/vista/<cid>/close')
|
@app.post('/v1/vista/<cid>/close')
|
||||||
def cb_close(cid):
|
def cb_close(cid):
|
||||||
|
Loading…
Reference in New Issue
Block a user