mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-21 22:35:11 +00:00
parent
53d24c2ba1
commit
9ed6a9701a
2 changed files with 74 additions and 70 deletions
|
@ -16,6 +16,7 @@ You should also include the user name that made the change.
|
|||
|
||||
### Bugfixes
|
||||
- Client: 一度作ったwebhookの設定画面を開こうとするとページがフリーズする @syuilo
|
||||
- Client: MiAuth認証ページが機能していない @syuilo
|
||||
|
||||
## 12.117.1 (2022/07/19)
|
||||
|
||||
|
|
|
@ -1,85 +1,88 @@
|
|||
<template>
|
||||
<div v-if="$i">
|
||||
<div v-if="state == 'waiting'" class="waiting _section">
|
||||
<div class="_content">
|
||||
<MkLoading/>
|
||||
<MkSpacer :content-max="800">
|
||||
<div v-if="$i">
|
||||
<div v-if="state == 'waiting'" class="waiting _section">
|
||||
<div class="_content">
|
||||
<MkLoading/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="state == 'denied'" class="denied _section">
|
||||
<div class="_content">
|
||||
<p>{{ i18n.ts._auth.denied }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="state == 'accepted'" class="accepted _section">
|
||||
<div class="_content">
|
||||
<p v-if="callback">{{ i18n.ts._auth.callback }}<MkEllipsis/></p>
|
||||
<p v-else>{{ i18n.ts._auth.pleaseGoBack }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="_section">
|
||||
<div v-if="name" class="_title">{{ $t('_auth.shareAccess', { name: name }) }}</div>
|
||||
<div v-else class="_title">{{ i18n.ts._auth.shareAccessAsk }}</div>
|
||||
<div class="_content">
|
||||
<p>{{ i18n.ts._auth.permissionAsk }}</p>
|
||||
<ul>
|
||||
<li v-for="p in _permissions" :key="p">{{ $t(`_permissions.${p}`) }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="_footer">
|
||||
<MkButton inline @click="deny">{{ i18n.ts.cancel }}</MkButton>
|
||||
<MkButton inline primary @click="accept">{{ i18n.ts.accept }}</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="state == 'denied'" class="denied _section">
|
||||
<div class="_content">
|
||||
<p>{{ $ts._auth.denied }}</p>
|
||||
</div>
|
||||
<div v-else class="signin">
|
||||
<MkSignin @login="onLogin"/>
|
||||
</div>
|
||||
<div v-else-if="state == 'accepted'" class="accepted _section">
|
||||
<div class="_content">
|
||||
<p v-if="callback">{{ $ts._auth.callback }}<MkEllipsis/></p>
|
||||
<p v-else>{{ $ts._auth.pleaseGoBack }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="_section">
|
||||
<div v-if="name" class="_title">{{ $t('_auth.shareAccess', { name: name }) }}</div>
|
||||
<div v-else class="_title">{{ $ts._auth.shareAccessAsk }}</div>
|
||||
<div class="_content">
|
||||
<p>{{ $ts._auth.permissionAsk }}</p>
|
||||
<ul>
|
||||
<li v-for="p in permission" :key="p">{{ $t(`_permissions.${p}`) }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="_footer">
|
||||
<MkButton inline @click="deny">{{ $ts.cancel }}</MkButton>
|
||||
<MkButton inline primary @click="accept">{{ $ts.accept }}</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="signin">
|
||||
<MkSignin @login="onLogin"/>
|
||||
</div>
|
||||
</MkSpacer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import MkSignin from '@/components/signin.vue';
|
||||
import MkButton from '@/components/ui/button.vue';
|
||||
import * as os from '@/os';
|
||||
import { login } from '@/account';
|
||||
import { $i, login } from '@/account';
|
||||
import { appendQuery, query } from '@/scripts/url';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkSignin,
|
||||
MkButton,
|
||||
},
|
||||
props: ['session', 'callback', 'name', 'icon', 'permission'],
|
||||
data() {
|
||||
return {
|
||||
state: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async accept() {
|
||||
this.state = 'waiting';
|
||||
await os.api('miauth/gen-token', {
|
||||
session: this.session,
|
||||
name: this.name,
|
||||
iconUrl: this.icon,
|
||||
permission: this.permission,
|
||||
});
|
||||
const props = defineProps<{
|
||||
session: string;
|
||||
callback?: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
permission: string; // コンマ区切り
|
||||
}>();
|
||||
|
||||
this.state = 'accepted';
|
||||
if (this.callback) {
|
||||
location.href = appendQuery(this.callback, query({
|
||||
session: this.session,
|
||||
}));
|
||||
}
|
||||
},
|
||||
deny() {
|
||||
this.state = 'denied';
|
||||
},
|
||||
onLogin(res) {
|
||||
login(res.i);
|
||||
},
|
||||
},
|
||||
});
|
||||
const _permissions = props.permission.split(',');
|
||||
|
||||
let state = $ref<string | null>(null);
|
||||
|
||||
async function accept(): Promise<void> {
|
||||
state = 'waiting';
|
||||
await os.api('miauth/gen-token', {
|
||||
session: props.session,
|
||||
name: props.name,
|
||||
iconUrl: props.icon,
|
||||
permission: _permissions,
|
||||
});
|
||||
|
||||
state = 'accepted';
|
||||
if (props.callback) {
|
||||
location.href = appendQuery(props.callback, query({
|
||||
session: props.session,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
function deny(): void {
|
||||
state = 'denied';
|
||||
}
|
||||
|
||||
function onLogin(res): void {
|
||||
login(res.i);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
Loading…
Reference in a new issue