This commit is contained in:
かっこかり 2025-10-05 16:53:19 +09:00 committed by GitHub
commit 37ecea4a2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 199 additions and 40 deletions

View File

@ -21,6 +21,7 @@
- Enhance: テーマをドラッグ&ドロップできるように
- Enhance: 絵文字ピッカーのサイズをより大きくできるように
- Enhance: 時刻計算のための基準値を一か所で管理するようにし、パフォーマンスを向上
- Enhance: 「お問い合わせ」ページから、バグの調査等に役立つ情報OSやブラウザのバージョン等を取得・コピーできるように
- Fix: iOSで、デバイスがダークモードだと初回読み込み時にエラーになる問題を修正
- Fix: アクティビティウィジェットのグラフモードが動作しない問題を修正

8
locales/index.d.ts vendored
View File

@ -5577,6 +5577,14 @@ export interface Locale extends ILocale {
*
*/
"scheduled": string;
/**
*
*/
"deviceInfo": string;
/**
*
*/
"deviceInfoDescription": string;
"_compression": {
"_quality": {
/**

View File

@ -1389,6 +1389,8 @@ scheduleToPostOnX: "{x}に投稿を予約します"
scheduledToPostOnX: "{x}に投稿が予約されています"
schedule: "予約"
scheduled: "予約"
deviceInfo: "デバイス情報"
deviceInfoDescription: "技術的なお問い合わせの際に、以下の情報を併記すると問題の解決に役立つことがあります。"
_compression:
_quality:

View File

@ -5,7 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<!-- eslint-disable vue/no-v-html -->
<template>
<div :class="[$style.codeBlockRoot, { [$style.codeEditor]: codeEditor }, (darkMode ? $style.dark : $style.light)]" v-html="html"></div>
<div
:class="[$style.codeBlockRoot, {
[$style.codeEditor]: codeEditor,
[$style.outerStyle]: !codeEditor && withOuterStyle,
[$style.dark]: darkMode,
[$style.light]: !darkMode,
}]" v-html="html"></div>
</template>
<script lang="ts" setup>
@ -15,11 +21,15 @@ import type { BundledLanguage } from 'shiki/langs';
import { getHighlighter, getTheme } from '@/utility/code-highlighter.js';
import { store } from '@/store.js';
const props = defineProps<{
const props = withDefaults(defineProps<{
code: string;
lang?: string;
codeEditor?: boolean;
}>();
withOuterStyle?: boolean;
}>(), {
codeEditor: false,
withOuterStyle: true,
});
const highlighter = await getHighlighter();
const darkMode = store.r.darkMode;
@ -73,17 +83,13 @@ watch(() => props.lang, (to) => {
<style module lang="scss">
.codeBlockRoot :global(.shiki) {
padding: 1em;
margin: 0;
overflow: auto;
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
color: var(--shiki-fallback);
background-color: var(--shiki-fallback-bg);
& span {
color: var(--shiki-fallback);
background-color: var(--shiki-fallback-bg);
}
& pre,
@ -92,26 +98,40 @@ watch(() => props.lang, (to) => {
}
}
.outerStyle.codeBlockRoot :global(.shiki) {
padding: 1em;
margin: 0;
border-radius: 8px;
border: 1px solid var(--MI_THEME-divider);
background-color: var(--shiki-fallback-bg);
}
.light.codeBlockRoot :global(.shiki) {
color: var(--shiki-light);
background-color: var(--shiki-light-bg);
& span {
color: var(--shiki-light);
background-color: var(--shiki-light-bg);
}
}
.light.outerStyle.codeBlockRoot :global(.shiki),
.light.codeEditor.codeBlockRoot :global(.shiki) {
background-color: var(--shiki-light-bg);
}
.dark.codeBlockRoot :global(.shiki) {
color: var(--shiki-dark);
background-color: var(--shiki-dark-bg);
& span {
color: var(--shiki-dark);
background-color: var(--shiki-dark-bg);
}
}
.dark.outerStyle.codeBlockRoot :global(.shiki),
.dark.codeEditor.codeBlockRoot :global(.shiki) {
background-color: var(--shiki-dark-bg);
}
.codeBlockRoot.codeEditor {
min-width: 100%;
height: 100%;

View File

@ -5,15 +5,32 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div :class="$style.codeBlockRoot">
<button v-if="copyButton" :class="$style.codeBlockCopyButton" class="_button" @click="copy">
<button v-if="copyButton" :class="[$style.codeBlockCopyButton, { [$style.withOuterStyle]: withOuterStyle }]" class="_button" @click="copy">
<i class="ti ti-copy"></i>
</button>
<Suspense>
<template #fallback>
<MkLoading/>
<pre
class="_selectable"
:class="[$style.codeBlockFallbackRoot, {
[$style.outerStyle]: withOuterStyle,
}]"
><code :class="$style.codeBlockFallbackCode">Loading...</code></pre>
</template>
<XCode v-if="show && lang" class="_selectable" :code="code" :lang="lang"/>
<pre v-else-if="show" class="_selectable" :class="$style.codeBlockFallbackRoot"><code :class="$style.codeBlockFallbackCode">{{ code }}</code></pre>
<XCode
v-if="show && lang"
class="_selectable"
:code="code"
:lang="lang"
:withOuterStyle="withOuterStyle"
/>
<pre
v-else-if="show"
class="_selectable"
:class="[$style.codeBlockFallbackRoot, {
[$style.outerStyle]: withOuterStyle,
}]"
><code :class="$style.codeBlockFallbackCode">{{ code }}</code></pre>
<button v-else :class="$style.codePlaceholderRoot" @click="show = true">
<div :class="$style.codePlaceholderContainer">
<div><i class="ti ti-code"></i> {{ i18n.ts.code }}</div>
@ -26,8 +43,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent, ref } from 'vue';
import * as os from '@/os.js';
import MkLoading from '@/components/global/MkLoading.vue';
import { i18n } from '@/i18n.js';
import { copyToClipboard } from '@/utility/copy-to-clipboard.js';
import { prefer } from '@/preferences.js';
@ -36,10 +51,12 @@ const props = withDefaults(defineProps<{
code: string;
forceShow?: boolean;
copyButton?: boolean;
withOuterStyle?: boolean;
lang?: string;
}>(), {
copyButton: true,
forceShow: false,
withOuterStyle: true,
});
const show = ref(props.forceShow === true ? true : !prefer.s.dataSaver.code);
@ -58,10 +75,16 @@ function copy() {
.codeBlockCopyButton {
position: absolute;
top: 8px;
right: 8px;
opacity: 0.5;
top: 0;
right: 0;
&.withOuterStyle {
top: 8px;
right: 8px;
}
&:hover {
opacity: 0.8;
}
@ -70,11 +93,17 @@ function copy() {
.codeBlockFallbackRoot {
display: block;
overflow-wrap: anywhere;
padding: 1em;
margin: 0;
overflow: auto;
}
.outerStyle.codeBlockFallbackRoot {
background: var(--MI_THEME-bg);
padding: 1em;
margin: .5em 0;
border-radius: 8px;
border: 1px solid var(--MI_THEME-divider);
}
.codeBlockFallbackCode {
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
}

View File

@ -119,6 +119,10 @@ const props = withDefaults(defineProps<{
canPage: true,
});
const emit = defineEmits<{
(ev: 'headerClicked', ep: MouseEvent): void;
}>();
const rootEl = useTemplateRef('rootEl');
const asPage = props.canPage && deviceKind === 'smartphone' && prefer.s['experimental.enableFolderPageView'];
const bgSame = ref(false);
@ -164,7 +168,9 @@ function afterLeave(el: Element) {
let pageId = pageFolderTeleportCount.value;
pageFolderTeleportCount.value += 1000;
async function toggle() {
async function toggle(ev: MouseEvent) {
emit('headerClicked', ev);
if (asPage && !opened.value) {
pageId++;
const { dispose } = await popup(MkFolderPage, {

View File

@ -28,17 +28,37 @@ SPDX-License-Identifier: AGPL-3.0-only
<span v-else style="opacity: 0.7;">({{ i18n.ts.none }})</span>
</template>
</MkKeyValue>
<MkFolder @headerClicked="onHeaderClicked">
<template #icon><i class="ti ti-report-search"></i></template>
<template #label>{{ i18n.ts.deviceInfo }}</template>
<template #caption>{{ i18n.ts.deviceInfoDescription }}</template>
<MkLoading v-if="userEnv == null" />
<MkCode v-else lang="json" :code="JSON.stringify(userEnv, null, 2)" style="max-height: 300px; overflow: auto;"/>
</MkFolder>
</div>
</div>
</PageWithHeader>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { definePage } from '@/page.js';
import { getUserEnvironment } from '@/utility/get-user-environment.js';
import type { UserEnvironment } from '@/utility/get-user-environment.js';
import MkKeyValue from '@/components/MkKeyValue.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkLink from '@/components/MkLink.vue';
import MkCode from '@/components/MkCode.vue';
const userEnv = ref<UserEnvironment | null>(null);
async function onHeaderClicked() {
if (userEnv.value == null) {
userEnv.value = await getUserEnvironment();
}
}
definePage(() => ({
title: i18n.ts.inquiry,

View File

@ -0,0 +1,66 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export type UserEnvironment = {
os: string;
browser: string;
userAgent: string;
screenWidth: number;
screenHeight: number;
viaGetHighEntropyValues: true;
} | {
userAgent: string;
screenWidth: number;
screenHeight: number;
viaGetHighEntropyValues: false;
};
export async function getUserEnvironment(): Promise<UserEnvironment> {
if ('userAgentData' in navigator && navigator.userAgentData != null) {
try {
const uaData: any = await navigator.userAgentData.getHighEntropyValues([
'fullVersionList',
'platformVersion',
]);
let osVersion = 'v' + uaData.platformVersion;
if (uaData.platform === 'Windows' && uaData.platformVersion != null) {
// https://learn.microsoft.com/ja-jp/microsoft-edge/web-platform/how-to-detect-win11
const majorPlatformVersion = parseInt(uaData.platformVersion.split('.')[0]);
if (majorPlatformVersion >= 13) {
osVersion = '11 or later';
} else if (majorPlatformVersion > 0) {
osVersion = '10';
} else {
osVersion = '8.1 or earlier';
}
}
const browserData = uaData.fullVersionList.find((item) => !/^\s*not.+a.+brand\s*$/i.test(item.brand));
return {
os: `${uaData.platform} ${osVersion}`,
browser: browserData ? `${browserData.brand} v${browserData.version}` : 'Unknown',
userAgent: navigator.userAgent,
screenWidth: window.innerWidth,
screenHeight: window.innerHeight,
viaGetHighEntropyValues: true,
};
} catch {
return getViaUa();
}
} else {
return getViaUa();
}
}
function getViaUa(): UserEnvironment {
return {
userAgent: navigator.userAgent,
screenWidth: window.innerWidth,
screenHeight: window.innerHeight,
viaGetHighEntropyValues: false,
};
}

View File

@ -5552,8 +5552,8 @@ packages:
boolbase@1.0.0:
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
bowser@2.11.0:
resolution: {integrity: sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==}
bowser@2.12.1:
resolution: {integrity: sha512-z4rE2Gxh7tvshQ4hluIT7XcFrgLIQaw9X3A+kTTRdovCz5PMukm/0QC/BKSYPj3omF5Qfypn9O/c5kgpmvYUCw==}
brace-expansion@1.1.11:
resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==}
@ -12101,14 +12101,14 @@ snapshots:
dependencies:
'@aws-sdk/types': 3.862.0
'@smithy/types': 4.4.0
bowser: 2.11.0
bowser: 2.12.1
tslib: 2.8.1
'@aws-sdk/util-user-agent-browser@3.893.0':
dependencies:
'@aws-sdk/types': 3.893.0
'@smithy/types': 4.5.0
bowser: 2.11.0
bowser: 2.12.1
tslib: 2.8.1
'@aws-sdk/util-user-agent-node@3.873.0':
@ -14668,7 +14668,7 @@ snapshots:
'@smithy/property-provider': 4.1.0
'@smithy/smithy-client': 4.6.0
'@smithy/types': 4.4.0
bowser: 2.11.0
bowser: 2.12.1
tslib: 2.8.1
'@smithy/util-defaults-mode-browser@4.1.4':
@ -14676,7 +14676,7 @@ snapshots:
'@smithy/property-provider': 4.1.1
'@smithy/smithy-client': 4.6.4
'@smithy/types': 4.5.0
bowser: 2.11.0
bowser: 2.12.1
tslib: 2.8.1
'@smithy/util-defaults-mode-node@4.1.0':
@ -15744,7 +15744,7 @@ snapshots:
'@typescript-eslint/types': 8.44.1
'@typescript-eslint/typescript-estree': 8.44.1(typescript@5.9.2)
'@typescript-eslint/visitor-keys': 8.44.1
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
eslint: 9.36.0
typescript: 5.9.2
transitivePeerDependencies:
@ -15773,7 +15773,7 @@ snapshots:
'@typescript-eslint/types': 8.44.1
'@typescript-eslint/typescript-estree': 8.44.1(typescript@5.9.2)
'@typescript-eslint/utils': 8.44.1(eslint@9.36.0)(typescript@5.9.2)
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
eslint: 9.36.0
ts-api-utils: 2.1.0(typescript@5.9.2)
typescript: 5.9.2
@ -15788,7 +15788,7 @@ snapshots:
'@typescript-eslint/tsconfig-utils': 8.44.1(typescript@5.9.2)
'@typescript-eslint/types': 8.44.1
'@typescript-eslint/visitor-keys': 8.44.1
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
fast-glob: 3.3.3
is-glob: 4.0.3
minimatch: 9.0.5
@ -15827,7 +15827,7 @@ snapshots:
'@ampproject/remapping': 2.3.0
'@bcoe/v8-coverage': 1.0.2
ast-v8-to-istanbul: 0.3.3
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
istanbul-lib-source-maps: 5.0.6
@ -16578,7 +16578,7 @@ snapshots:
boolbase@1.0.0: {}
bowser@2.11.0: {}
bowser@2.12.1: {}
brace-expansion@1.1.11:
dependencies:
@ -17657,7 +17657,7 @@ snapshots:
esbuild-register@3.5.0(esbuild@0.25.10):
dependencies:
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
esbuild: 0.25.10
transitivePeerDependencies:
- supports-color
@ -18633,7 +18633,7 @@ snapshots:
http-proxy-agent@7.0.2:
dependencies:
agent-base: 7.1.3
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.3
transitivePeerDependencies:
- supports-color
@ -18666,6 +18666,13 @@ snapshots:
- supports-color
optional: true
https-proxy-agent@7.0.6:
dependencies:
agent-base: 7.1.3
debug: 4.4.3
transitivePeerDependencies:
- supports-color
https-proxy-agent@7.0.6(supports-color@10.2.0):
dependencies:
agent-base: 7.1.3
@ -19008,7 +19015,7 @@ snapshots:
istanbul-lib-source-maps@5.0.6:
dependencies:
'@jridgewell/trace-mapping': 0.3.29
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
istanbul-lib-coverage: 3.2.2
transitivePeerDependencies:
- supports-color
@ -19397,7 +19404,7 @@ snapshots:
decimal.js: 10.5.0
html-encoding-sniffer: 4.0.0
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.6(supports-color@10.2.0)
https-proxy-agent: 7.0.6
is-potential-custom-element-name: 1.0.1
nwsapi: 2.2.16
parse5: 7.3.0
@ -22717,7 +22724,7 @@ snapshots:
vite-node@3.2.4(@types/node@22.18.6)(sass@1.93.2)(terser@5.44.0)(tsx@4.20.6):
dependencies:
cac: 6.7.14
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
es-module-lexer: 1.7.0
pathe: 2.0.3
vite: 7.1.7(@types/node@22.18.6)(sass@1.93.2)(terser@5.44.0)(tsx@4.20.6)
@ -22773,7 +22780,7 @@ snapshots:
'@vitest/spy': 3.2.4
'@vitest/utils': 3.2.4
chai: 5.2.0
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
expect-type: 1.2.1
magic-string: 0.30.19
pathe: 2.0.3
@ -22861,7 +22868,7 @@ snapshots:
vue-eslint-parser@10.2.0(eslint@9.36.0):
dependencies:
debug: 4.4.1(supports-color@10.2.0)
debug: 4.4.1(supports-color@5.5.0)
eslint: 9.36.0
eslint-scope: 8.4.0
eslint-visitor-keys: 4.2.1