-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
131 lines (115 loc) · 4.03 KB
/
server.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import express from "express";
import fetch from "node-fetch";
let app = (global.app = express());
function connect(PORT) {
app.get("/", (req, res) =>
res.send(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="10">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elaina-MultiDevice Bot</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #1a1a1a;
color: #ffffff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
#clock-container {
font-size: 24px;
text-align: center;
margin-bottom: 20px;
}
#clock {
color: #ff9900; /* Ubah warna jam menjadi oranye */
font-weight: bold;
}
#name {
font-size: 24px;
color: #ff9900;
}
.btn-custom {
background-color: green;
color: #fff;
border: none;
}
</style>
</head>
<body>
<div id="clock-container">
<div id="clock-wib"></div>
<div id="clock-wita"></div>
<div id="clock-wit"></div>
<br />
<div id="name">Elaina-MultiDevice</div>
</div>
<div class="container text-center">
<a href="https://mykingbee.blogspot.com/" class="btn btn-custom btn-primary" target="_blank">Visit My Website</a>
</div>
<script>
function updateClock() {
const now = new Date();
const options = { hour12: false };
const timeStringWIB = now.toLocaleTimeString('en-US', { timeZone: 'Asia/Jakarta' });
const timeStringWITA = now.toLocaleTimeString('en-US', { timeZone: 'Asia/Makassar' });
const timeStringWIT = now.toLocaleTimeString('en-US', { timeZone: 'Asia/Jayapura' });
document.getElementById('clock-wib').textContent = timeStringWIB + " (WIB)";
document.getElementById('clock-wita').textContent = timeStringWITA + " (WITA)";
document.getElementById('clock-wit').textContent = timeStringWIT + " (WIT)";
}
setInterval(updateClock, 1000);
updateClock();
</script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
`),
);
app.get("/nowa", async (req, res) => {
let q = req.query.number,
regex = /x/g;
if (!q) return res.send("Input Parameter Number Parameter");
if (!q.match(regex))
return res.send('Parameter Number Must Fill With One Letter "x"');
let random = q.match(regex).length,
total = Math.pow(10, random),
array = [];
for (let i = 0; i < total; i++) {
let list = [...i.toString().padStart(random, "0")];
let result = q.replace(regex, () => list.shift()) + "@s.whatsapp.net";
if (await conn.onWhatsApp(result).then((v) => (v[0] || {}).exists)) {
let info = await conn.fetchStatus(result).catch((_) => {});
array.push({ jid: result, exists: true, ...info });
} else {
array.push({ jid: result, exists: false });
}
}
res.json({ result: array });
});
app.listen(PORT, () => {
keepAlive();
console.log("App listened on port", PORT);
});
}
function keepAlive() {
let url = `https://${process.env.REPL_SLUG}.${process.env.REPL_OWNER}.repl.co`;
if (/(\/\/|\.)undefined\./.test(url)) return;
setInterval(() => {
fetch(url).catch(console.log);
}, 30 * 1000);
}
function formatDate(n, locale = "id") {
let d = new Date(n);
return d.toLocaleDateString(locale, { timeZone: "Asia/Jakarta" });
}
export default connect;