Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ThinaticSystem
2021-08-24 13:21:52 +09:00
24 changed files with 125 additions and 23 deletions

View File

@ -1,12 +1,12 @@
<template>
<form class="mk-signup" @submit.prevent="onSubmit" :autocomplete="Math.random()">
<form class="qlvuhzng" @submit.prevent="onSubmit" :autocomplete="Math.random()">
<template v-if="meta">
<MkInput v-if="meta.disableRegistration" v-model="invitationCode" type="text" :autocomplete="Math.random()" spellcheck="false" required>
<MkInput class="_inputNoTopMargin" v-if="meta.disableRegistration" v-model="invitationCode" type="text" :autocomplete="Math.random()" spellcheck="false" required>
<template #label>{{ $ts.invitationCode }}</template>
<template #prefix><i class="fas fa-key"></i></template>
</MkInput>
<MkInput v-model="username" type="text" pattern="^[a-zA-Z0-9_]{1,20}$" :autocomplete="Math.random()" spellcheck="false" required @update:modelValue="onChangeUsername" data-cy-signup-username>
<template #label>{{ $ts.username }}</template>
<MkInput class="_inputNoTopMargin" v-model="username" type="text" pattern="^[a-zA-Z0-9_]{1,20}$" :autocomplete="Math.random()" spellcheck="false" required @update:modelValue="onChangeUsername" data-cy-signup-username>
<template #label>{{ $ts.username }} <div class="_button _help" v-tooltip:dialog="$ts.usernameInfo"><i class="far fa-question-circle"></i></div></template>
<template #prefix>@</template>
<template #suffix>@{{ host }}</template>
<template #caption>
@ -205,7 +205,7 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.mk-signup {
.qlvuhzng {
.captcha {
margin: 16px 0;
}

View File

@ -1,6 +1,6 @@
import { Directive, ref } from 'vue';
import { isDeviceTouch } from '@client/scripts/is-device-touch';
import { popup } from '@client/os';
import { popup, dialog } from '@client/os';
const start = isDeviceTouch ? 'touchstart' : 'mouseover';
const end = isDeviceTouch ? 'touchend' : 'mouseleave';
@ -24,6 +24,18 @@ export default {
}
};
if (binding.arg === 'dialog') {
el.addEventListener('click', (ev) => {
ev.preventDefault();
ev.stopPropagation();
dialog({
type: 'info',
text: binding.value,
});
return false;
});
}
const show = e => {
if (!document.body.contains(el)) return;
if (self._close) return;

View File

@ -101,15 +101,12 @@ window.addEventListener('resize', () => {
});
//#endregion
// Get the <head> element
const head = document.getElementsByTagName('head')[0];
// If mobile, insert the viewport meta tag
if (isMobile || window.innerWidth <= 1024) {
const viewport = document.getElementsByName('viewport').item(0);
viewport.setAttribute('content',
`${viewport.getAttribute('content')},minimum-scale=1,maximum-scale=1,user-scalable=no`);
head.appendChild(viewport);
document.head.appendChild(viewport);
}
//#region Set lang attr

View File

@ -214,7 +214,11 @@ export function modalPageWindow(path: string) {
}, {}, 'closed');
}
export function dialog(props: Record<string, any>) {
export function dialog(props: {
type: 'error' | 'info' | 'success' | 'warning' | 'waiting';
title?: string | null;
text?: string | null;
}) {
return new Promise((resolve, reject) => {
popup(import('@client/components/dialog.vue'), props, {
done: result => {

View File

@ -60,7 +60,7 @@ import FormBase from '@client/components/form/base.vue';
import FormGroup from '@client/components/form/group.vue';
import FormKeyValueView from '@client/components/form/key-value-view.vue';
import MkLink from '@client/components/link.vue';
import { physics } from '@client/scripts/physics.ts';
import { physics } from '@client/scripts/physics';
import * as symbols from '@client/symbols';
const patrons = [

View File

@ -12,6 +12,9 @@
<template #prefix><i class="fas fa-key"></i></template>
DeepL Auth Key
</FormInput>
<FormSwitch v-model:value="deeplIsPro">
Pro account
</FormSwitch>
</FormGroup>
<FormButton @click="save" primary><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
</FormSuspense>
@ -50,6 +53,7 @@ export default defineComponent({
},
summalyProxy: '',
deeplAuthKey: '',
deeplIsPro: false,
}
},
@ -62,11 +66,13 @@ export default defineComponent({
const meta = await os.api('meta', { detail: true });
this.summalyProxy = meta.summalyProxy;
this.deeplAuthKey = meta.deeplAuthKey;
this.deeplIsPro = meta.deeplIsPro;
},
save() {
os.apiWithDialog('admin/update-meta', {
summalyProxy: this.summalyProxy,
deeplAuthKey: this.deeplAuthKey,
deeplIsPro: this.deeplIsPro,
}).then(() => {
fetchInstance();
});

View File

@ -156,8 +156,10 @@ hr {
._button {
appearance: none;
display: inline-block;
padding: 0;
margin: 0; // for Safari
width: max-content;
background: none;
border: none;
cursor: pointer;
@ -201,6 +203,11 @@ hr {
}
}
._help {
color: var(--accent);
cursor: help
}
._textButton {
@extend ._button;
color: var(--accent);