1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-30 06:41:46 +09:00
This commit is contained in:
syuilo 2020-10-25 01:23:23 +09:00
parent d4da5a1eea
commit 745f4d2439
5 changed files with 121 additions and 8 deletions

View File

@ -593,6 +593,10 @@ fillAbuseReportDescription: "通報理由の詳細を記入してください。
abuseReported: "内容が送信されました。ご報告ありがとうございました。"
send: "送信"
abuseMarkAsResolved: "対応済みにする"
openInNewTab: "新しいタブで開く"
openInSideView: "サイドビューで開く"
defaultNavigationBehaviour: "デフォルトのナビゲーション"
editTheseSettingsMayBreakAccount: "これらの設定を編集するとアカウントが破損する可能性があります。"
_serverDisconnectedBehavior:
reload: "自動でリロード"

View File

@ -2,12 +2,13 @@
<div class="adhpbeos" :class="{ focused, filled, tall, pre }">
<div class="input">
<span class="label" ref="label"><slot></slot></span>
<textarea ref="input"
<textarea ref="input" :class="{ code }"
:value="value"
:required="required"
:readonly="readonly"
:pattern="pattern"
:autocomplete="autocomplete"
:spellcheck="!code"
@input="onInput"
@focus="focused = true"
@blur="focused = false"
@ -20,7 +21,6 @@
<script lang="ts">
import { defineComponent } from 'vue';
import * as os from '@/os';
export default defineComponent({
props: {
@ -43,6 +43,10 @@ export default defineComponent({
type: String,
required: false
},
code: {
type: Boolean,
required: false
},
tall: {
type: Boolean,
required: false,
@ -159,6 +163,11 @@ export default defineComponent({
outline: none;
box-shadow: none;
color: var(--fg);
&.code {
tab-size: 2;
font-family: Fira code, Fira Mono, Consolas, Menlo, Courier, monospace;
}
}
}

View File

@ -1,12 +1,17 @@
<template>
<div class="_section">
<div class="_card">
<div class="_content">
<MkSwitch v-model:value="$store.state.i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote">
{{ $t('showFeaturedNotesInTimeline') }}
</MkSwitch>
<div>
<div class="_section">
<div class="_card">
<div class="_content">
<MkSwitch v-model:value="$store.state.i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote">
{{ $t('showFeaturedNotesInTimeline') }}
</MkSwitch>
</div>
</div>
</div>
<div class="_section">
<MkA to="/settings/regedit">RegEdit</MkA>
</div>
</div>
</template>

View File

@ -0,0 +1,77 @@
<template>
<div>
<div class="_section">
<MkInfo warn>{{ $t('editTheseSettingsMayBreakAccount') }}</MkInfo>
</div>
<div class="_section">
<div class="_title">Account</div>
<div class="_content">
<MkTextarea v-model:value="settings" code tall></MkTextarea>
<!--<MkButton @click="saveSettings">Save</MkButton>-->
</div>
</div>
<div class="_section">
<div class="_title">Device</div>
<div class="_content">
<MkTextarea v-model:value="deviceSettings" code tall></MkTextarea>
<MkButton @click="saveDeviceSettings">Save</MkButton>
</div>
</div>
<div class="_section">
<div class="_title">Device (per account)</div>
<div class="_content">
<MkTextarea v-model:value="deviceUserSettings" code tall></MkTextarea>
<MkButton @click="saveDeviceUserSettings">Save</MkButton>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { faCode } from '@fortawesome/free-solid-svg-icons';
import * as JSON5 from 'json5';
import MkInfo from '@/components/ui/info.vue';
import MkButton from '@/components/ui/button.vue';
import MkTextarea from '@/components/ui/textarea.vue';
import * as os from '@/os';
export default defineComponent({
components: {
MkInfo, MkButton, MkTextarea
},
emits: ['info'],
data() {
return {
INFO: {
header: [{
title: 'RegEdit',
icon: faCode
}]
},
settings: JSON5.stringify(this.$store.state.settings, null, '\t'),
deviceSettings: JSON5.stringify(this.$store.state.device, null, '\t'),
deviceUserSettings: JSON5.stringify(this.$store.state.deviceUser, null, '\t'),
};
},
mounted() {
this.$emit('info', this.INFO);
},
methods: {
saveDeviceSettings() {
const obj = JSON5.parse(this.deviceSettings);
this.$store.commit('device/overwrite', obj);
},
saveDeviceUserSettings() {
const obj = JSON5.parse(this.deviceUserSettings);
this.$store.commit('deviceUser/overwrite', obj);
},
}
});
</script>

View File

@ -202,6 +202,15 @@ export const store = createStore({
state: defaultDeviceSettings,
mutations: {
overwrite(state, x) {
for (const k of Object.keys(state)) {
if (x[k] === undefined) delete state[k];
}
for (const k of Object.keys(x)) {
state[k] = x[k];
}
},
set(state, x: { key: string; value: any }) {
state[x.key] = x.value;
},
@ -218,6 +227,15 @@ export const store = createStore({
state: defaultDeviceUserSettings,
mutations: {
overwrite(state, x) {
for (const k of Object.keys(state)) {
if (x[k] === undefined) delete state[k];
}
for (const k of Object.keys(x)) {
state[k] = x[k];
}
},
init(state, x) {
for (const [key, value] of Object.entries(defaultDeviceUserSettings)) {
if (x[key]) {