fork/chhoto-url

git clone https://git.julia.blue/fork/chhoto-url

Julia RyanAdd support for arbitrary unicode82d9903

unicode
14.8 KiB443 linesraw
1<!-- SPDX-FileCopyrightText: 2023-2026 Sayantan Santra <sayantan.santra689@gmail.com> -->
2<!-- SPDX-License-Identifier: MIT -->
3
4<!doctype html>
5<html lang="en">
6  <head>
7    <meta charset="UTF-8" />
8    <meta
9      name="viewport"
10      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
11    />
12    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
13
14    <title>Chhoto URL</title>
15
16    <meta
17      name="description"
18      content="A simple selfhosted URL shortener with no unnecessary features."
19    />
20    <meta property="og:title" content="Chhoto URL" />
21    <meta
22      property="og:description"
23      content="A simple selfhosted URL shortener with no unnecessary features."
24    />
25    <meta
26      property="og:image"
27      content="https://chhoto.link/static/assets/banner.png"
28    />
29
30    <meta
31      name="keywords"
32      content="url shortener, link shortener, self hosted, open source"
33    />
34    <link
35      rel="icon"
36      type="image/x-icon"
37      href="assets/favicon.ico"
38      sizes="any"
39    />
40    <link rel="icon" type="image/svg+xml" href="assets/favicon.svg" />
41    <link
42      rel="icon"
43      type="image/png"
44      href="assets/favicon-32.png"
45      sizes="32x32"
46    />
47    <link
48      rel="icon"
49      type="image/png"
50      href="assets/favicon-196.png"
51      sizes="196x196"
52    />
53
54    <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
55    <link rel="preconnect" href="https://fonts.googleapis.com" />
56    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
57    <script
58      src="https://cdn.jsdelivr.net/gh/sintan1729/qrcodejs@0.1.0/qrcode.min.js"
59      async
60    ></script>
61    <script
62      src="https://cdn.jsdelivr.net/npm/punycode-okam@1.4.1/punycode.min.js"
63      async
64    ></script>
65    <script src="static/script.js" defer></script>
66    <link
67      rel="stylesheet"
68      href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css"
69      integrity="sha384-X38yfunGUhNzHpBaEBsWLO+A0HDYOQi8ufWDkZ0k9e0eXz/tH3II7uKZ9msv++Ls"
70      crossorigin="anonymous"
71    />
72    <link
73      rel="stylesheet"
74      type="text/css"
75      target="_blank"
76      href="static/styles.css"
77    />
78  </head>
79
80  <body>
81    <div class="container" id="container">
82      <form class="pure-form pure-form-aligned" name="new-url-form">
83        <fieldset>
84          <legend id="logo">
85            <img src="assets/favicon.svg" alt="chhoto-url-logo" />
86            <span> Chhoto URL</span>
87          </legend>
88          <div class="pure-control-group">
89            <label for="longUrl">Long URL</label>
90            <input
91              class="chhoto-input"
92              type="url"
93              name="longUrl"
94              id="longUrl"
95              placeholder="Please enter a valid URL"
96              required
97            />
98          </div>
99          <div class="pure-control-group">
100            <label for="shortUrl">Short URL (optional)</label>
101            <input
102              class="chhoto-input"
103              type="text"
104              name="shortUrl"
105              id="shortUrl"
106              placeholder="Lots of unicode characters are allowed"
107              title="Lots of unicode characters are allowed"
108              autocapitalize="off"
109            />
110          </div>
111          <div class="pure-form-section">
112            <details class="chhoto-input" id="optionsSection">
113              <summary class="pure-controls">More options</summary>
114              <div class="pure-control-group">
115                <label for="expiryDelay">Expiry</label>
116                <select
117                  class="chhoto-select"
118                  name="expiryDelay"
119                  id="expiryDelay"
120                >
121                  <option value="0">Never</option>
122                  <option value="600">10 Minutes</option>
123                  <option value="1800">30 Minutes</option>
124                  <option value="3600">1 Hour</option>
125                  <option value="43200">12 Hours</option>
126                  <option value="86400">1 Day</option>
127                  <option value="604800">1 Week</option>
128                  <option value="2592000">1 Month</option>
129                  <option value="7776000">3 Months</option>
130                  <option value="15552000">6 Months</option>
131                  <option value="31536000">1 Year</option>
132                </select>
133              </div>
134              <div class="pure-control-group">
135                <label for="notes">Notes</label>
136                <input
137                  class="chhoto-input"
138                  type="text"
139                  name="notes"
140                  id="notes"
141                  placeholder="Notes for the link, used for filtering"
142                  pattern="[\x20-\x7E]*"
143                  title="Only printable ASCII characters are allowed"
144                  autocapitalize="off"
145                />
146              </div>
147            </details>
148          </div>
149          <div class="pure-controls" id="controls">
150            <button class="chhoto-button pure-button pure-button-primary">
151              Shorten!
152            </button>
153            <div id="alert-box">&nbsp;</div>
154          </div>
155        </fieldset>
156      </form>
157
158      <p id="loading-text">Loading links table...</p>
159      <table class="chhoto-table pure-table" id="table-box" hidden>
160        <caption>
161          <span name="label">Active links</span>
162          <span id="pageControls" hidden="true">
163            <button
164              id="prevPageBtn"
165              class="svg-button"
166              title="Previous Page"
167            ></button>
168            <button
169              id="nextPageBtn"
170              class="svg-button"
171              title="Next Page"
172            ></button>
173          </span>
174          <div id="filter-div">
175            <form class="pure-form" name="filter-form">
176              <fieldset>
177                <input
178                  class="chhoto-input"
179                  type="text"
180                  name="filter"
181                  id="filterText"
182                  placeholder="Filter shortlinks"
183                  pattern="^$|(?=(?:.*[A-Za-z0-9]){3,})[\x20-\x7E]+$"
184                  title="Only printable ASCII is allowed, min length 3 chars"
185                  autocapitalize="off"
186                />
187                <button class="chhoto-button pure-button pure-button-primary">
188                  Filter
189                </button>
190              </fieldset>
191            </form>
192          </div>
193        </caption>
194        <br />
195        <thead>
196          <tr>
197            <th name="numColumn">#</th>
198            <th id="short-url-header">Short URL</th>
199            <th>Long URL</th>
200            <th name="hitsColumn">Hits</th>
201            <th name="expiryColumn">Expiry</th>
202            <th name="actions">Actions</th>
203          </tr>
204        </thead>
205        <tbody id="url-table">
206          <!-- The links would be inserted here -->
207        </tbody>
208      </table>
209    </div>
210
211    <div name="links-div">
212      <button class="linkButton" id="admin-button" hidden>
213        <!-- https://svgicons.com/icon/109760/account -->
214        <svg
215          xmlns="http://www.w3.org/2000/svg"
216          width="24"
217          height="24"
218          viewBox="0 0 24 24"
219        >
220          <title>Account SVG Icon</title>
221          <g
222            fill="none"
223            stroke="currentColor"
224            stroke-dasharray="28"
225            stroke-linecap="round"
226            stroke-linejoin="round"
227            stroke-width="2"
228          >
229            <path
230              d="M4 21v-1c0 -3.31 2.69 -6 6 -6h4c3.31 0 6 2.69 6 6v1"
231            ></path>
232            <path
233              d="M12 11c-2.21 0 -4 -1.79 -4 -4c0 -2.21 1.79 -4 4 -4c2.21 0 4 1.79 4 4c0 2.21 -1.79 4 -4 4Z"
234            ></path>
235          </g>
236        </svg>
237        <span>login</span>
238      </button>
239      <!-- https://svgicons.com/icon/13641/bxl-github -->
240      <a
241        id="version-number"
242        class="linkButton"
243        href="https://github.com/SinTan1729/chhoto-url"
244        target="_blank"
245        rel="noopener noreferrer"
246        hidden
247      >
248        <svg
249          xmlns="http://www.w3.org/2000/svg"
250          width="24"
251          height="24"
252          viewBox="0 0 24 24"
253        >
254          <path
255            fill-rule="evenodd"
256            clip-rule="evenodd"
257            d="M12.026 2c-5.509 0-9.974 4.465-9.974 9.974c0 4.406 2.857 8.145 6.821 9.465
258            c.499.09.679-.217.679-.481c0-.237-.008-.865-.011-1.696c-2.775.602-3.361-1.338-3.361-1.338
259            c-.452-1.152-1.107-1.459-1.107-1.459c-.905-.619.069-.605.069-.605c1.002.07 1.527 1.028 1.527 1.028
260            c.89 1.524 2.336 1.084 2.902.829c.091-.645.351-1.085.635-1.334c-2.214-.251-4.542-1.107-4.542-4.93
261            c0-1.087.389-1.979 1.024-2.675c-.101-.253-.446-1.268.099-2.64c0 0 .837-.269 2.742 1.021
262            a9.582 9.582 0 0 1 2.496-.336a9.554 9.554 0 0 1 2.496.336c1.906-1.291 2.742-1.021 2.742-1.021
263            c.545 1.372.203 2.387.099 2.64c.64.696 1.024 1.587 1.024 2.675c0 3.833-2.33 4.675-4.552 4.922
264            c.355.308.675.916.675 1.846c0 1.334-.012 2.41-.012 2.737c0 .267.178.577.687.479
265            C19.146 20.115 22 16.379 22 11.974C22 6.465 17.535 2 12.026 2z"
266            fill="currentColor"
267          />
268        </svg>
269        <span>Source Code</span>
270      </a>
271    </div>
272
273    <dialog id="login-dialog" closedby="none" class="chhoto-dialog">
274      <form class="pure-form" name="login-form">
275        <p>Please enter password to access this website</p>
276        <div>
277          <input class="chhoto-input" type="password" id="password" />
278          <button
279            type="button"
280            id="password-eye-button"
281            title="Toggle Password Visibility"
282          >
283            &#x1F441;
284          </button>
285        </div>
286        <div>
287          <label for="login-checkbox">
288            <input type="checkbox" id="login-checkbox" />
289            Remember me
290          </label>
291        </div>
292        <button
293          class="chhoto-button pure-button pure-button-primary"
294          value="default"
295        >
296          Log in
297        </button>
298        <p id="wrong-pass" hidden>Wrong password!</p>
299      </form>
300    </dialog>
301
302    <dialog id="edit-dialog" class="chhoto-dialog">
303      <form class="pure-form pure-form-aligned" name="edit-form">
304        <p>
305          Enter new details for <span id="edit-link">placeholder</span>. <br />
306          Be careful. It cannot be undone.
307        </p>
308        <fieldset>
309          <div class="pure-control-group">
310            <label for="edited-url">Long URL</label>
311            <input class="chhoto-input" type="url" id="edited-url" />
312          </div>
313          <div class="pure-control-group">
314            <label for="edited-notes">Notes</label>
315            <input
316              class="chhoto-input"
317              type="text"
318              pattern="[\x20-\x7E]*"
319              id="edited-notes"
320            />
321          </div>
322          <div class="pure-control-group">
323            <label for="edited-expiry">Expiry</label>
324            <input
325              class="chhoto-input"
326              type="datetime-local"
327              step="1"
328              id="edited-expiry"
329            />
330          </div>
331          <label for="edit-checkbox">
332            <input type="checkbox" id="edit-checkbox" />
333            Reset hit count
334          </label>
335          <div id="edit-buttons">
336            <button
337              class="chhoto-button pure-button pure-button-primary"
338              id="edit-cancel-button"
339              type="button"
340            >
341              Cancel
342            </button>
343            <button
344              class="chhoto-button pure-button pure-button-primary"
345              value="default"
346            >
347              Submit
348            </button>
349          </div>
350        </fieldset>
351      </form>
352    </dialog>
353
354    <dialog id="info-dialog" closedby="any" class="chhoto-dialog">
355      <!-- https://svgicons.com/icon/13141/cross-filled -->
356      <button class="dialog-close-button" id="info-close-button">
357        <svg
358          xmlns="http://www.w3.org/2000/svg"
359          width="24"
360          height="24"
361          viewBox="0 0 24 24"
362        >
363          <g fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">
364            <path
365              d="M5.47 5.47a.75.75 0 0 1 1.06 0l12 12a.75.75 0 1 1-1.06 1.06l-12-12a.75.75 0 0 1 0-1.06"
366            />
367            <path
368              d="M18.53 5.47a.75.75 0 0 1 0 1.06l-12 12a.75.75 0 0 1-1.06-1.06l12-12a.75.75 0 0 1 1.06 0"
369            />
370          </g>
371        </svg>
372      </button>
373      <div id="info-div">
374        <table class="pure-table" id="info-table">
375          <tbody>
376            <tr>
377              <td class="label">Short:</td>
378              <td id="info-short"></td>
379            </tr>
380            <tr>
381              <td class="label">Long:</td>
382              <td id="info-long"></td>
383            </tr>
384            <tr>
385              <td class="label">Hits:</td>
386              <td id="info-hits"></td>
387            </tr>
388            <tr>
389              <td class="label">Expiry:</td>
390              <td id="info-expiry"></td>
391            </tr>
392            <tr>
393              <td class="label">Notes:</td>
394              <td id="info-notes"></td>
395            </tr>
396          </tbody>
397        </table>
398      </div>
399    </dialog>
400
401    <dialog id="qr-code-dialog" closedby="any" class="chhoto-dialog">
402      <!-- https://svgicons.com/icon/10667/download-solid -->
403      <a class="dialog-close-button" id="qr-download-button" href="">
404        <svg
405          xmlns="http://www.w3.org/2000/svg"
406          width="24"
407          height="24"
408          viewBox="0 0 24 24"
409        >
410          <path
411            fill="currentColor"
412            fill-rule="evenodd"
413            d="M5 16.25a.75.75 0 0 1 .75.75v2c0 .138.112.25.25.25h12a.25.25 0 0 0 .25-.25v-2a.75.75 0 0 1 1.5 0v2A1.75 1.75 0 0 1 18 20.75H6A1.75 1.75 0 0 1 4.25 19v-2a.75.75 0 0 1 .75-.75"
414            clip-rule="evenodd"
415          />
416          <path
417            fill="currentColor"
418            d="M10.738 3.75a.992.992 0 0 0-.988.906a36.618 36.618 0 0 0-.082 5.27c-.247.013-.493.03-.74.047l-1.49.109a.76.76 0 0 0-.585 1.167a15.555 15.555 0 0 0 4.032 4.258l.597.429a.888.888 0 0 0 1.036 0l.597-.429a15.556 15.556 0 0 0 4.032-4.258a.76.76 0 0 0-.585-1.167l-1.49-.109a42.274 42.274 0 0 0-.74-.047a36.62 36.62 0 0 0-.081-5.27a.992.992 0 0 0-.989-.906z"
419          />
420        </svg>
421      </a>
422      <!-- https://svgicons.com/icon/13141/cross-filled -->
423      <button class="dialog-close-button" id="qr-close-button">
424        <svg
425          xmlns="http://www.w3.org/2000/svg"
426          width="24"
427          height="24"
428          viewBox="0 0 24 24"
429        >
430          <g fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">
431            <path
432              d="M5.47 5.47a.75.75 0 0 1 1.06 0l12 12a.75.75 0 1 1-1.06 1.06l-12-12a.75.75 0 0 1 0-1.06"
433            />
434            <path
435              d="M18.53 5.47a.75.75 0 0 1 0 1.06l-12 12a.75.75 0 0 1-1.06-1.06l12-12a.75.75 0 0 1 1.06 0"
436            />
437          </g>
438        </svg>
439      </button>
440      <div id="qr-code"></div>
441    </dialog>
442  </body>
443</html>