Skip to content

Commit f7828b9

Browse files
authored
Merge branch 'IRON-M4N:main' into main
2 parents 1fc0ad4 + e32470b commit f7828b9

5 files changed

Lines changed: 272 additions & 0 deletions

File tree

config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// USE ENVIRONMENT VARIABLES FOR EMAIL AND PASSWORD INSTEAD.
12
module.exports = {
23
PREFIX: process.env.PREFIX || "ASTRO×",
34
EMAIL: process.env.EMAIL || "abrahamdw882@gmail.com",

connect.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { File } = require('megajs');
2+
const fs = require('fs');
3+
4+
var prefix = "IRON-M4N×"; //your prefix same as in config.PREFIX
5+
var output = "./session/"; //path where the creds.json will save
6+
7+
async function saveCreds(id) {
8+
if (!id.startsWith(prefix)) {
9+
throw new Error(`Preix doesn't match check if "${prefix}" is correct`);
10+
}
11+
12+
var url = `https://mega.nz/file/${id.replace(prefix, "")}`;
13+
var file = File.fromURL(url);
14+
await file.loadAttributes();
15+
var pth = output + "creds.json";
16+
if (!fs.existsSync(output)) {
17+
fs.mkdirSync(output, { recursive: true });
18+
}
19+
20+
var data = await file.downloadBuffer();
21+
fs.writeFileSync(pth, data);
22+
}
23+
24+
// https://mega.js.org/docs/1.0/tutorial/downloading

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ const {
1313
const { upload } = require('./mega');
1414
const { Mutex } = require('async-mutex');
1515
const config = require('./config');
16+
const path = require('path');
1617

1718
var app = express();
1819
var port = 3000;
1920
var session;
2021
const msgRetryCounterCache = new NodeCache();
2122
const mutex = new Mutex();
23+
app.use(express.static(path.join(__dirname, 'static')));
2224

2325
async function connector(Num, res) {
2426
var sessionDir = './session';

static/index.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCKTYPE HTML>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="description" content="whatsapp bot pairing code." />
6+
<meta name="keywords" content="pair, whatsapp-bot" />
7+
<meta name="author" content="IRON-M4N" />
8+
<link
9+
rel="icon"
10+
href="https://cdn.ironman.my.id/u/uugBEhB.jpeg"
11+
type="image/jpeg"
12+
/>
13+
<link rel="stylesheet" href="style.css" />
14+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
15+
<title>Phone Pairing</title>
16+
</head>
17+
<body>
18+
<div class="card">
19+
<h2 style="color: white">Enter Phone Number</h2>
20+
<input
21+
type="text"
22+
id="phone"
23+
placeholder="Enter your phone number"
24+
/>
25+
<a onclick="submit()">Submit</a>
26+
<div id="output"></div>
27+
</div>
28+
29+
<script>
30+
function cut(input) {
31+
return input.replace(/\D/g, "");
32+
}
33+
async function submit() {
34+
var inp = document.getElementById("phone").value;
35+
var trim = cut(inp);
36+
37+
try {
38+
var res = await fetch(`/pair?code=${trim}`);
39+
var data = await res.json();
40+
41+
if (res.ok) {
42+
document.getElementById("output").innerHTML = `
43+
<p>Code: ${data.code}</p>
44+
<button class="copy-btn" onclick="copyToClipboard('${data.code}')">Copy to Clipboard</button>
45+
<p id="copy-confirm" class="copy-confirm" style="display: none;">Copied!</p>
46+
`;
47+
} else {
48+
document.getElementById(
49+
"output"
50+
).innerHTML = `<p>Error: fekd up</p>`;
51+
}
52+
} catch (error) {
53+
document.getElementById(
54+
"output"
55+
).innerHTML = `<p>Error: ${error}</p>`;
56+
}
57+
}
58+
59+
function copyToClipboard(text) {
60+
navigator.clipboard
61+
.writeText(text)
62+
.then(() => {
63+
document.getElementById("copy-confirm").style.display =
64+
"block";
65+
})
66+
.catch(err => {
67+
alert(err);
68+
});
69+
}
70+
</script>
71+
</body>
72+
</html>

static/style.css

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
display: flex;
4+
justify-content: center;
5+
align-items: center;
6+
height: 100vh;
7+
margin: 0;
8+
background-image: url("https://cdn.ironman.my.id/i/2iceb4.jpeg");
9+
background-size: cover;
10+
background-position: center;
11+
}
12+
13+
.card {
14+
padding: 20px;
15+
border-radius: 6px;
16+
backdrop-filter: blur(4px);
17+
background: rgba(255, 255, 255, 0.2);
18+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
19+
width: 300px;
20+
text-align: center;
21+
display: flex;
22+
flex-direction: column;
23+
align-items: center;
24+
justify-content: center;
25+
}
26+
27+
input {
28+
width: 80%;
29+
padding: 10px;
30+
margin-bottom: 10px;
31+
border: 1px solid #ccc;
32+
border-radius: 5px;
33+
background-color: rgba(255, 255, 255, 0.5);
34+
text-align: center;
35+
}
36+
37+
a {
38+
position: relative;
39+
display: inline-block;
40+
padding: 15px 35px;
41+
margin: 6px 0;
42+
color: #fff;
43+
text-decoration: none;
44+
text-transform: uppercase;
45+
transition: 0.5s;
46+
letter-spacing: 4px;
47+
overflow: hidden;
48+
margin-right: 50px;
49+
margin-left: 50px;
50+
}
51+
52+
a:hover {
53+
background: #03e9f4;
54+
color: #050801;
55+
box-shadow:
56+
0 0 5px #03e9f4,
57+
0 0 25px #03e9f4,
58+
0 0 50px #03e9f4,
59+
0 0 200px #03e9f4;
60+
-webkit-box-reflect: below 1px linear-gradient(transparent, #0005);
61+
}
62+
63+
a span {
64+
position: absolute;
65+
display: block;
66+
}
67+
68+
a span:nth-child(1) {
69+
top: 0;
70+
left: 0;
71+
width: 100%;
72+
height: 8px;
73+
background: linear-gradient(90deg, transparent, #03e9f4);
74+
animation: animate1 2s linear infinite;
75+
}
76+
77+
@keyframes animate1 {
78+
0% {
79+
left: -100%;
80+
}
81+
82+
50%,
83+
100% {
84+
left: 100%;
85+
}
86+
}
87+
88+
a span:nth-child(2) {
89+
top: -100%;
90+
right: 0;
91+
width: 2px;
92+
height: 100%;
93+
background: linear-gradient(180deg, transparent, #03e9f4);
94+
animation: animate2 1s linear infinite;
95+
animation-delay: 0.25s;
96+
}
97+
98+
@keyframes animate2 {
99+
0% {
100+
top: -100%;
101+
}
102+
103+
50%,
104+
100% {
105+
top: 100%;
106+
}
107+
}
108+
109+
a span:nth-child(3) {
110+
bottom: 0;
111+
right: 0;
112+
width: 100%;
113+
height: 2px;
114+
background: linear-gradient(270deg, transparent, #03e9f4);
115+
animation: animate3 1s linear infinite;
116+
animation-delay: 0.5s;
117+
}
118+
119+
@keyframes animate3 {
120+
0% {
121+
right: -100%;
122+
}
123+
124+
50%,
125+
100% {
126+
right: 100%;
127+
}
128+
}
129+
130+
a span:nth-child(4) {
131+
bottom: -100%;
132+
left: 0;
133+
width: 2px;
134+
height: 100%;
135+
background: linear-gradient(360deg, transparent, #03e9f4);
136+
animation: animate4 1s linear infinite;
137+
animation-delay: 0.75s;
138+
}
139+
140+
@keyframes animate4 {
141+
0% {
142+
bottom: -100%;
143+
}
144+
145+
50%,
146+
100% {
147+
bottom: 100%;
148+
}
149+
}
150+
151+
#output {
152+
margin-top: 20px;
153+
color: white;
154+
}
155+
156+
#phone {
157+
color: black;
158+
}
159+
160+
.copy-btn {
161+
margin-top: 10px;
162+
padding: 5px 10px;
163+
background-color: #28a745;
164+
color: white;
165+
border: none;
166+
cursor: pointer;
167+
border-radius: 5px;
168+
}
169+
170+
.copy-confirm {
171+
margin-top: 10px;
172+
color: #28a745;
173+
}

0 commit comments

Comments
 (0)