forked from QuarkSources/quarksources.github.io
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrandomize_apps.js
More file actions
67 lines (55 loc) · 1.58 KB
/
Copy pathrandomize_apps.js
File metadata and controls
67 lines (55 loc) · 1.58 KB
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
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('wuxu-complete.json', 'utf8'));
// Top tier - will be at the very top of the list in this exact order
const topApps = [
"YouTube++",
"Spotify++",
"TikTok++",
"Instagram++",
"Dopamine",
];
// Second tier - will be randomly shuffled below top tier
const interestingApps = [
"Facebook++",
"X++",
"MyFitnessPal++",
"Duolingo++",
"PPSSPP",
"TrollInstallerX",
"Pokemon Go (w/ SpooferPro)",
"Null's Royale",
"Scarlet",
"ESign"
];
const tier1 = [];
const tier2 = [];
const tier3 = [];
data.apps.forEach(app => {
if (topApps.includes(app.name)) {
tier1.push(app);
} else if (interestingApps.includes(app.name)) {
tier2.push(app);
} else {
tier3.push(app);
}
});
// Sort tier1 to match the exact order in topApps array
tier1.sort((a, b) => topApps.indexOf(a.name) - topApps.indexOf(b.name));
// Shuffle tier 2 and tier 3
const shuffle = (array) => {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
};
shuffle(tier2);
shuffle(tier3);
// Combine
data.apps = [...tier1, ...tier2, ...tier3];
// Set top 5 featured apps (which matches our tier 1 list)
data.featuredApps = tier1.slice(0, 5).map(app => app.bundleIdentifier);
const jsonOutput = JSON.stringify(data, null, 2);
fs.writeFileSync('wuxu-complete.json', jsonOutput);
fs.writeFileSync('frontend/public/wuxu-complete.json', jsonOutput);
console.log('Successfully randomized apps while keeping interesting ones at the top.');