Merge branch 'swn' of https://github.com/tamaina/misskey into swn
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { get, set } from '@client/scripts/idb-proxy';
|
||||
import { del, get, set } from '@client/scripts/idb-proxy';
|
||||
import { reactive } from 'vue';
|
||||
import { apiUrl } from '@client/config';
|
||||
import { waiting } from '@client/os';
|
||||
@@ -26,21 +26,33 @@ export async function signout() {
|
||||
//#region Remove account
|
||||
const accounts = await getAccounts();
|
||||
accounts.splice(accounts.findIndex(x => x.id === $i.id), 1);
|
||||
set('accounts', accounts);
|
||||
|
||||
if (accounts.length > 0) await set('accounts', accounts);
|
||||
else await del('accounts');
|
||||
//#endregion
|
||||
|
||||
//#region Remove push notification registration
|
||||
//#region Remove service worker registration
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
const push = await registration.pushManager.getSubscription();
|
||||
if (!push) return;
|
||||
await fetch(`${apiUrl}/sw/unregister`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
i: $i.token,
|
||||
endpoint: push.endpoint,
|
||||
}),
|
||||
});
|
||||
if (navigator.serviceWorker.controller) {
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
const push = await registration.pushManager.getSubscription();
|
||||
if (push) {
|
||||
await fetch(`${apiUrl}/sw/unregister`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
i: $i.token,
|
||||
endpoint: push.endpoint,
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (accounts.length === 0) {
|
||||
await navigator.serviceWorker.getRegistrations()
|
||||
.then(registrations => {
|
||||
return Promise.all(registrations.map(registration => registration.unregister()));
|
||||
});
|
||||
}
|
||||
} catch (e) {}
|
||||
//#endregion
|
||||
|
||||
|
@@ -111,7 +111,9 @@ export default defineComponent({
|
||||
|
||||
onLogin(res) {
|
||||
if (this.autoSet) {
|
||||
login(res.i);
|
||||
return login(res.i);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -144,7 +146,7 @@ export default defineComponent({
|
||||
});
|
||||
}).then(res => {
|
||||
this.$emit('login', res);
|
||||
this.onLogin(res);
|
||||
return this.onLogin(res);
|
||||
}).catch(err => {
|
||||
if (err === null) return;
|
||||
os.dialog({
|
||||
|
@@ -178,14 +178,14 @@ export default defineComponent({
|
||||
'hcaptcha-response': this.hCaptchaResponse,
|
||||
'g-recaptcha-response': this.reCaptchaResponse,
|
||||
}).then(() => {
|
||||
os.api('signin', {
|
||||
return os.api('signin', {
|
||||
username: this.username,
|
||||
password: this.password
|
||||
}).then(res => {
|
||||
this.$emit('signup', res);
|
||||
|
||||
if (this.autoSet) {
|
||||
login(res.i);
|
||||
return login(res.i);
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
|
@@ -28,6 +28,7 @@
|
||||
</FormSelect>
|
||||
<FormSwitch v-model:value="defaultNoteLocalOnly">{{ $ts._visibility.localOnly }}</FormSwitch>
|
||||
</FormGroup>
|
||||
<FormSwitch v-model:value="keepCw" @update:value="save()">{{ $ts.keepCw }}</FormSwitch>
|
||||
</FormBase>
|
||||
</template>
|
||||
|
||||
@@ -69,6 +70,7 @@ export default defineComponent({
|
||||
defaultNoteVisibility: defaultStore.makeGetterSetter('defaultNoteVisibility'),
|
||||
defaultNoteLocalOnly: defaultStore.makeGetterSetter('defaultNoteLocalOnly'),
|
||||
rememberNoteVisibility: defaultStore.makeGetterSetter('rememberNoteVisibility'),
|
||||
keepCw: defaultStore.makeGetterSetter('keepCw'),
|
||||
},
|
||||
|
||||
created() {
|
||||
|
@@ -53,7 +53,7 @@ export default defineComponent({
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
}).then(res => {
|
||||
login(res.i);
|
||||
return login(res.token);
|
||||
}).catch(() => {
|
||||
this.submitting = false;
|
||||
|
||||
|
@@ -159,7 +159,6 @@ hr {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
margin: 0; // for Safari
|
||||
width: max-content;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
@@ -109,7 +109,7 @@
|
||||
if (customCss && customCss.length > 0) {
|
||||
const style = document.createElement('style');
|
||||
style.innerHTML = customCss;
|
||||
head.appendChild(style);
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-inner-declarations
|
||||
|
Reference in New Issue
Block a user