bigbossmonster commited on
Commit
5a3ff58
·
verified ·
1 Parent(s): d9ff884

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +202 -17
index.html CHANGED
@@ -1,19 +1,204 @@
1
- <!doctype html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
  <html>
3
+ <head>
4
+ <title>URL Generator</title>
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ margin: 20px;
9
+ max-width: 600px;
10
+ margin-left: auto;
11
+ margin-right: auto;
12
+ }
13
+
14
+ h1 {
15
+ color: #1a237e;
16
+ text-align: center;
17
+ }
18
+
19
+ label {
20
+ display: block;
21
+ margin-top: 10px;
22
+ }
23
+
24
+ input[type="text"] {
25
+ width: 100%;
26
+ padding: 5px;
27
+ font-size: 16px;
28
+ border: 1px solid #ccc;
29
+ border-radius: 4px;
30
+ box-sizing: border-box;
31
+ }
32
+
33
+ button {
34
+ margin-top: 20px;
35
+ padding: 10px 20px;
36
+ background-color: #1a237e;
37
+ color: #fff;
38
+ border: none;
39
+ border-radius: 4px;
40
+ font-size: 16px;
41
+ cursor: pointer;
42
+ }
43
+
44
+ button.loading {
45
+ cursor: progress;
46
+ }
47
+
48
+ button:hover {
49
+ background-color: #3949ab;
50
+ }
51
+
52
+ footer {
53
+ text-align: center;
54
+ }
55
+
56
+ #outputBox {
57
+ margin-top: 20px;
58
+ font-size: 18px;
59
+ background-color: lightgray;
60
+ padding: 10px;
61
+ text-align: center;
62
+ border-radius: 10px;
63
+
64
+
65
+ }
66
+
67
+ #outputBox a {
68
+ color: #000000;
69
+ text-decoration: none;
70
+ word-break: break-all;
71
+ text-align: center;
72
+ }
73
+
74
+ #outputBox a:hover {
75
+ text-decoration: underline;
76
+ text-align: center;
77
+ }
78
+
79
+ #loadingIndicator {
80
+ text-align: center;
81
+ margin-top: 20px;
82
+ }
83
+
84
+ #buttonContainer {
85
+ text-align: center;
86
+ }
87
+
88
+ #noteContainer {
89
+ text-align: left;
90
+ font-size: 14px;
91
+ background-color: lightgray;
92
+ border: 1px solid #ccc;
93
+ border-radius: 10px;
94
+ color: #1a237e;
95
+ margin-bottom: 2px;
96
+ }
97
+
98
+ ul {
99
+ list-style: disc;
100
+ margin: 20px;
101
+ }
102
+ </style>
103
+ <script>
104
+ // Check Local Storage for a remembered API key and populate the input field if found
105
+ window.onload = function() {
106
+ const rememberedApiKey = localStorage.getItem("rememberedApiKey");
107
+ const apiKeyInput = document.getElementById("apiKey");
108
+
109
+ if (rememberedApiKey) {
110
+ apiKeyInput.value = rememberedApiKey;
111
+ document.getElementById("rememberApi").checked = true;
112
+ }
113
+ };
114
+
115
+ function saveApiKeyToLocalStorage(apiKey) {
116
+ if (document.getElementById("rememberApi").checked) {
117
+ localStorage.setItem("rememberedApiKey", apiKey);
118
+ } else {
119
+ localStorage.removeItem("rememberedApiKey");
120
+ }
121
+ }
122
+
123
+ function generateCloneLink() {
124
+ const apiKey = document.getElementById('apiKey').value;
125
+ const inputUrl = document.getElementById('inputUrl').value;
126
+ const domain = extractDomain(inputUrl);
127
+ const fileCode = extractFileCode(inputUrl, domain);
128
+
129
+ const cloneButton = document.getElementById('cloneButton');
130
+ cloneButton.classList.add('loading');
131
+ cloneButton.innerHTML = 'Generating Link...';
132
+
133
+ setTimeout(function() {
134
+ const cloneLink = `https://${domain}/api/file/clone?key=${apiKey}&file_code=${fileCode}`;
135
+ document.getElementById('outputBox').innerHTML = `<a href="${cloneLink}" target="_blank">Generated Clone Link</a>`;
136
+ cloneButton.classList.remove('loading');
137
+ cloneButton.innerHTML = 'Generate Clone Link';
138
+ document.getElementById('directButton').innerHTML = 'Generate Direct Link';
139
+
140
+ saveApiKeyToLocalStorage(apiKey);
141
+ }, 1500);
142
+ }
143
+
144
+ function generateDirectLink() {
145
+ const apiKey = document.getElementById('apiKey').value;
146
+ const inputUrl = document.getElementById('inputUrl').value;
147
+ const domain = extractDomain(inputUrl);
148
+ const fileCode = extractFileCode(inputUrl, domain);
149
+
150
+ const directButton = document.getElementById('directButton');
151
+ directButton.classList.add('loading');
152
+ directButton.innerHTML = 'Generating Link...';
153
+
154
+ setTimeout(function() {
155
+ const directLink = `https://${domain}/api/file/direct_link?key=${apiKey}&file_code=${fileCode}`;
156
+ document.getElementById('outputBox').innerHTML = `<a href="${directLink}" target="_blank">Generated Direct Link</a>`;
157
+ directButton.classList.remove('loading');
158
+ directButton.innerHTML = 'Generate Direct Link';
159
+ document.getElementById('cloneButton').innerHTML = 'Generate Clone Link';
160
+
161
+ saveApiKeyToLocalStorage(apiKey);
162
+ }, 1500);
163
+ }
164
+
165
+ function extractFileCode(url, domain) {
166
+ const parts = url.split('/');
167
+ return parts[parts.indexOf(domain) + 1];
168
+ }
169
+
170
+ function extractDomain(url) {
171
+ const urlParts = url.split('/');
172
+ return urlParts[2];
173
+ }
174
+ </script>
175
+ </head>
176
+ <body>
177
+ <h1>Katfile Download Generator</h1>
178
+
179
+ <div id="noteContainer">
180
+ <ul>
181
+ <li><strong>1 Clone the link</strong></li>
182
+ <li><strong>2 Generate Direct link and download</strong></li>
183
+ </ul>
184
+ </div>
185
+
186
+ <label for="inputUrl">Input URL:</label>
187
+ <input type="text" id="inputUrl" placeholder="https://katfile.com/339r8oubnzpd">
188
+ <label for="apiKey">API Key:</label>
189
+ <input type="text" id="apiKey" placeholder="699996yph6h88a7rc6c1g8">
190
+ <label for="rememberApi">Remember Me</label>
191
+ <input type="checkbox" id="rememberApi" checked>
192
+
193
+ <div id="buttonContainer">
194
+ <button id="cloneButton" onclick="generateCloneLink()">Generate Clone Link</button>
195
+ <button id="directButton" onclick="generateDirectLink()">Generate Direct Link</button>
196
+ </div>
197
+ <div id="loadingIndicator"></div>
198
+ <div id="outputBox"></div>
199
+
200
+ <footer>
201
+ <p>Created by Codemaster &copy; 2023</p>
202
+ </footer>
203
+ </body>
204
  </html>