mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-15 20:12:59 -07:00
fix(docs): proxy Plausible tracking script
This commit is contained in:
@@ -7,32 +7,7 @@ import './mermaid-modal.css';
|
||||
import TuiLayout from './TuiLayout.vue';
|
||||
|
||||
let mermaidLoader: Promise<any> | null = null;
|
||||
let plausibleTrackerInitialized = false;
|
||||
const MERMAID_MODAL_ID = 'mermaid-diagram-modal';
|
||||
const PLAUSIBLE_DOMAIN = 'subminer.moe';
|
||||
const PLAUSIBLE_ENABLED_HOSTNAMES = new Set(['docs.subminer.moe']);
|
||||
const PLAUSIBLE_ENDPOINT = 'https://worker.subminer.moe/api/capture';
|
||||
|
||||
async function initPlausibleTracker() {
|
||||
if (typeof window === 'undefined' || plausibleTrackerInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PLAUSIBLE_ENABLED_HOSTNAMES.has(window.location.hostname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { init } = await import('@plausible-analytics/tracker');
|
||||
init({
|
||||
domain: PLAUSIBLE_DOMAIN,
|
||||
endpoint: PLAUSIBLE_ENDPOINT,
|
||||
outboundLinks: true,
|
||||
fileDownloads: true,
|
||||
formSubmissions: true,
|
||||
captureOnLocalhost: false,
|
||||
});
|
||||
plausibleTrackerInitialized = true;
|
||||
}
|
||||
|
||||
function closeMermaidModal() {
|
||||
if (typeof document === 'undefined') {
|
||||
@@ -222,9 +197,6 @@ export default {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initPlausibleTracker().catch((error) => {
|
||||
console.error('Failed to initialize Plausible tracker:', error);
|
||||
});
|
||||
render();
|
||||
});
|
||||
watch(() => route.path, render);
|
||||
|
||||
Reference in New Issue
Block a user