🔧 无痕浏览,默认开启

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

View File

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

View File

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