@@ -8,13 +8,14 @@ import PageHeader from "@/components/ui/PageHeader.vue";
88import { useActionLock } from " @/composables/useActionLock" ;
99import { useMagicNet } from " @/composables/useMagicNet" ;
1010import { copyText } from " @/utils" ;
11- import { buildAppPolicySummary , isValidPackageName , recommendedBypass } from " ./appPolicyInsights" ;
11+ import { buildAppPolicySummary , formatAppPolicyFullReport , formatAppPolicySafeReport , isValidPackageName , recommendedBypass } from " ./appPolicyInsights" ;
1212
1313const { state, runCli, refreshApps, refreshPackages, shellQuote } = useMagicNet ();
1414const { isRunning, withAction } = useActionLock ();
1515const removedBypass = ref <string []>([]);
1616const pendingAppAction = ref <PendingAppAction | null >(null );
1717const appReportCopied = ref (false );
18+ const safeReportCopied = ref (false );
1819
1920type PendingAppAction = {
2021 key: string ;
@@ -182,28 +183,23 @@ async function searchPackages(): Promise<void> {
182183}
183184
184185async function copyAppPolicyReport(): Promise <void > {
185- const report = [
186- " MagicNet app policy" ,
187- " privacy_note=contains package names from app policy lists" ,
188- ` mode=${state .appPolicy .mode } ` ,
189- ` proxy_count=${state .appPolicy .proxy .length } ` ,
190- ` bypass_count=${state .appPolicy .bypass .length } ` ,
191- ` summary=${policySummary .value .summary } ` ,
192- ` conflict_count=${policySummary .value .conflicts .length } ` ,
193- ` current_list_proxy=${policySummary .value .installedProxy .length } ` ,
194- ` current_list_bypass=${policySummary .value .installedBypass .length } ` ,
195- " " ,
196- " [insights]" ,
197- ... policySummary .value .items .map ((item ) => ` ${item .label }=${item .value } (${item .tone }) ` ),
198- " " ,
199- " [proxy]" ,
200- ... state .appPolicy .proxy ,
201- " " ,
202- " [bypass]" ,
203- ... state .appPolicy .bypass
204- ].join (" \n " ).trim ();
205- appReportCopied .value = await copyText (report );
206- state .output = appReportCopied .value ? " 应用策略快照已复制。" : " 剪贴板不可用,应用策略快照未复制。" ;
186+ appReportCopied .value = await copyText (formatAppPolicyFullReport ({
187+ mode: state .appPolicy .mode ,
188+ proxy: state .appPolicy .proxy ,
189+ bypass: state .appPolicy .bypass ,
190+ summary: policySummary .value
191+ }));
192+ state .output = appReportCopied .value ? " 应用策略完整快照已复制。" : " 剪贴板不可用,应用策略快照未复制。" ;
193+ }
194+
195+ async function copyAppPolicySafeReport(): Promise <void > {
196+ safeReportCopied .value = await copyText (formatAppPolicySafeReport ({
197+ mode: state .appPolicy .mode ,
198+ proxy: state .appPolicy .proxy ,
199+ bypass: state .appPolicy .bypass ,
200+ summary: policySummary .value
201+ }));
202+ state .output = safeReportCopied .value ? " 应用策略隐私摘要已复制。" : " 剪贴板不可用,应用策略摘要未复制。" ;
207203}
208204
209205async function applyRecommendedBypass(): Promise <void > {
@@ -283,7 +279,8 @@ onMounted(() => {
283279 <div class =" flex flex-wrap gap-2" >
284280 <Button variant="outline" :loading =" isRunning (' refresh-apps' )" @click =" withAction (' refresh-apps' , () => refreshApps ())" ><RefreshCw :size =" 17 " />读取名单</Button >
285281 <Button variant="outline" :loading =" isRunning (' search-packages' )" @click =" searchPackages " ><ListFilter :size =" 17 " />重新读取应用</Button >
286- <Button variant="outline" :loading =" isRunning (' copy-app-policy-report' )" @click =" withAction (' copy-app-policy-report' , copyAppPolicyReport )" ><Copy :size =" 17 " />{{ appReportCopied ? '已复制快照' : '复制快照' }}</Button >
282+ <Button variant="outline" :loading =" isRunning (' copy-app-policy-report' )" @click =" withAction (' copy-app-policy-report' , copyAppPolicyReport )" ><Copy :size =" 17 " />{{ appReportCopied ? '已复制快照' : '复制完整快照' }}</Button >
283+ <Button variant="outline" :loading =" isRunning (' copy-app-policy-safe-report' )" @click =" withAction (' copy-app-policy-safe-report' , copyAppPolicySafeReport )" ><Copy :size =" 17 " />{{ safeReportCopied ? '已复制摘要' : '复制隐私摘要' }}</Button >
287284 <Button :loading =" isRunning (' apply-recommended-bypass' )" :disabled =" availableRecommendedBypass .length === 0 " @click =" requestRecommendedBypass " ><ShieldCheck :size =" 17 " />应用推荐名单</Button >
288285 </div >
289286 </PageHeader >
0 commit comments