18 lines
394 B
JavaScript
18 lines
394 B
JavaScript
|
|
const AUTH_KEY = "pts_authdata";
|
||
|
|
|
||
|
|
function readPtsAuth() {
|
||
|
|
const raw = localStorage.getItem(AUTH_KEY);
|
||
|
|
if (!raw) return null;
|
||
|
|
try {
|
||
|
|
return JSON.parse(raw);
|
||
|
|
} catch {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
||
|
|
if (message?.type === "GET_PTS_AUTH") {
|
||
|
|
sendResponse({ ok: true, auth: readPtsAuth() });
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
});
|