This repository was archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
126 lines (107 loc) · 2.78 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cumshot</title>
<style>
@font-face {
font-family: Whitney;
font-weight: 500;
src: url(/Whitney500.woff) format("woff");
}
@font-face {
font-family: Whitney;
font-weight: 600;
src: url(/Whitney600.woff) format("woff");
}
body {
font-family: Whitney, sans-serif;
font-weight: 500;
display: flex;
flex-direction: column;
align-items: center;
margin: 0;
height: 100vh;
justify-content: center;
text-align: center;
background: #36393f;
color: white;
}
h1 {
font-weight: 600;
font-size: 2.5rem;
}
br {
margin-bottom: 1rem;
}
a {
color: #41adff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<header>
<h1>Cumshot</h1>
<h2>
A basic theme and repo sender for
<a href="https://github.com/yellowsink/cc-plugins">Cumstain</a>,
kinda like send.cumcord.com.
</h2>
</header>
<main>
<!--suppress HtmlFormInputWithoutLabel -->
<input id="url" type="text" placeholder="Theme / Repo URL" />
<br />
<span id="status"></span>
<br />
<button onclick="genTheme()">Generate (Theme)</button>
<button onclick="genRepo()">Generate (Repo)</button>
</main>
<script type="module">
import cummunicate from "https://cdn.esm.sh/@cumjar/cummunicate";
// DOM CODE
const urlInput = document.getElementById("url");
const statusSpan = document.getElementById("status");
const resetSoon = () =>
setTimeout(() => (statusSpan.innerText = ""), 5000);
// GENERATION CODE
function gen(prepend) {
const url = new URL(location.href);
url.hash = prepend + urlInput.value;
navigator.clipboard.writeText(url.href);
statusSpan.innerText = "Copied URL to clipboard!";
resetSoon();
}
window.genTheme = () => gen("T_");
window.genRepo = () => gen("R_");
// SENDING CODE
const isTheme = location.hash.startsWith("#T");
if (isTheme || location.hash.startsWith("#R")) {
statusSpan.innerText = "Talking to Cumcord, please wait...";
document
.querySelectorAll("button, br")
.forEach((e) => e.remove());
urlInput.remove();
const res = isTheme
? await cummunicate("ysink_stain_addtheme", {
url: location.hash.slice(3),
})
: await cummunicate("ysink_stain_addrepo", {
repo: location.hash.slice(3),
});
function resToString([port, msg]) {
const resolvedMsg = msg?.message?.message ?? msg?.message;
const niceMsg = resolvedMsg ? ": " + resolvedMsg : "";
return `[${port}] ${msg?.status}${niceMsg}`;
}
statusSpan.innerText =
res.length === 0
? "Could not connect"
: res.map(resToString).join("\n");
}
</script>
</body>
</html>