regedit
This commit is contained in:
		
							parent
							
								
									d4da5a1eea
								
							
						
					
					
						commit
						745f4d2439
					
				
					 5 changed files with 121 additions and 8 deletions
				
			
		|  | @ -593,6 +593,10 @@ fillAbuseReportDescription: "通報理由の詳細を記入してください。 | ||||||
| abuseReported: "内容が送信されました。ご報告ありがとうございました。" | abuseReported: "内容が送信されました。ご報告ありがとうございました。" | ||||||
| send: "送信" | send: "送信" | ||||||
| abuseMarkAsResolved: "対応済みにする" | abuseMarkAsResolved: "対応済みにする" | ||||||
|  | openInNewTab: "新しいタブで開く" | ||||||
|  | openInSideView: "サイドビューで開く" | ||||||
|  | defaultNavigationBehaviour: "デフォルトのナビゲーション" | ||||||
|  | editTheseSettingsMayBreakAccount: "これらの設定を編集するとアカウントが破損する可能性があります。" | ||||||
| 
 | 
 | ||||||
| _serverDisconnectedBehavior: | _serverDisconnectedBehavior: | ||||||
|   reload: "自動でリロード" |   reload: "自動でリロード" | ||||||
|  |  | ||||||
|  | @ -2,12 +2,13 @@ | ||||||
| <div class="adhpbeos" :class="{ focused, filled, tall, pre }"> | <div class="adhpbeos" :class="{ focused, filled, tall, pre }"> | ||||||
| 	<div class="input"> | 	<div class="input"> | ||||||
| 		<span class="label" ref="label"><slot></slot></span> | 		<span class="label" ref="label"><slot></slot></span> | ||||||
| 		<textarea ref="input" | 		<textarea ref="input" :class="{ code }" | ||||||
| 			:value="value" | 			:value="value" | ||||||
| 			:required="required" | 			:required="required" | ||||||
| 			:readonly="readonly" | 			:readonly="readonly" | ||||||
| 			:pattern="pattern" | 			:pattern="pattern" | ||||||
| 			:autocomplete="autocomplete" | 			:autocomplete="autocomplete" | ||||||
|  | 			:spellcheck="!code" | ||||||
| 			@input="onInput" | 			@input="onInput" | ||||||
| 			@focus="focused = true" | 			@focus="focused = true" | ||||||
| 			@blur="focused = false" | 			@blur="focused = false" | ||||||
|  | @ -20,7 +21,6 @@ | ||||||
| 
 | 
 | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| import { defineComponent } from 'vue'; | import { defineComponent } from 'vue'; | ||||||
| import * as os from '@/os'; |  | ||||||
| 
 | 
 | ||||||
| export default defineComponent({ | export default defineComponent({ | ||||||
| 	props: { | 	props: { | ||||||
|  | @ -43,6 +43,10 @@ export default defineComponent({ | ||||||
| 			type: String, | 			type: String, | ||||||
| 			required: false | 			required: false | ||||||
| 		}, | 		}, | ||||||
|  | 		code: { | ||||||
|  | 			type: Boolean, | ||||||
|  | 			required: false | ||||||
|  | 		}, | ||||||
| 		tall: { | 		tall: { | ||||||
| 			type: Boolean, | 			type: Boolean, | ||||||
| 			required: false, | 			required: false, | ||||||
|  | @ -159,6 +163,11 @@ export default defineComponent({ | ||||||
| 			outline: none; | 			outline: none; | ||||||
| 			box-shadow: none; | 			box-shadow: none; | ||||||
| 			color: var(--fg); | 			color: var(--fg); | ||||||
|  | 
 | ||||||
|  | 			&.code { | ||||||
|  | 				tab-size: 2; | ||||||
|  | 				font-family: Fira code, Fira Mono, Consolas, Menlo, Courier, monospace; | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,12 +1,17 @@ | ||||||
| <template> | <template> | ||||||
| <div class="_section"> | <div> | ||||||
| 	<div class="_card"> | 	<div class="_section"> | ||||||
| 		<div class="_content"> | 		<div class="_card"> | ||||||
| 			<MkSwitch v-model:value="$store.state.i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote"> | 			<div class="_content"> | ||||||
| 				{{ $t('showFeaturedNotesInTimeline') }} | 				<MkSwitch v-model:value="$store.state.i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote"> | ||||||
| 			</MkSwitch> | 					{{ $t('showFeaturedNotesInTimeline') }} | ||||||
|  | 				</MkSwitch> | ||||||
|  | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
|  | 	<div class="_section"> | ||||||
|  | 		<MkA to="/settings/regedit">RegEdit</MkA> | ||||||
|  | 	</div> | ||||||
| </div> | </div> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										77
									
								
								src/client/pages/settings/regedit.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								src/client/pages/settings/regedit.vue
									
										
									
									
									
										Normal 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> | ||||||
|  | @ -202,6 +202,15 @@ export const store = createStore({ | ||||||
| 			state: defaultDeviceSettings, | 			state: defaultDeviceSettings, | ||||||
| 
 | 
 | ||||||
| 			mutations: { | 			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 }) { | 				set(state, x: { key: string; value: any }) { | ||||||
| 					state[x.key] = x.value; | 					state[x.key] = x.value; | ||||||
| 				}, | 				}, | ||||||
|  | @ -218,6 +227,15 @@ export const store = createStore({ | ||||||
| 			state: defaultDeviceUserSettings, | 			state: defaultDeviceUserSettings, | ||||||
| 
 | 
 | ||||||
| 			mutations: { | 			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) { | 				init(state, x) { | ||||||
| 					for (const [key, value] of Object.entries(defaultDeviceUserSettings)) { | 					for (const [key, value] of Object.entries(defaultDeviceUserSettings)) { | ||||||
| 						if (x[key]) { | 						if (x[key]) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue