mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
Merge branch 'main' of https://github.com/MercuryWorkshop/aerojet
This commit is contained in:
commit
a29e8c42a3
3 changed files with 53 additions and 50 deletions
16
pnpm-lock.yaml
generated
16
pnpm-lock.yaml
generated
|
@ -11,6 +11,9 @@ importers:
|
|||
'@mercuryworkshop/bare-mux':
|
||||
specifier: ^2.0.2
|
||||
version: 2.0.2
|
||||
'@webreflection/idb-map':
|
||||
specifier: ^0.3.1
|
||||
version: 0.3.1
|
||||
astravel:
|
||||
specifier: ^0.6.1
|
||||
version: 0.6.1
|
||||
|
@ -29,9 +32,6 @@ importers:
|
|||
htmlparser2:
|
||||
specifier: ^9.1.0
|
||||
version: 9.1.0
|
||||
idb-map-entries:
|
||||
specifier: ^0.3.2
|
||||
version: 0.3.2
|
||||
meriyah:
|
||||
specifier: ^4.4.2
|
||||
version: 4.4.2
|
||||
|
@ -643,6 +643,9 @@ packages:
|
|||
'@webassemblyjs/wast-printer@1.12.1':
|
||||
resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==}
|
||||
|
||||
'@webreflection/idb-map@0.3.1':
|
||||
resolution: {integrity: sha512-lRCanqwR7tHHFohJHAMSMEZnoNPvgjcKr0f5e4y+lTJA+fctT61EZ+f5pT5/+8+wlSsMAvXjzfKRLT6o9aqxbA==}
|
||||
|
||||
'@xtuc/ieee754@1.2.0':
|
||||
resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==}
|
||||
|
||||
|
@ -1500,9 +1503,6 @@ packages:
|
|||
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
idb-map-entries@0.3.2:
|
||||
resolution: {integrity: sha512-ytqa9ACEDhytNkxzg76ZwKw4bo3fXCw4ps6Patte8Dy4GhLFZFDAipcbrXsW1bdoa5N9ALqS1GftIgex8cdGgw==}
|
||||
|
||||
ieee754@1.2.1:
|
||||
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
|
||||
|
||||
|
@ -3375,6 +3375,8 @@ snapshots:
|
|||
'@webassemblyjs/ast': 1.12.1
|
||||
'@xtuc/long': 4.2.2
|
||||
|
||||
'@webreflection/idb-map@0.3.1': {}
|
||||
|
||||
'@xtuc/ieee754@1.2.0': {}
|
||||
|
||||
'@xtuc/long@4.2.2': {}
|
||||
|
@ -4319,8 +4321,6 @@ snapshots:
|
|||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
|
||||
idb-map-entries@0.3.2: {}
|
||||
|
||||
ieee754@1.2.1: {}
|
||||
|
||||
ignore@5.3.1: {}
|
||||
|
|
|
@ -8,27 +8,9 @@ export interface Codec {
|
|||
decode: (str: string | undefined) => string;
|
||||
}
|
||||
|
||||
const xor = {
|
||||
encode: (str: string | undefined, key: number = 2) => {
|
||||
if (!str) return str;
|
||||
|
||||
return encodeURIComponent(
|
||||
str
|
||||
.split("")
|
||||
.map((e, i) =>
|
||||
i % key ? String.fromCharCode(e.charCodeAt(0) ^ key) : e
|
||||
)
|
||||
.join("")
|
||||
);
|
||||
},
|
||||
decode: (str: string | undefined, key: number = 2) => {
|
||||
if (!str) return str;
|
||||
|
||||
return decodeURIComponent(str)
|
||||
.split("")
|
||||
.map((e, i) => (i % key ? String.fromCharCode(e.charCodeAt(0) ^ key) : e))
|
||||
.join("");
|
||||
},
|
||||
const none = {
|
||||
encode: (str: string | undefined) => str,
|
||||
decode: (str: string | undefined) => str,
|
||||
};
|
||||
|
||||
const plain = {
|
||||
|
@ -44,6 +26,45 @@ const plain = {
|
|||
},
|
||||
};
|
||||
|
||||
const xor = {
|
||||
encode: (str: string | undefined, key: number = 2) => {
|
||||
if (!str) return str;
|
||||
|
||||
let result = "";
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
result += i % key ? String.fromCharCode(str.charCodeAt(i) ^ key) : str[i];
|
||||
}
|
||||
|
||||
return encodeURIComponent(result);
|
||||
},
|
||||
decode: (str: string | undefined, key: number = 2) => {
|
||||
if (!str) return str;
|
||||
|
||||
const [input, ...search] = str.split("?");
|
||||
let result = "";
|
||||
const decoded = decodeURIComponent(input);
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
result +=
|
||||
i % key ? String.fromCharCode(decoded.charCodeAt(i) ^ key) : decoded[i];
|
||||
}
|
||||
|
||||
return result + (search.length ? "?" + search.join("?") : "");
|
||||
},
|
||||
};
|
||||
|
||||
const base64 = {
|
||||
encode: (str: string | undefined) => {
|
||||
if (!str) return str;
|
||||
|
||||
return decodeURIComponent(btoa(str));
|
||||
},
|
||||
decode: (str: string | undefined) => {
|
||||
if (!str) return str;
|
||||
|
||||
return atob(str);
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
const aes = {
|
||||
encode: (str: string | undefined) => {
|
||||
|
@ -59,24 +80,6 @@ const aes = {
|
|||
}
|
||||
*/
|
||||
|
||||
const none = {
|
||||
encode: (str: string | undefined) => str,
|
||||
decode: (str: string | undefined) => str,
|
||||
};
|
||||
|
||||
const base64 = {
|
||||
encode: (str: string | undefined) => {
|
||||
if (!str) return str;
|
||||
|
||||
return decodeURIComponent(btoa(str));
|
||||
},
|
||||
decode: (str: string | undefined) => {
|
||||
if (!str) return str;
|
||||
|
||||
return atob(str);
|
||||
},
|
||||
};
|
||||
|
||||
if (typeof self.$scramjet === "undefined") {
|
||||
//@ts-expect-error really dumb workaround
|
||||
self.$scramjet = {};
|
||||
|
@ -84,6 +87,6 @@ if (typeof self.$scramjet === "undefined") {
|
|||
self.$scramjet.codecs = {
|
||||
none,
|
||||
plain,
|
||||
base64,
|
||||
xor,
|
||||
base64,
|
||||
};
|
||||
|
|
|
@ -68,7 +68,7 @@ const store = $store(
|
|||
},
|
||||
{ ident: "settings", backing: "localstorage", autosave: "auto" }
|
||||
);
|
||||
connection.setTransport("/baremod/index.mjs", [store.bareurl]);
|
||||
connection.setTransport("/epoxy/index.mjs", [{ wisp: store.wispurl }]);
|
||||
function App() {
|
||||
this.urlencoded = "";
|
||||
this.css = `
|
||||
|
@ -150,7 +150,7 @@ function App() {
|
|||
}
|
||||
`;
|
||||
|
||||
let frame = scramjet.createFrame();
|
||||
const frame = scramjet.createFrame();
|
||||
|
||||
return html`
|
||||
<div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue