Merge branch 'develop' into swn

This commit is contained in:
tamaina 2021-08-25 08:32:38 +09:00
commit bd99740727
25 changed files with 142 additions and 24 deletions

View File

@ -9,6 +9,28 @@
--> -->
## 12.x.x (unreleased)
### Improvements
### Bugfixes
- CWを維持する設定を復活
## 12.89.2 (2021/08/24)
### Bugfixes
- カスタムCSSを有効にしているとエラーになる問題を修正
## 12.89.1 (2021/08/24)
### Improvements
- クライアントのデザインの調整
### Bugfixes
- 翻訳でDeepLのProアカウントに対応していない問題を修正
- インスタンス設定でDeepLのAuth Keyが空で表示される問題を修正
- セキュリティの向上
## 12.89.0 (2021/08/21) ## 12.89.0 (2021/08/21)
### Improvements ### Improvements

View File

@ -778,6 +778,7 @@ whatIsNew: "Änderungen anzeigen"
translate: "Übersetzen" translate: "Übersetzen"
translatedFrom: "Aus {x} übersetzt" translatedFrom: "Aus {x} übersetzt"
accountDeletionInProgress: "Löschung des Benutzerkontos momentan in Bearbeitung" accountDeletionInProgress: "Löschung des Benutzerkontos momentan in Bearbeitung"
usernameInfo: "Ein Name, durch den dein Benutzerkonto auf diesem Server identifiziert werden kann. Du kannst das Alphabet (a~z, A~Z), Ziffern (0~9) oder Unterstriche (_) verwenden. Benutzernamen können später nicht geändert werden."
_accountDelete: _accountDelete:
accountDelete: "Benutzerkonto löschen" accountDelete: "Benutzerkonto löschen"
mayTakeTime: "Da die Löschung eines Benutzerkontos ein aufwendiger Prozess ist, kann dessen Dauer davon abhängen, wie viel Inhalt in diesem erstellt wurde oder wie viele Dateien hochgeladen wurden." mayTakeTime: "Da die Löschung eines Benutzerkontos ein aufwendiger Prozess ist, kann dessen Dauer davon abhängen, wie viel Inhalt in diesem erstellt wurde oder wie viele Dateien hochgeladen wurden."

View File

@ -778,6 +778,8 @@ whatIsNew: "Show changes"
translate: "Translate" translate: "Translate"
translatedFrom: "Translated from {x}" translatedFrom: "Translated from {x}"
accountDeletionInProgress: "Account deletion is currently in progress" accountDeletionInProgress: "Account deletion is currently in progress"
usernameInfo: "A name that identifies your account from others on this server. You can use the alphabet (a~z, A~Z), digits (0~9) or underscores (_). Usernames can not be changed later."
keepCw: "Keep Content Warning"
_accountDelete: _accountDelete:
accountDelete: "Delete Account" accountDelete: "Delete Account"
mayTakeTime: "As account deletion is a resource-heavy process, it may take some time to complete depending on how much content you have created and how many files you have uploaded." mayTakeTime: "As account deletion is a resource-heavy process, it may take some time to complete depending on how much content you have created and how many files you have uploaded."

View File

@ -73,6 +73,7 @@ following: "Sekvatoj"
followers: "Sekvantoj" followers: "Sekvantoj"
followsYou: "Sekvas vin" followsYou: "Sekvas vin"
createList: "Kreii liston" createList: "Kreii liston"
manageLists: "Administri liston"
error: "Eraro" error: "Eraro"
somethingHappened: "Problemo okazis." somethingHappened: "Problemo okazis."
retry: "Reprovi" retry: "Reprovi"
@ -188,7 +189,7 @@ fromUrl: "De URL"
uploadFromUrl: "Alŝuti de URL" uploadFromUrl: "Alŝuti de URL"
uploadFromUrlDescription: "URL de la dosiero kiun vi volas alŝuti" uploadFromUrlDescription: "URL de la dosiero kiun vi volas alŝuti"
explore: "Esplori" explore: "Esplori"
games: "Ludoj sur Misskey" games: "Miskiaj Ludoj"
messageRead: "Legita" messageRead: "Legita"
startMessaging: "Komenci babiladon" startMessaging: "Komenci babiladon"
nUsersRead: "Legita de {n} homoj" nUsersRead: "Legita de {n} homoj"
@ -245,6 +246,7 @@ yearX: "La jaro {year}"
pages: "Paĝoj" pages: "Paĝoj"
connectService: "Konekti" connectService: "Konekti"
disconnectService: "Farkonektiĝi" disconnectService: "Farkonektiĝi"
enableLocalTimeline: "Ebligi lokan templinion"
enableGlobalTimeline: "Ebligi mallokan templinion" enableGlobalTimeline: "Ebligi mallokan templinion"
registration: "Registri" registration: "Registri"
driveCapacityPerLocalAccount: "Volumo de disko po unu loka uzanto" driveCapacityPerLocalAccount: "Volumo de disko po unu loka uzanto"
@ -257,6 +259,7 @@ pinnedUsers: "Alpinglita uzanto"
pinnedPages: "Alpinglitaj paĝoj" pinnedPages: "Alpinglitaj paĝoj"
pinnedNotes: "Pinglita noto" pinnedNotes: "Pinglita noto"
antennas: "Antenoj" antennas: "Antenoj"
manageAntennas: "Administri antenojn"
name: "Nomo" name: "Nomo"
withFileAntenna: "Nur kun aldonaĵo" withFileAntenna: "Nur kun aldonaĵo"
withReplies: "Inkluzive respondoj" withReplies: "Inkluzive respondoj"
@ -342,6 +345,7 @@ poll: "Balotujo"
useCw: "Kaŝi enhavo" useCw: "Kaŝi enhavo"
themeEditor: "Redaktilo de koloraroj" themeEditor: "Redaktilo de koloraroj"
author: "Aŭtoro" author: "Aŭtoro"
manage: "Administro"
plugins: "Kromaĵoj" plugins: "Kromaĵoj"
deck: "Kartaro" deck: "Kartaro"
medium: "Meza" medium: "Meza"
@ -424,6 +428,7 @@ offline: "Forkonektita"
instanceBlocking: "Blokado de ekzemplo" instanceBlocking: "Blokado de ekzemplo"
selectAccount: "Elekti konton" selectAccount: "Elekti konton"
user: "Uzanto" user: "Uzanto"
administration: "Administro"
accounts: "Kontoj" accounts: "Kontoj"
high: "Alta" high: "Alta"
middle: "Meza" middle: "Meza"
@ -440,6 +445,7 @@ translatedFrom: "Tradukita el {x}"
_docs: _docs:
continueReading: "Legi plu" continueReading: "Legi plu"
features: "Funkcioj" features: "Funkcioj"
admin: "Administro"
_gallery: _gallery:
liked: "Ŝatitaj notoj" liked: "Ŝatitaj notoj"
like: "Ŝati" like: "Ŝati"
@ -448,6 +454,9 @@ _email:
title: "Vi estas eksekvita" title: "Vi estas eksekvita"
_receiveFollowRequest: _receiveFollowRequest:
title: "Vi ricevis peton de sekvado" title: "Vi ricevis peton de sekvado"
_plugin:
install: "Instali kromaĵon"
manage: "Administri kromaĵojn"
_registry: _registry:
key: "Ŝlosilo" key: "Ŝlosilo"
keys: "Ŝlosiloj" keys: "Ŝlosiloj"
@ -461,6 +470,7 @@ _aboutMisskey:
translation: "Traduki Misskey'on" translation: "Traduki Misskey'on"
patrons: "Mecenatoj" patrons: "Mecenatoj"
_mfm: _mfm:
dummy: "Misskey vastigas la mondon de Fediverso"
mention: "Mencioj" mention: "Mencioj"
hashtag: "Kradvorto" hashtag: "Kradvorto"
url: "URL" url: "URL"
@ -488,6 +498,7 @@ _instanceTicker:
_channel: _channel:
create: "Krei kanalon" create: "Krei kanalon"
edit: "Redakti kanalon" edit: "Redakti kanalon"
owned: "Posedaĵo"
following: "Sekvante" following: "Sekvante"
usersCount: "{n} partoprenanto(j)" usersCount: "{n} partoprenanto(j)"
_menuDisplay: _menuDisplay:
@ -496,6 +507,7 @@ _wordMute:
muteWords: "Kaŝigitaj vortoj" muteWords: "Kaŝigitaj vortoj"
mutedNotes: "Silentigataj notoj" mutedNotes: "Silentigataj notoj"
_theme: _theme:
manage: "Administri kolorarojn"
code: "Kodo de koloraro" code: "Kodo de koloraro"
darken: "Malbrileco" darken: "Malbrileco"
lighten: "Brileco" lighten: "Brileco"
@ -612,10 +624,10 @@ _charts:
federationInstancesTotal: "Tuta numero de kunfederantaj ekzemploj" federationInstancesTotal: "Tuta numero de kunfederantaj ekzemploj"
filesTotal: "Tuta numero de dosieroj" filesTotal: "Tuta numero de dosieroj"
_timelines: _timelines:
home: "Hejmo" home: "HEJMO"
local: "Loka" local: "LOKA"
social: "Sociala" social: "SOCIALA"
global: "Malloka" global: "MALLOKA"
_rooms: _rooms:
translate: "Movi" translate: "Movi"
chooseImage: "Elekti bildon" chooseImage: "Elekti bildon"

View File

@ -778,6 +778,8 @@ whatIsNew: "更新情報を見る"
translate: "翻訳" translate: "翻訳"
translatedFrom: "{x}から翻訳" translatedFrom: "{x}から翻訳"
accountDeletionInProgress: "アカウントの削除が進行中です" accountDeletionInProgress: "アカウントの削除が進行中です"
usernameInfo: "サーバー上であなたのアカウントを一意に識別するための名前。アルファベット(a~z, A~Z)、数字(0~9)、およびアンダーバー(_)が使用できます。ユーザー名は後から変更することは出来ません。"
keepCw: "CWを維持する"
_accountDelete: _accountDelete:
accountDelete: "アカウントの削除" accountDelete: "アカウントの削除"

View File

@ -777,6 +777,15 @@ misskeyUpdated: "Misskey가 업데이트 되었습니다!"
whatIsNew: "패치 정보 보기" whatIsNew: "패치 정보 보기"
translate: "번역" translate: "번역"
translatedFrom: "{x}에서 번역" translatedFrom: "{x}에서 번역"
accountDeletionInProgress: "계정 삭제 작업을 진행하고 있습니다"
usernameInfo: "서버상에서 계정을 식별하기 위한 이름. 알파벳(a~z, A~Z), 숫자(0~9) 및 언더바(_)를 사용할 수 있습니다. 사용자명은 나중에 변경할 수 없습니다."
_accountDelete:
accountDelete: "계정 삭제"
mayTakeTime: "계정 삭제는 서버에 부하를 가하기 때문에, 작성한 콘텐츠나 업로드한 파일의 수가 많으면 완료까지 시간이 걸릴 수 있습니다."
sendEmail: "계정 삭제가 완료되면 등록된 이메일 주소로 알림을 보냅니다."
requestAccountDelete: "계정 삭제 요청"
started: "삭제 작업이 시작되었습니다."
inProgress: "삭제 진행 중"
_docs: _docs:
continueReading: "계속 읽기" continueReading: "계속 읽기"
features: "기능" features: "기능"

View File

@ -777,6 +777,11 @@ misskeyUpdated: "Misskey更新完成"
whatIsNew: "显示更新信息" whatIsNew: "显示更新信息"
translate: "翻译" translate: "翻译"
translatedFrom: "从 {x} 翻译" translatedFrom: "从 {x} 翻译"
accountDeletionInProgress: "正在删除账户"
usernameInfo: "在服务器上唯一标识您的帐户的名称。您可以使用字母 (a ~ z, A ~ Z)、数字 (0 ~ 9) 和下划线 (_)。用户名以后不能更改。"
_accountDelete:
accountDelete: "删除帐户"
inProgress: "正在删除"
_docs: _docs:
continueReading: "继续阅读" continueReading: "继续阅读"
features: "特性" features: "特性"

View File

@ -0,0 +1,14 @@
import {MigrationInterface, QueryRunner} from "typeorm";
export class deeplIntegration21629778475000 implements MigrationInterface {
name = 'deeplIntegration21629778475000'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "meta" ADD "deeplIsPro" boolean NOT NULL DEFAULT false`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplIsPro"`);
}
}

View File

@ -1,7 +1,7 @@
{ {
"name": "misskey", "name": "misskey",
"author": "syuilo <syuilotan@yahoo.co.jp>", "author": "syuilo <syuilotan@yahoo.co.jp>",
"version": "12.89.0", "version": "12.89.2",
"codename": "indigo", "codename": "indigo",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,12 +1,12 @@
<template> <template>
<form class="mk-signup" @submit.prevent="onSubmit" :autocomplete="Math.random()"> <form class="qlvuhzng" @submit.prevent="onSubmit" :autocomplete="Math.random()">
<template v-if="meta"> <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 #label>{{ $ts.invitationCode }}</template>
<template #prefix><i class="fas fa-key"></i></template> <template #prefix><i class="fas fa-key"></i></template>
</MkInput> </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> <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 }}</template> <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 #prefix>@</template>
<template #suffix>@{{ host }}</template> <template #suffix>@{{ host }}</template>
<template #caption> <template #caption>
@ -204,7 +204,7 @@ export default defineComponent({
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.mk-signup { .qlvuhzng {
.captcha { .captcha {
margin: 16px 0; margin: 16px 0;
} }

View File

@ -1,6 +1,6 @@
import { Directive, ref } from 'vue'; import { Directive, ref } from 'vue';
import { isDeviceTouch } from '@client/scripts/is-device-touch'; 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 start = isDeviceTouch ? 'touchstart' : 'mouseover';
const end = isDeviceTouch ? 'touchend' : 'mouseleave'; 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 => { const show = e => {
if (!document.body.contains(el)) return; if (!document.body.contains(el)) return;
if (self._close) return; if (self._close) return;

View File

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

View File

@ -214,7 +214,11 @@ export function modalPageWindow(path: string) {
}, {}, 'closed'); }, {}, '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) => { return new Promise((resolve, reject) => {
popup(import('@client/components/dialog.vue'), props, { popup(import('@client/components/dialog.vue'), props, {
done: result => { 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 FormGroup from '@client/components/form/group.vue';
import FormKeyValueView from '@client/components/form/key-value-view.vue'; import FormKeyValueView from '@client/components/form/key-value-view.vue';
import MkLink from '@client/components/link.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'; import * as symbols from '@client/symbols';
const patrons = [ const patrons = [

View File

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

View File

@ -28,6 +28,7 @@
</FormSelect> </FormSelect>
<FormSwitch v-model:value="defaultNoteLocalOnly">{{ $ts._visibility.localOnly }}</FormSwitch> <FormSwitch v-model:value="defaultNoteLocalOnly">{{ $ts._visibility.localOnly }}</FormSwitch>
</FormGroup> </FormGroup>
<FormSwitch v-model:value="keepCw" @update:value="save()">{{ $ts.keepCw }}</FormSwitch>
</FormBase> </FormBase>
</template> </template>
@ -69,6 +70,7 @@ export default defineComponent({
defaultNoteVisibility: defaultStore.makeGetterSetter('defaultNoteVisibility'), defaultNoteVisibility: defaultStore.makeGetterSetter('defaultNoteVisibility'),
defaultNoteLocalOnly: defaultStore.makeGetterSetter('defaultNoteLocalOnly'), defaultNoteLocalOnly: defaultStore.makeGetterSetter('defaultNoteLocalOnly'),
rememberNoteVisibility: defaultStore.makeGetterSetter('rememberNoteVisibility'), rememberNoteVisibility: defaultStore.makeGetterSetter('rememberNoteVisibility'),
keepCw: defaultStore.makeGetterSetter('keepCw'),
}, },
created() { created() {

View File

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

View File

@ -5,7 +5,7 @@ Misskey Webクライアントのプラグイン機能を使うと、クライア
プラグインは、AiScriptのメタデータ埋め込み機能を使って、デフォルトとしてプラグインのメタデータを定義する必要があります。 メタデータは次のプロパティを含むオブジェクトです。 プラグインは、AiScriptのメタデータ埋め込み機能を使って、デフォルトとしてプラグインのメタデータを定義する必要があります。 メタデータは次のプロパティを含むオブジェクトです。
### name ### name
プラグイン名 Nomo de kromaĵo
### author ### author
プラグイン作者 プラグイン作者

View File

@ -319,6 +319,11 @@ export class Meta {
}) })
public deeplAuthKey: string | null; public deeplAuthKey: string | null;
@Column('boolean', {
default: false,
})
public deeplIsPro: boolean;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true

View File

@ -149,6 +149,10 @@ export const meta = {
validator: $.optional.nullable.str, validator: $.optional.nullable.str,
}, },
deeplIsPro: {
validator: $.optional.bool,
},
enableTwitterIntegration: { enableTwitterIntegration: {
validator: $.optional.bool, validator: $.optional.bool,
}, },
@ -574,6 +578,10 @@ export default define(meta, async (ps, me) => {
} }
} }
if (ps.deeplIsPro !== undefined) {
set.deeplIsPro = ps.deeplIsPro;
}
await getConnection().transaction(async transactionalEntityManager => { await getConnection().transaction(async transactionalEntityManager => {
const meta = await transactionalEntityManager.findOne(Meta, { const meta = await transactionalEntityManager.findOne(Meta, {
order: { order: {

View File

@ -583,6 +583,8 @@ export default define(meta, async (ps, me) => {
response.objectStorageUseProxy = instance.objectStorageUseProxy; response.objectStorageUseProxy = instance.objectStorageUseProxy;
response.objectStorageSetPublicRead = instance.objectStorageSetPublicRead; response.objectStorageSetPublicRead = instance.objectStorageSetPublicRead;
response.objectStorageS3ForcePathStyle = instance.objectStorageS3ForcePathStyle; response.objectStorageS3ForcePathStyle = instance.objectStorageS3ForcePathStyle;
response.deeplAuthKey = instance.deeplAuthKey;
response.deeplIsPro = instance.deeplIsPro;
} }
} }

View File

@ -61,7 +61,9 @@ export default define(meta, async (ps, user) => {
params.append('text', note.text); params.append('text', note.text);
params.append('target_lang', targetLang); params.append('target_lang', targetLang);
const res = await fetch('https://api-free.deepl.com/v2/translate', { const endpoint = instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate';
const res = await fetch(endpoint, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',

View File

@ -17,6 +17,10 @@ const _dirname = dirname(_filename);
// Init app // Init app
const app = new Koa(); const app = new Koa();
app.use(cors()); app.use(cors());
app.use(async (ctx, next) => {
ctx.set('Content-Security-Policy', `default-src 'none'; style-src 'unsafe-inline'`);
await next();
});
// Init router // Init router
const router = new Router(); const router = new Router();

View File

@ -10,6 +10,10 @@ import { proxyMedia } from './proxy-media';
// Init app // Init app
const app = new Koa(); const app = new Koa();
app.use(cors()); app.use(cors());
app.use(async (ctx, next) => {
ctx.set('Content-Security-Policy', `default-src 'none'; style-src 'unsafe-inline'`);
await next();
});
// Init router // Init router
const router = new Router(); const router = new Router();

View File

@ -60,8 +60,6 @@
? `?salt=${localStorage.getItem('salt')}` ? `?salt=${localStorage.getItem('salt')}`
: ''; : '';
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script'); const script = document.createElement('script');
script.setAttribute('src', `/assets/app.${v}.js${salt}`); script.setAttribute('src', `/assets/app.${v}.js${salt}`);
script.setAttribute('async', 'true'); script.setAttribute('async', 'true');
@ -70,7 +68,7 @@
renderError('APP_FETCH_FAILED'); renderError('APP_FETCH_FAILED');
checkUpdate(); checkUpdate();
}); });
head.appendChild(script); document.head.appendChild(script);
//#endregion //#endregion
//#region Theme //#region Theme
@ -111,7 +109,7 @@
if (customCss && customCss.length > 0) { if (customCss && customCss.length > 0) {
const style = document.createElement('style'); const style = document.createElement('style');
style.innerHTML = customCss; style.innerHTML = customCss;
head.appendChild(style); document.head.appendChild(style);
} }
// eslint-disable-next-line no-inner-declarations // eslint-disable-next-line no-inner-declarations