Compare commits
	
		
			28 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 092762011d | |||
| 
						
						
							
						
						ea6bd074a1
	
				 | 
					
					
						|||
| 
						
						
							
						
						59a411bab5
	
				 | 
					
					
						|||
| 
						
						
							
						
						3a82caad95
	
				 | 
					
					
						|||
| 
						
						
							
						
						19e08bc52c
	
				 | 
					
					
						|||
| 
						
						
							
						
						515370eac7
	
				 | 
					
					
						|||
| 
						
						
							
						
						0c629e2416
	
				 | 
					
					
						|||
| 
						
						
							
						
						c5c8514bab
	
				 | 
					
					
						|||
| 
						
						
							
						
						cc5cb2782f
	
				 | 
					
					
						|||
| 
						
						
							
						
						a50a28622a
	
				 | 
					
					
						|||
| 
						
						
							
						
						5329c4e121
	
				 | 
					
					
						|||
| 912e0b70a2 | |||
| 
						
						
							
						
						7da22287ff
	
				 | 
					
					
						|||
| 5f81f55987 | |||
| 
						
						
							
						
						8bcab4661b
	
				 | 
					
					
						|||
| 
						
						
							
						
						f2ec82762e
	
				 | 
					
					
						|||
| 
						
						
							
						
						0327bdc7a0
	
				 | 
					
					
						|||
| 
						
						
							
						
						b3b6731c09
	
				 | 
					
					
						|||
| 
						
						
							
						
						36de0a3eb3
	
				 | 
					
					
						|||
| 
						
						
							
						
						839c658075
	
				 | 
					
					
						|||
| 
						
						
							
						
						12aa8eeb3e
	
				 | 
					
					
						|||
| 
						
						
							
						
						b655ff2372
	
				 | 
					
					
						|||
| 58adc6511a | |||
| 
						
						
							
						
						29c4b0013a
	
				 | 
					
					
						|||
| 
						
						
							
						
						8ed16adeff
	
				 | 
					
					
						|||
| 09219ff798 | |||
| 
						
						
							
						
						d9cd552c89
	
				 | 
					
					
						|||
| 
						
						
							
						
						2b82f8798c
	
				 | 
					
					
						
							
								
								
									
										53
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -2,8 +2,61 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
					All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.3.2](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.3.1...0.3.2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Added code to createurl component [`59a411b`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/59a411bab5462710109767dfccb90a0f0459b2dd)
 | 
				
			||||||
 | 
					- More basics for the shorturl creation module [`515370e`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/515370eac7ff5f018cae5ec790ccc8e90c025718)
 | 
				
			||||||
 | 
					- added display logic for the basic elements [`cc5cb27`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/cc5cb2782f20c4a7ab480132217463a0f4a9a956)
 | 
				
			||||||
 | 
					- Added basics for error handling on url creation [`c5c8514`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/c5c8514bab9615c90de8b5fb1f9a5925f752b28b)
 | 
				
			||||||
 | 
					- Basics for the new url creation component [`5329c4e`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/5329c4e1219a1cd3c8f1b5c0bdf02cb22330fd72)
 | 
				
			||||||
 | 
					- Added adding url functionality to apiclient [`0c629e2`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/0c629e241668e1809d9616e9f7cb6ba804ad4c53)
 | 
				
			||||||
 | 
					- Tmp removed the createurl component from index until it works [`ea6bd07`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/ea6bd074a12ed4a43d30b1e9bacbe12bc6f97356)
 | 
				
			||||||
 | 
					- Now only using odit registry hosted images to speed up the build [`3a82caa`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/3a82caad95eb99dac71e01dc02e3fdafe17ef6da)
 | 
				
			||||||
 | 
					- Switched to our own brotli nginx build [`19e08bc`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/19e08bc52cc6a9c73e4b2d42d612d3ea7401f108)
 | 
				
			||||||
 | 
					- Added url creation component to dashboard [`a50a286`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/a50a28622ac4904e611a0bdaa3f2997192bf75ca)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.3.1](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.3.0...0.3.1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 21 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.3.1 [`912e0b7`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/912e0b70a2bcf5100901d3d6faf9806238ed317f)
 | 
				
			||||||
 | 
					- Removed length check [`7da2228`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/7da22287ff00b9403d2458b486c5289e7b389415)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.3.0](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.4...0.3.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 21 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Added new "visits" page [`b655ff2`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/b655ff2372655d1fb7fa6cea8a10b193805f315c)
 | 
				
			||||||
 | 
					- Added visits overview to sidebar [`36de0a3`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/36de0a3eb305317c829bace18a9661308c8cf0f3)
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.3.0 [`5f81f55`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/5f81f559876328f57b947e7c19d236e45fbf25c0)
 | 
				
			||||||
 | 
					- Added apiclient method [`839c658`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/839c65807524646c1c6a677f10042988fb2bccdf)
 | 
				
			||||||
 | 
					- Added safeguard for random updates [`8bcab46`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/8bcab4661bec3c748cc65078e5187d936be9cdf9)
 | 
				
			||||||
 | 
					- Fixed link to details [`f2ec827`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/f2ec82762e9bc107f29952709555bc3d893def49)
 | 
				
			||||||
 | 
					- Enabled y scrolling (whyever that was disabled...) [`0327bdc`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/0327bdc7a0cefda343168c911faa51cd42271673)
 | 
				
			||||||
 | 
					- Fixed typo in visits query [`b3b6731`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/b3b6731c09d47fff9df96903c75914e7042e28c5)
 | 
				
			||||||
 | 
					- Missing copy-paste :D [`12aa8ee`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/12aa8eeb3e345ccee10bdb6abca93c5fd84a071a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.2.4](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.3...0.2.4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 21 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.2.4 [`58adc65`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/58adc6511aa1ee573abcf21a176131bf10354747)
 | 
				
			||||||
 | 
					- Fixed logout redirect [`29c4b00`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/29c4b0013abb0466f59239ae3717f60216cecc1f)
 | 
				
			||||||
 | 
					- Fixed details link [`8ed16ad`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/8ed16adeffed9e1368615caf6022d8a376337b8a)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### [0.2.3](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.2...0.2.3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 21 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.2.3 [`09219ff`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/09219ff7987e6088245d8a871e3a5aaca3f855fd)
 | 
				
			||||||
 | 
					- Updated login text color [`d9cd552`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/d9cd552c89415625c22c1adcb892c5a789823ce9)
 | 
				
			||||||
 | 
					- Fixed login replace [`2b82f87`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/2b82f8798cd23f15dc48a5375dc1f5ad1a3abbfd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### [0.2.2](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.1...0.2.2)
 | 
					#### [0.2.2](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.1...0.2.2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> 21 August 2021
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 🚀RELEASE 0.2.2 [`d971513`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/d9715139cf0c5583cb1db43953c34e3293345f68)
 | 
				
			||||||
- Fixxed routing links [`c731323`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/c731323b0bd1b757297b601e7bbc3f5034c04e9c)
 | 
					- Fixxed routing links [`c731323`](https://git.odit.services/kauft.es/linkylinky-dashboard/commit/c731323b0bd1b757297b601e7bbc3f5034c04e9c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### [0.2.1](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.0...0.2.1)
 | 
					#### [0.2.1](https://git.odit.services/kauft.es/linkylinky-dashboard/compare/0.2.0...0.2.1)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,10 @@
 | 
				
			|||||||
FROM library/node:16-alpine
 | 
					FROM registry.odit.services/hub/library/node:16-alpine
 | 
				
			||||||
WORKDIR /app
 | 
					WORKDIR /app
 | 
				
			||||||
COPY package.json ./
 | 
					COPY package.json ./
 | 
				
			||||||
RUN yarn
 | 
					RUN yarn
 | 
				
			||||||
COPY ./ ./
 | 
					COPY ./ ./
 | 
				
			||||||
RUN yarn build
 | 
					RUN yarn build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM fholzer/nginx-brotli:v1.19.1
 | 
					FROM registry.odit.services/library/nginx-brotli:3.13
 | 
				
			||||||
COPY --from=0 /app/build /usr/share/nginx/html
 | 
					COPY --from=0 /app/build /usr/share/nginx/html
 | 
				
			||||||
COPY ./nginx.conf /etc/nginx/nginx.conf
 | 
					COPY ./nginx.conf /etc/nginx/nginx.conf
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "@odit/linkylinky-dashboard",
 | 
						"name": "@odit/linkylinky-dashboard",
 | 
				
			||||||
	"version": "0.2.2",
 | 
						"version": "0.3.2",
 | 
				
			||||||
	"scripts": {
 | 
						"scripts": {
 | 
				
			||||||
		"dev": "svelte-kit dev",
 | 
							"dev": "svelte-kit dev",
 | 
				
			||||||
		"build": "svelte-kit build",
 | 
							"build": "svelte-kit build",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					import { data } from 'autoprefixer';
 | 
				
			||||||
import axios from 'axios';
 | 
					import axios from 'axios';
 | 
				
			||||||
import UserStore from './UserStore';
 | 
					import UserStore from './UserStore';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,6 +63,39 @@ export default class Apiclient {
 | 
				
			|||||||
		).data;
 | 
							).data;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * API-Getter for the linkylinky api all vists endpoint (needs auth)
 | 
				
			||||||
 | 
						 * @returns Url visit details for each visit in an array of objects.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						static async getVisits() {
 | 
				
			||||||
 | 
							return (
 | 
				
			||||||
 | 
								await axios.get(`https://kauft.es/api/visits`, {
 | 
				
			||||||
 | 
									headers: { Authorization: `Bearer ${UserStore.state.token}` }
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							).data;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Create a new shorturl via the api
 | 
				
			||||||
 | 
						 * @param {*} target The target (rediction) url for the new shorturl.
 | 
				
			||||||
 | 
						 * @param {*} shortcode A custom shortcode (if needed)
 | 
				
			||||||
 | 
						 * @returns The response data/error
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						 static async createUrl(target, shortcode) {
 | 
				
			||||||
 | 
							const res = (
 | 
				
			||||||
 | 
								await axios.post(`https://kauft.es/api`, {
 | 
				
			||||||
 | 
									target,
 | 
				
			||||||
 | 
									shortcode
 | 
				
			||||||
 | 
								}, {
 | 
				
			||||||
 | 
									validateStatus: null
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
 | 
							return {
 | 
				
			||||||
 | 
								status: res.status,
 | 
				
			||||||
 | 
								data: res.data
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * API-Delet for the linkylinky api url deletion endpoint (needs auth)
 | 
						 * API-Delet for the linkylinky api url deletion endpoint (needs auth)
 | 
				
			||||||
	 * @param {*} shortcode The shortcode of your most hated url
 | 
						 * @param {*} shortcode The shortcode of your most hated url
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										123
									
								
								src/lib/CreateUrl.svelte
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/lib/CreateUrl.svelte
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,123 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						import Apiclient from './Apiclient';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						$: targetUrl = '';
 | 
				
			||||||
 | 
						$: customShortcode = '';
 | 
				
			||||||
 | 
						$: shortcode = '';
 | 
				
			||||||
 | 
						$: error = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function createUrl() {
 | 
				
			||||||
 | 
							console.log('here');
 | 
				
			||||||
 | 
							Apiclient.createUrl(targetUrl, shortcode).then((res) => {
 | 
				
			||||||
 | 
								console.log(res);
 | 
				
			||||||
 | 
								if (res.status != 200) {
 | 
				
			||||||
 | 
									error = res.data;
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									shortcode = res.data.shortcode;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function resetInput() {
 | 
				
			||||||
 | 
							error = '';
 | 
				
			||||||
 | 
							shortcode = '';
 | 
				
			||||||
 | 
							customShortcode = '';
 | 
				
			||||||
 | 
							targetUrl = '';
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<h2 class="text-center text-2xl font-bold text-gray-800 dark:text-gray-100 pb-3">Create new url</h2>
 | 
				
			||||||
 | 
					{#if error != ''}
 | 
				
			||||||
 | 
						<div class="rounded-md bg-red-100 p-4 hidden" id="error_container">
 | 
				
			||||||
 | 
							<div class="flex">
 | 
				
			||||||
 | 
								<div class="flex-shrink-0">
 | 
				
			||||||
 | 
									<svg
 | 
				
			||||||
 | 
										xmlns="http://www.w3.org/2000/svg"
 | 
				
			||||||
 | 
										class="h-5 w-5 text-red-600"
 | 
				
			||||||
 | 
										viewBox="0 0 20 20"
 | 
				
			||||||
 | 
										fill="currentColor"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
										<path
 | 
				
			||||||
 | 
											fill-rule="evenodd"
 | 
				
			||||||
 | 
											d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z"
 | 
				
			||||||
 | 
											clip-rule="evenodd"
 | 
				
			||||||
 | 
										/>
 | 
				
			||||||
 | 
									</svg>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
								<div class="ml-3">
 | 
				
			||||||
 | 
									<p class="text-sm font-medium text-red-800" id="error_text">
 | 
				
			||||||
 | 
										{error}
 | 
				
			||||||
 | 
									</p>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
								<div class="ml-auto pl-3">
 | 
				
			||||||
 | 
									<div class="-mx-1.5 -my-1.5">
 | 
				
			||||||
 | 
										<button
 | 
				
			||||||
 | 
											on:click={() => {
 | 
				
			||||||
 | 
												error = '';
 | 
				
			||||||
 | 
											}}
 | 
				
			||||||
 | 
											class="inline-flex bg-red-100 rounded-md p-1.5 text-red-500 hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-red-50 focus:ring-red-600"
 | 
				
			||||||
 | 
										>
 | 
				
			||||||
 | 
											<span class="sr-only">Dismiss</span>
 | 
				
			||||||
 | 
											<svg
 | 
				
			||||||
 | 
												class="h-5 w-5"
 | 
				
			||||||
 | 
												x-description="Heroicon name: x"
 | 
				
			||||||
 | 
												xmlns="http://www.w3.org/2000/svg"
 | 
				
			||||||
 | 
												viewBox="0 0 20 20"
 | 
				
			||||||
 | 
												fill="currentColor"
 | 
				
			||||||
 | 
												aria-hidden="true"
 | 
				
			||||||
 | 
											>
 | 
				
			||||||
 | 
												<path
 | 
				
			||||||
 | 
													fill-rule="evenodd"
 | 
				
			||||||
 | 
													d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
 | 
				
			||||||
 | 
													clip-rule="evenodd"
 | 
				
			||||||
 | 
												/>
 | 
				
			||||||
 | 
											</svg>
 | 
				
			||||||
 | 
										</button>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
					{/if}
 | 
				
			||||||
 | 
					{#if shortcode == ''}
 | 
				
			||||||
 | 
						<div>
 | 
				
			||||||
 | 
							<div class="mx-auto lg:w-1/3 w-full mt-1 flex rounded-md shadow-sm">
 | 
				
			||||||
 | 
								<input
 | 
				
			||||||
 | 
									type="url"
 | 
				
			||||||
 | 
									required
 | 
				
			||||||
 | 
									class="flex-1 min-w-0 block border rounded-lg px-3 py-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300 bg-gray-50 dark:bg-gray-800 dark:text-gray-200 dark:border-gray-600"
 | 
				
			||||||
 | 
									placeholder="https://target.url"
 | 
				
			||||||
 | 
								/>
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
 | 
							<div class="mt-1 flex rounded-md shadow-sm mx-auto lg:w-1/3 w-full">
 | 
				
			||||||
 | 
								<span
 | 
				
			||||||
 | 
									class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 dark:bg-gray-900 dark:text-gray-300 text-gray-500 sm:text-sm dark:border-gray-600"
 | 
				
			||||||
 | 
								>
 | 
				
			||||||
 | 
									https://kauf.es/
 | 
				
			||||||
 | 
								</span>
 | 
				
			||||||
 | 
								<input
 | 
				
			||||||
 | 
									type="text"
 | 
				
			||||||
 | 
									class="flex-1 min-w-0 block w-full px-3 py-2 border-t border-b border-r rounded-none rounded-r-md focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300 dark:bg-gray-800 dark:text-gray-200 dark:border-gray-600"
 | 
				
			||||||
 | 
									placeholder="custom_code"
 | 
				
			||||||
 | 
								/>
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
					{:else}
 | 
				
			||||||
 | 
						<!-- TODO: -->
 | 
				
			||||||
 | 
					{/if}
 | 
				
			||||||
 | 
					<div class="mt-3 mx-auto text-center lg:w-1/3 w-full">
 | 
				
			||||||
 | 
						{#if shortcode == ''}
 | 
				
			||||||
 | 
							<button
 | 
				
			||||||
 | 
								on:click={createUrl}
 | 
				
			||||||
 | 
								class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md dark:bg-gray-900 hover:bg-blue-500 dark:hover:bg-gray-700 focus:outline-none focus:bg-blue-500 dark:focus:bg-gray-700"
 | 
				
			||||||
 | 
							>
 | 
				
			||||||
 | 
								Create shorturl
 | 
				
			||||||
 | 
							</button>
 | 
				
			||||||
 | 
						{:else}
 | 
				
			||||||
 | 
							<button
 | 
				
			||||||
 | 
								on:click={resetInput}
 | 
				
			||||||
 | 
								class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md dark:bg-gray-900 hover:bg-blue-500 dark:hover:bg-gray-700 focus:outline-none focus:bg-blue-500 dark:focus:bg-gray-700"
 | 
				
			||||||
 | 
							>
 | 
				
			||||||
 | 
								Add another url
 | 
				
			||||||
 | 
							</button>
 | 
				
			||||||
 | 
						{/if}
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
@@ -85,6 +85,33 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					<span class="mx-4 font-medium">Manage Links</span>
 | 
										<span class="mx-4 font-medium">Manage Links</span>
 | 
				
			||||||
				</a>
 | 
									</a>
 | 
				
			||||||
 | 
									<a
 | 
				
			||||||
 | 
										class="flex items-center px-4 py-2 mt-5 text-gray-600 transition-colors duration-200 transform rounded-md dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 dark:hover:text-gray-200 hover:text-gray-700"
 | 
				
			||||||
 | 
										href="./visits"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
										<svg
 | 
				
			||||||
 | 
											xmlns="http://www.w3.org/2000/svg"
 | 
				
			||||||
 | 
											class="h-5 w-5"
 | 
				
			||||||
 | 
											fill="none"
 | 
				
			||||||
 | 
											viewBox="0 0 24 24"
 | 
				
			||||||
 | 
											stroke="currentColor"
 | 
				
			||||||
 | 
										>
 | 
				
			||||||
 | 
											<path
 | 
				
			||||||
 | 
												stroke-linecap="round"
 | 
				
			||||||
 | 
												stroke-linejoin="round"
 | 
				
			||||||
 | 
												stroke-width="2"
 | 
				
			||||||
 | 
												d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
 | 
											<path
 | 
				
			||||||
 | 
												stroke-linecap="round"
 | 
				
			||||||
 | 
												stroke-linejoin="round"
 | 
				
			||||||
 | 
												stroke-width="2"
 | 
				
			||||||
 | 
												d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
 | 
										</svg>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										<span class="mx-4 font-medium">All Visits</span>
 | 
				
			||||||
 | 
									</a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				<!-- <a
 | 
									<!-- <a
 | 
				
			||||||
					class="flex items-center px-4 py-2 mt-5 text-gray-600 transition-colors duration-200 transform rounded-md dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 dark:hover:text-gray-200 hover:text-gray-700"
 | 
										class="flex items-center px-4 py-2 mt-5 text-gray-600 transition-colors duration-200 transform rounded-md dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 dark:hover:text-gray-200 hover:text-gray-700"
 | 
				
			||||||
@@ -162,7 +189,9 @@
 | 
				
			|||||||
					src="https://images.unsplash.com/photo-1531427186611-ecfd6d936c79?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80"
 | 
										src="https://images.unsplash.com/photo-1531427186611-ecfd6d936c79?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80"
 | 
				
			||||||
					alt="avatar"
 | 
										alt="avatar"
 | 
				
			||||||
				/>
 | 
									/>
 | 
				
			||||||
				<h4 class="mx-2 font-medium text-gray-800 dark:text-gray-200 hover:underline">Username here</h4>
 | 
									<h4 class="mx-2 font-medium text-gray-800 dark:text-gray-200 hover:underline">
 | 
				
			||||||
 | 
										Username here
 | 
				
			||||||
 | 
									</h4>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		{/if}
 | 
							{/if}
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,7 @@ const userStore = () => {
 | 
				
			|||||||
                //
 | 
					                //
 | 
				
			||||||
                return state;
 | 
					                return state;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            location.replace("/");
 | 
					            location.replace("./");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@
 | 
				
			|||||||
<div style="min-height: 640px;" class="bg-white dark:bg-gray-800">
 | 
					<div style="min-height: 640px;" class="bg-white dark:bg-gray-800">
 | 
				
			||||||
	<div class="h-screen flex overflow-hidden">
 | 
						<div class="h-screen flex overflow-hidden">
 | 
				
			||||||
		<Sidebar />
 | 
							<Sidebar />
 | 
				
			||||||
		<div class="px-4 py-8 flex flex-col w-0 flex-1 overflow-hidden">
 | 
							<div class="px-4 py-8 flex flex-col w-0 flex-1 overflow-y-scroll">
 | 
				
			||||||
			<slot />
 | 
								<slot />
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,7 +82,7 @@
 | 
				
			|||||||
								Delete
 | 
													Delete
 | 
				
			||||||
							</button>
 | 
												</button>
 | 
				
			||||||
							<a
 | 
												<a
 | 
				
			||||||
								href={`/details?shortcode=${url.shortcode}`}
 | 
													href={`./details?shortcode=${url.shortcode}`}
 | 
				
			||||||
								class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:bg-blue-700"
 | 
													class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:bg-blue-700"
 | 
				
			||||||
							>
 | 
												>
 | 
				
			||||||
								Details
 | 
													Details
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import Apiclient from '$lib/Apiclient';
 | 
				
			|||||||
		try {
 | 
							try {
 | 
				
			||||||
			const login = await Apiclient.login(username, password);
 | 
								const login = await Apiclient.login(username, password);
 | 
				
			||||||
			UserStore.login(login);
 | 
								UserStore.login(login);
 | 
				
			||||||
			location.replace("/");
 | 
								location.replace("./");
 | 
				
			||||||
		} catch (error) {
 | 
							} catch (error) {
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -30,7 +30,7 @@ import Apiclient from '$lib/Apiclient';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			<div class="w-full mt-4">
 | 
								<div class="w-full mt-4">
 | 
				
			||||||
				<input
 | 
									<input
 | 
				
			||||||
					class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-500 focus:outline-none focus:ring"
 | 
										class="block w-full px-4 py-2 mt-2 text-gray-700 dark:text-gray-400 placeholder-gray-500 bg-white border border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-500 focus:outline-none focus:ring"
 | 
				
			||||||
					type="text"
 | 
										type="text"
 | 
				
			||||||
					placeholder="Username"
 | 
										placeholder="Username"
 | 
				
			||||||
					aria-label="Username"
 | 
										aria-label="Username"
 | 
				
			||||||
@@ -40,7 +40,7 @@ import Apiclient from '$lib/Apiclient';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			<div class="w-full mt-4">
 | 
								<div class="w-full mt-4">
 | 
				
			||||||
				<input
 | 
									<input
 | 
				
			||||||
					class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-500 focus:outline-none focus:ring"
 | 
										class="block w-full px-4 py-2 mt-2 text-gray-700 dark:text-gray-400 placeholder-gray-500 bg-white border border-gray-300 rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-500 dark:focus:border-blue-500 focus:outline-none focus:ring"
 | 
				
			||||||
					type="password"
 | 
										type="password"
 | 
				
			||||||
					placeholder="Password"
 | 
										placeholder="Password"
 | 
				
			||||||
					aria-label="Password"
 | 
										aria-label="Password"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										69
									
								
								src/routes/visits.svelte
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								src/routes/visits.svelte
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						import Apiclient from '$lib/Apiclient';
 | 
				
			||||||
 | 
						import UserStore from '$lib/UserStore';
 | 
				
			||||||
 | 
						import { onDestroy } from 'svelte';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						$: visits = [];
 | 
				
			||||||
 | 
						let visitQuery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Yes i know this isn't the best way to implement this, but linkylinky dashboard is just a oneshot sideproject r/n.
 | 
				
			||||||
 | 
						const unsubscribe = UserStore.subscribe((value) => {
 | 
				
			||||||
 | 
							if (value.isLoggedIn) {
 | 
				
			||||||
 | 
								visitQuery = Apiclient.getVisits().then((res) => {
 | 
				
			||||||
 | 
									visits = res;
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						onDestroy(unsubscribe);
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<h2 class="text-3xl font-bold text-gray-800 dark:text-gray-100 pb-6">View all visits</h2>
 | 
				
			||||||
 | 
					<div class="rounded-xl">
 | 
				
			||||||
 | 
						<table class="min-w-full divide-y divide-gray-200">
 | 
				
			||||||
 | 
							<thead class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100">
 | 
				
			||||||
 | 
								<tr>
 | 
				
			||||||
 | 
									<th scope="col" class="px-6 py-3 text-left text-xs font-medium  uppercase tracking-wider">
 | 
				
			||||||
 | 
										Shortcode
 | 
				
			||||||
 | 
									</th>
 | 
				
			||||||
 | 
									<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">
 | 
				
			||||||
 | 
										Provider
 | 
				
			||||||
 | 
									</th>
 | 
				
			||||||
 | 
									<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">
 | 
				
			||||||
 | 
										Timestamp
 | 
				
			||||||
 | 
									</th>
 | 
				
			||||||
 | 
								</tr>
 | 
				
			||||||
 | 
							</thead>
 | 
				
			||||||
 | 
							<tbody class="bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:text-gray-100" x-max="1">
 | 
				
			||||||
 | 
								{#await visitQuery}
 | 
				
			||||||
 | 
									<tr>
 | 
				
			||||||
 | 
										<td
 | 
				
			||||||
 | 
											class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
 | 
				
			||||||
 | 
										>
 | 
				
			||||||
 | 
											Loading data...
 | 
				
			||||||
 | 
										</td>
 | 
				
			||||||
 | 
										<td class="px-6 py-4 whitespace-nowrap text-sm"> Loading data... </td>
 | 
				
			||||||
 | 
										<td class="px-6 py-4 whitespace-nowrap text-sm"> Loading data... </td>
 | 
				
			||||||
 | 
									</tr>
 | 
				
			||||||
 | 
								{:then}
 | 
				
			||||||
 | 
									{#each visits as visit}
 | 
				
			||||||
 | 
										<tr>
 | 
				
			||||||
 | 
											<td
 | 
				
			||||||
 | 
												class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-200"
 | 
				
			||||||
 | 
											>
 | 
				
			||||||
 | 
					                            {#if visit.provider == "native"}
 | 
				
			||||||
 | 
												<a href={`./details?shortcode=${visit.shortcode}`}>{visit.shortcode}</a>
 | 
				
			||||||
 | 
					                            {:else}
 | 
				
			||||||
 | 
					                                {visit.shortcode}
 | 
				
			||||||
 | 
					                            {/if}
 | 
				
			||||||
 | 
											</td>
 | 
				
			||||||
 | 
											<td class="px-6 py-4 whitespace-nowrap text-sm">
 | 
				
			||||||
 | 
												{visit.provider}
 | 
				
			||||||
 | 
											</td>
 | 
				
			||||||
 | 
											<td class="px-6 py-4 whitespace-nowrap text-sm"> {visit.timestamp} </td>
 | 
				
			||||||
 | 
										</tr>
 | 
				
			||||||
 | 
									{/each}
 | 
				
			||||||
 | 
								{/await}
 | 
				
			||||||
 | 
							</tbody>
 | 
				
			||||||
 | 
						</table>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user