🔧 无痕浏览,默认开启

This commit is contained in:
目棃
2025-02-24 18:54:13 +08:00
parent 5b390d3ad1
commit d2e6d112d5
3 changed files with 42 additions and 2 deletions

View File

@@ -76,6 +76,7 @@
:label="devMode ? '开启' : '关闭'"
:inset="true"
color="#FAC51E"
class="config-switch"
@click="submitDevMode"
/>
</template>
@@ -92,10 +93,28 @@
:label="isNeedResize ? '开启' : '关闭'"
:inset="true"
color="#FAC51E"
class="config-switch"
@click="submitResize"
/>
</template>
</v-list-item>
<v-list-item title="无痕浏览" subtitle="关闭后将记录帖子浏览记录">
<template #prepend>
<div class="config-icon">
<v-icon>mdi-incognito</v-icon>
</div>
</template>
<template #append>
<v-switch
v-model="appStore.incognito"
:label="appStore.incognito ? '开启' : '关闭'"
:inset="true"
class="config-switch"
color="#FAC51E"
@click="switchIncognito"
/>
</template>
</v-list-item>
<v-list-item title="分享设置" v-if="platform() === 'windows'">
<template #subtitle>默认保存到剪贴板超过{{ shareDefaultFile }}MB时保存到文件</template>
<template #prepend>
@@ -491,6 +510,15 @@ function submitResize(): void {
}
showSnackbar.success("已开启窗口回正!");
}
// 开启无痕浏览
async function switchIncognito(): Promise<void> {
if (appStore.incognito) {
showSnackbar.success("已关闭无痕浏览!");
return;
}
showSnackbar.success("已开启无痕浏览!");
}
</script>
<style lang="css" scoped>
.config-box {
@@ -529,6 +557,10 @@ function submitResize(): void {
color: var(--box-text-2);
}
.config-switch {
height: 40px;
}
.config-right {
position: fixed;
top: 16px;

View File

@@ -61,6 +61,8 @@ export const useAppStore = defineStore(
const shareDefaultFile = ref<number>(10);
// 图像压缩质量
const imageQualityPercent = ref<number>(80);
// 无痕浏览
const incognito = ref<boolean>(true);
// 初始化
function init(): void {
@@ -75,6 +77,7 @@ export const useAppStore = defineStore(
gameDir.value = "未设置";
shareDefaultFile.value = 10;
imageQualityPercent.value = 10;
incognito.value = true;
initDevice();
}
@@ -109,6 +112,7 @@ export const useAppStore = defineStore(
gameDir,
shareDefaultFile,
imageQualityPercent,
incognito,
init,
changeTheme,
getImageUrl,
@@ -132,6 +136,7 @@ export const useAppStore = defineStore(
"needResize",
"shareDefaultFile",
"imageQualityPercent",
"incognito",
],
},
{

View File

@@ -115,6 +115,7 @@ import { createTGWindow } from "@/utils/TGWindow.js";
import apiHubReq from "@/web/request/apiHubReq.js";
const { cookie } = storeToRefs(useUserStore());
const { incognito } = storeToRefs(useAppStore());
const appVersion = ref<string>();
const postId = Number(useRoute().params.post_id);
const showCollection = ref<boolean>(false);
@@ -142,8 +143,10 @@ onMounted(async () => {
return;
}
await showLoading.update(`帖子ID: ${postId}`);
let ck: undefined | Record<string, string>;
if (cookie.value) ck = { ltoken: cookie.value.ltoken, ltuid: cookie.value.ltuid };
let ck: undefined | Record<string, string> = undefined;
if (cookie.value && incognito.value === false) {
ck = { ltoken: cookie.value.ltoken, ltuid: cookie.value.ltuid };
}
const resp = await Mys.Post.getPostFull(postId, ck);
if ("retcode" in resp) {
await showLoading.empty("数据加载失败", `[${resp.retcode}]${resp.message}`);