Skip to content

Commit

Permalink
Merge pull request #10847 from yupix/feat/client-dev-mode
Browse files Browse the repository at this point in the history
feat: 開発者モードを追加
  • Loading branch information
syuilo authored May 14, 2023
2 parents 636428c + 7cc555f commit 3d94dec
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
-->

## 13.x.x (unreleased)

### Client
- 開発者モードを追加


## 13.12.2

## NOTE
Expand Down
3 changes: 3 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ addToList: "リストに追加"
sendMessage: "メッセージを送信"
copyRSS: "RSSをコピー"
copyUsername: "ユーザー名をコピー"
copyUserId: "ユーザーIDをコピー"
copyNoteId: "ノートIDをコピー"
searchUser: "ユーザーを検索"
reply: "返信"
loadMore: "もっと見る"
Expand Down Expand Up @@ -823,6 +825,7 @@ translatedFrom: "{x}から翻訳"
accountDeletionInProgress: "アカウントの削除が進行中です"
usernameInfo: "サーバー上であなたのアカウントを一意に識別するための名前。アルファベット(a~z, A~Z)、数字(0~9)、およびアンダーバー(_)が使用できます。ユーザー名は後から変更することは出来ません。"
aiChanMode: "藍モード"
devMode: "開発者モード"
keepCw: "CWを維持する"
pubSub: "Pub/Subのアカウント"
lastCommunication: "直近の通信"
Expand Down
6 changes: 5 additions & 1 deletion packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@
</FormSection>

<FormSection>
<MkSwitch v-model="aiChanMode">{{ i18n.ts.aiChanMode }}</MkSwitch>
<div class="_gaps_s">
<MkSwitch v-model="aiChanMode">{{ i18n.ts.aiChanMode }}</MkSwitch>
<MkSwitch v-model="devMode">{{ i18n.ts.devMode }}</MkSwitch>
</div>
</FormSection>

<FormLink to="/settings/deck">{{ i18n.ts.deck }}</FormLink>
Expand Down Expand Up @@ -213,6 +216,7 @@ const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfin
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));
const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars'));
const aiChanMode = computed(defaultStore.makeGetterSetter('aiChanMode'));
const devMode = computed(defaultStore.makeGetterSetter('devMode'));
const mediaListWithOneImageAppearance = computed(defaultStore.makeGetterSetter('mediaListWithOneImageAppearance'));
const notificationPosition = computed(defaultStore.makeGetterSetter('notificationPosition'));
const notificationStackAxis = computed(defaultStore.makeGetterSetter('notificationStackAxis'));
Expand Down
12 changes: 11 additions & 1 deletion packages/frontend/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { instance } from '@/instance';
import * as os from '@/os';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import { url } from '@/config';
import { noteActions } from '@/store';
import { defaultStore, noteActions } from '@/store';
import { miLocalStorage } from '@/local-storage';
import { getUserMenu } from '@/scripts/get-user-menu';
import { clipsCache } from '@/cache';
Expand Down Expand Up @@ -396,5 +396,15 @@ export function getNoteMenu(props: {
}))]);
}

if (defaultStore.state.devMode) {
menu = menu.concat([null, {
icon: 'ti ti-id',
text: i18n.ts.copyNoteId,
action: () => {
copyToClipboard(appearNote.id);
},
}]);
}

return menu;
}
12 changes: 11 additions & 1 deletion packages/frontend/src/scripts/get-user-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { i18n } from '@/i18n';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import { host } from '@/config';
import * as os from '@/os';
import { userActions } from '@/store';
import { defaultStore, userActions } from '@/store';
import { $i, iAmModerator } from '@/account';
import { mainRouter } from '@/router';
import { Router } from '@/nirax';
Expand Down Expand Up @@ -240,6 +240,16 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
}]);
}

if (defaultStore.state.devMode) {
menu = menu.concat([null, {
icon: 'ti ti-id',
text: i18n.ts.copyUserId,
action: () => {
copyToClipboard(user.id);
},
}]);
}

if ($i && meId === user.id) {
menu = menu.concat([null, {
icon: 'ti ti-pencil',
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: false,
},
devMode: {
where: 'device',
default: false,
},
mediaListWithOneImageAppearance: {
where: 'device',
default: 'expand' as 'expand' | '16_9' | '1_1' | '2_3',
Expand Down

1 comment on commit 3d94dec

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic detects changes. Please review the changes on Chromatic.

Please sign in to comment.