This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
699 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
function genDeviceId() { | ||
let e = Sr(); | ||
if (e = "".concat(e.replace(/-/g, ""), "a"), | ||
e = function (r) { | ||
let i = "0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split("") | ||
, o = i.length + 1 | ||
, s = +r | ||
, a = []; | ||
do { | ||
let c = s % o; | ||
s = (s - c) / o, | ||
a.unshift(i[c]) | ||
} while (s); | ||
return a.join("") | ||
}(parseInt(e, 16)), | ||
e.length > 22 && (e = e.slice(0, 22)), | ||
e.length < 22) | ||
for (let t = 22 - e.length, n = 0; n < t; n++) | ||
e += "0"; | ||
return e | ||
} | ||
|
||
function Sr() { | ||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (e) { | ||
const t = 16 * Math.random() | 0; | ||
return (e === "x" ? t : 3 & t | 8).toString(16) | ||
}) | ||
} | ||
|
||
export interface Device { | ||
deviceId: string | ||
model: string | ||
platform: string | ||
timestamp: number | ||
version: string | ||
} | ||
|
||
export function genDeviceConfig(): Device { | ||
return { | ||
deviceId: genDeviceId(), | ||
model: "Web|Chrome|119.0.0.0", | ||
platform: "web", | ||
timestamp: 0, | ||
version: "5.9.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * as Network from "./network" | ||
export {genDeviceConfig} from "./deivce" |
Oops, something went wrong.