mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Replace bundled nostr-tools with esm module
This commit is contained in:
1 parent
e92bfee9c4
commit
61aa55e70b
2 files changed
+17
-8699
No files matched your search
+17
-23
@@ -198,34 +198,28 @@
|
||||
</div>
|
||||
|
||||
<!-- Additional Scripts -->
|
||||
<script src="js/libs/nostr.bundle.js"></script>
|
||||
<script type="module">
|
||||
import * as nostrTools from "https://esm.sh/[email protected]";
|
||||
|
||||
const existing =
|
||||
typeof window !== "undefined" &&
|
||||
window.NostrTools &&
|
||||
typeof window.NostrTools === "object"
|
||||
? window.NostrTools
|
||||
: {};
|
||||
const normalizedGeneratePrivateKey =
|
||||
typeof nostrTools.generatePrivateKey === "function"
|
||||
? nostrTools.generatePrivateKey
|
||||
: typeof nostrTools.generateSecretKey === "function"
|
||||
? nostrTools.generateSecretKey
|
||||
: undefined;
|
||||
|
||||
const merged = { ...existing, ...nostrTools };
|
||||
const normalizedGenerateSecretKey =
|
||||
typeof nostrTools.generateSecretKey === "function"
|
||||
? nostrTools.generateSecretKey
|
||||
: typeof nostrTools.generatePrivateKey === "function"
|
||||
? nostrTools.generatePrivateKey
|
||||
: undefined;
|
||||
|
||||
if (
|
||||
!merged.generatePrivateKey &&
|
||||
typeof merged.generateSecretKey === "function"
|
||||
) {
|
||||
merged.generatePrivateKey = merged.generateSecretKey.bind(merged);
|
||||
}
|
||||
|
||||
if (
|
||||
!merged.generateSecretKey &&
|
||||
typeof merged.generatePrivateKey === "function"
|
||||
) {
|
||||
merged.generateSecretKey = merged.generatePrivateKey.bind(merged);
|
||||
}
|
||||
|
||||
window.NostrTools = merged;
|
||||
window.NostrTools = {
|
||||
...nostrTools,
|
||||
generatePrivateKey: normalizedGeneratePrivateKey,
|
||||
generateSecretKey: normalizedGenerateSecretKey,
|
||||
};
|
||||
</script>
|
||||
<script type="module" src="js/config.js"></script>
|
||||
<script type="module" src="js/lists.js"></script>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user