linkfeed-pro 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +9 -0
- package/.output/chrome-mv3/_locales/de/messages.json +214 -0
- package/.output/chrome-mv3/_locales/en/messages.json +214 -0
- package/.output/chrome-mv3/_locales/es/messages.json +214 -0
- package/.output/chrome-mv3/_locales/fr/messages.json +214 -0
- package/.output/chrome-mv3/_locales/hi/messages.json +214 -0
- package/.output/chrome-mv3/_locales/id/messages.json +214 -0
- package/.output/chrome-mv3/_locales/it/messages.json +214 -0
- package/.output/chrome-mv3/_locales/nl/messages.json +214 -0
- package/.output/chrome-mv3/_locales/pl/messages.json +214 -0
- package/.output/chrome-mv3/_locales/pt_BR/messages.json +214 -0
- package/.output/chrome-mv3/_locales/pt_PT/messages.json +214 -0
- package/.output/chrome-mv3/_locales/tr/messages.json +214 -0
- package/.output/chrome-mv3/assets/popup-Z_g1HFs5.css +1 -0
- package/.output/chrome-mv3/background.js +42 -0
- package/.output/chrome-mv3/chunks/popup-IxiPwS1E.js +42 -0
- package/.output/chrome-mv3/content-scripts/content.js +179 -0
- package/.output/chrome-mv3/icon-128.png +0 -0
- package/.output/chrome-mv3/icon-16.png +0 -0
- package/.output/chrome-mv3/icon-48.png +0 -0
- package/.output/chrome-mv3/icon.svg +9 -0
- package/.output/chrome-mv3/manifest.json +1 -0
- package/.output/chrome-mv3/popup.html +247 -0
- package/.wxt/eslint-auto-imports.mjs +56 -0
- package/.wxt/tsconfig.json +28 -0
- package/.wxt/types/globals.d.ts +15 -0
- package/.wxt/types/i18n.d.ts +593 -0
- package/.wxt/types/imports-module.d.ts +20 -0
- package/.wxt/types/imports.d.ts +50 -0
- package/.wxt/types/paths.d.ts +32 -0
- package/.wxt/wxt.d.ts +7 -0
- package/entrypoints/background.ts +112 -0
- package/entrypoints/content.ts +656 -0
- package/entrypoints/popup/main.ts +452 -0
- package/entrypoints/popup/modules/auth-modal.ts +219 -0
- package/entrypoints/popup/modules/settings.ts +78 -0
- package/entrypoints/popup/modules/ui-state.ts +95 -0
- package/entrypoints/popup/style.css +844 -0
- package/entrypoints/popup.html +261 -0
- package/lib/constants.ts +9 -0
- package/lib/device-meta.ts +173 -0
- package/lib/i18n.ts +201 -0
- package/lib/license.ts +470 -0
- package/lib/selectors.ts +24 -0
- package/lib/storage.ts +95 -0
- package/lib/telemetry.ts +94 -0
- package/package.json +30 -0
- package/public/_locales/de/messages.json +214 -0
- package/public/_locales/en/messages.json +214 -0
- package/public/_locales/es/messages.json +214 -0
- package/public/_locales/fr/messages.json +214 -0
- package/public/_locales/hi/messages.json +214 -0
- package/public/_locales/id/messages.json +214 -0
- package/public/_locales/it/messages.json +214 -0
- package/public/_locales/nl/messages.json +214 -0
- package/public/_locales/pl/messages.json +214 -0
- package/public/_locales/pt_BR/messages.json +214 -0
- package/public/_locales/pt_PT/messages.json +214 -0
- package/public/_locales/tr/messages.json +214 -0
- package/public/icon-128.png +0 -0
- package/public/icon-16.png +0 -0
- package/public/icon-48.png +0 -0
- package/public/icon.svg +9 -0
- package/tsconfig.json +3 -0
- package/wxt.config.ts +50 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { sdk, syncIdentity, getDailyPayload } from '../lib/telemetry';
|
|
2
|
+
import { activateLicenseLink, fetchLicenseStatus, getDeviceId } from '../lib/license';
|
|
3
|
+
import { initLocalization } from '../lib/i18n';
|
|
4
|
+
import { API_BASE_URL } from '../lib/constants';
|
|
5
|
+
import { browser } from '#imports';
|
|
6
|
+
|
|
7
|
+
export default defineBackground(() => {
|
|
8
|
+
console.log('LinkFeed BG started');
|
|
9
|
+
let licenseRefreshInFlight: Promise<Awaited<ReturnType<typeof fetchLicenseStatus>>> | null = null;
|
|
10
|
+
let licenseRefreshForcedInFlight: Promise<Awaited<ReturnType<typeof fetchLicenseStatus>>> | null = null;
|
|
11
|
+
|
|
12
|
+
// 1. Initialize Telemetry Lifecycle (Install/Update + Daily Heartbeat)
|
|
13
|
+
sdk.registerExtensionLifecycle({
|
|
14
|
+
getDailyPayload: getDailyPayload
|
|
15
|
+
}).catch(err => console.error('Failed to register telemetry lifecycle', err));
|
|
16
|
+
initLocalization().catch(() => { });
|
|
17
|
+
|
|
18
|
+
// 2. Track Startup & Sync Identity
|
|
19
|
+
sdk.trackBgWake('startup').catch(() => { });
|
|
20
|
+
syncIdentity(true).catch(() => { });
|
|
21
|
+
|
|
22
|
+
// 3. Listen for tab updates or other BG logic here
|
|
23
|
+
// ...
|
|
24
|
+
|
|
25
|
+
browser.runtime.onMessageExternal.addListener((message, sender, sendResponse) => {
|
|
26
|
+
if (!message || message.type !== 'linkfeed_pair' || !message.activationToken) return;
|
|
27
|
+
if (sender.origin && !sender.origin.startsWith('https://linkfeed.pro') && !sender.origin.startsWith('http://localhost:3000')) return;
|
|
28
|
+
|
|
29
|
+
(async () => {
|
|
30
|
+
const result = await activateLicenseLink(message.activationToken as string);
|
|
31
|
+
if (result.success) {
|
|
32
|
+
await syncIdentity(true);
|
|
33
|
+
}
|
|
34
|
+
sendResponse(result);
|
|
35
|
+
})();
|
|
36
|
+
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
browser.runtime.onMessageExternal.addListener((message, sender, sendResponse) => {
|
|
41
|
+
if (!message || message.type !== 'linkfeed_get_device_info') return;
|
|
42
|
+
if (sender.origin && !sender.origin.startsWith('https://linkfeed.pro') && !sender.origin.startsWith('http://localhost:3000')) return;
|
|
43
|
+
|
|
44
|
+
(async () => {
|
|
45
|
+
const deviceId = await getDeviceId();
|
|
46
|
+
sendResponse({ deviceId });
|
|
47
|
+
})();
|
|
48
|
+
|
|
49
|
+
return true;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
browser.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
|
53
|
+
if (!message) return;
|
|
54
|
+
|
|
55
|
+
if (message.type === 'linkfeed_license_refresh') {
|
|
56
|
+
const force = Boolean(message.force);
|
|
57
|
+
|
|
58
|
+
if (force) {
|
|
59
|
+
if (!licenseRefreshForcedInFlight) {
|
|
60
|
+
licenseRefreshForcedInFlight = (async () => {
|
|
61
|
+
try {
|
|
62
|
+
return await fetchLicenseStatus({ force: true });
|
|
63
|
+
} finally {
|
|
64
|
+
licenseRefreshForcedInFlight = null;
|
|
65
|
+
}
|
|
66
|
+
})();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
licenseRefreshForcedInFlight.then(sendResponse);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!licenseRefreshInFlight) {
|
|
74
|
+
licenseRefreshInFlight = (async () => {
|
|
75
|
+
try {
|
|
76
|
+
return await fetchLicenseStatus();
|
|
77
|
+
} finally {
|
|
78
|
+
licenseRefreshInFlight = null;
|
|
79
|
+
}
|
|
80
|
+
})();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
licenseRefreshInFlight.then(sendResponse);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (message.type !== 'linkfeed_api_fetch' || !message.url) return;
|
|
88
|
+
|
|
89
|
+
(async () => {
|
|
90
|
+
try {
|
|
91
|
+
const url = message.url as string;
|
|
92
|
+
if (!url.startsWith(API_BASE_URL)) {
|
|
93
|
+
return { ok: false, status: 400, data: { error: 'Invalid URL' } };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const response = await fetch(url, {
|
|
97
|
+
method: message.method || 'GET',
|
|
98
|
+
headers: message.headers || {},
|
|
99
|
+
body: message.body,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const data = await response.json().catch(() => null);
|
|
103
|
+
return { ok: response.ok, status: response.status, data };
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error('Background fetch failed:', error);
|
|
106
|
+
return { ok: false, status: 0, data: null };
|
|
107
|
+
}
|
|
108
|
+
})().then(sendResponse);
|
|
109
|
+
|
|
110
|
+
return true;
|
|
111
|
+
});
|
|
112
|
+
});
|