31 lines
855 B
JavaScript
31 lines
855 B
JavaScript
"use strict";
|
|
|
|
// Pulsar/Electron no longer supports the legacy gating/login flow that the
|
|
// bundled Jibo SDK package uses to delay command registration.
|
|
//
|
|
// The bundle's gating module checks localStorage for this key, and only
|
|
// registers all commands if it is set to "true".
|
|
const LEGACY_GATING_KEY = "cmajghqmadhnadjcjhamajdhda";
|
|
|
|
const bundled = require("./jibo-sdk");
|
|
|
|
function forceLegacyLoginFlag() {
|
|
try {
|
|
if (typeof globalThis !== "undefined" && globalThis.localStorage) {
|
|
globalThis.localStorage.setItem(LEGACY_GATING_KEY, "true");
|
|
}
|
|
} catch (_) {
|
|
// Best-effort only.
|
|
}
|
|
}
|
|
|
|
if (bundled && typeof bundled.activate === "function") {
|
|
const originalActivate = bundled.activate.bind(bundled);
|
|
bundled.activate = function activate(state) {
|
|
forceLegacyLoginFlag();
|
|
return originalActivate(state);
|
|
};
|
|
}
|
|
|
|
module.exports = bundled;
|