-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
73 lines (64 loc) · 2.42 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* @name ScarletRed
* @author Elaina
* @Modifier Ryuu
* @description ScarletRed theme base on EleinaV3 theme for Pengu Loader
* @link https://github.com/Ryuu43/ScarletRed
*/
let eConsole = "%c ElainaV3 "
let eCss = "color: #ffffff; background-color: #f77fbe"
console.log(eConsole+'%c By %cElaina Da Catto',eCss,"", "color: #e4c2b3")
console.log(eConsole+'%c Meow ~~~',eCss, "color: #e4c2b3")
export function getPluginsName() {
let scriptPath = getScriptPath()
let regex = /\/([^/]+)\/index\.js$/
let match = scriptPath.match(regex)
let pluginsname = match ? match[1]:null
return pluginsname
}
export * from "./data/ImportSettings.js"
import "./data/Data.js"
import "./data/built-in_plugins/Custom-Status"
import "./data/built-in_plugins/Old-LL-Settings"
import "./data/ChangeFilters.js"
import "./data/homepage.js"
import "./data/loadCss.js"
import "./data/_utils.js"
import "./data/built-in_plugins/KeyCombines.js"
import "./data/configs/Custom-Status.txt?raw"
import "./data/Manual-Update.js"
import axios from "https://cdn.skypack.dev/axios"
window.setInterval(async ()=> {
let originWallpaperList = await PluginFS.ls("./data/assets/Backgrounds/Wallpapers")
let originAudioList = await PluginFS.ls("./data/assets/Backgrounds/Audio")
let originFontList = await PluginFS.ls("./data/assets/Fonts/Custom")
const Wallpaperregex = /\.(mp4|webm|mkv|mov|avi|wmv)$/
const Audioregex = /\.(mp3|flac|ogg|wav|aac)$/
const Fontregex = /\.(ttf|otf)$/
const WallpaperList = originWallpaperList.filter((file) => Wallpaperregex.test(file))
const AudioList = originAudioList.filter((file) => Audioregex.test(file))
const FontList = originFontList.filter((file) => Fontregex.test(file))
DataStore.set("Wallpaper-list", WallpaperList)
DataStore.set("Audio-list", AudioList)
DataStore.set("Font-list", FontList)
},1000)
if (DataStore.get("Dev-mode")) {
let res = await fetch(`//plugins/${getPluginsName()}/ElainaV3-Data/index.js`)
if (res.status == 200) {
(await (() => import(`//plugins/${getPluginsName()}/ElainaV3-Data/index.js`))()).default
}
else {
console.warn(`Failed to load ElainaV3 data`)
Toast.error("Failed to load ElainaV3 data")
}
}
else {
let res = await fetch("https://unpkg.com/elainav3-data@latest/index.js")
if (res.status == 200) {
(await (() => import("https://unpkg.com/elainav3-data@latest/index.js"))()).default
}
else {
console.warn(`Failed to load ElainaV3 data`)
Toast.error("Failed to load ElainaV3 data")
}
}