initial commit
This commit is contained in:
30
lib/jibo-sdk-pulsar.js
Normal file
30
lib/jibo-sdk-pulsar.js
Normal file
@@ -0,0 +1,30 @@
|
||||
"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;
|
||||
Reference in New Issue
Block a user