mirror of
https://github.com/JonasunderscoreJones/blog.jonasjones.dev.git
synced 2025-10-26 01:19:18 +02:00
Compare commits
No commits in common. "9c1072c947e92fc32f245358f2edc3436af50450" and "979b8ceb16ede1dcc0d18b6094f5fa725db050a7" have entirely different histories.
9c1072c947
...
979b8ceb16
17 changed files with 1010 additions and 750 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -22,6 +22,3 @@ dist-ssr
|
||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
|
|
||||||
.env
|
|
||||||
267
.svelte-kit/ambient.d.ts
vendored
267
.svelte-kit/ambient.d.ts
vendored
|
|
@ -1,267 +0,0 @@
|
||||||
|
|
||||||
// this file is generated — do not edit it
|
|
||||||
|
|
||||||
|
|
||||||
/// <reference types="@sveltejs/kit" />
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), this module cannot be imported into client-side code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://kit.svelte.dev/docs/configuration#env) (if configured).
|
|
||||||
*
|
|
||||||
* _Unlike_ [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), the values exported from this module are statically injected into your bundle at build time, enabling optimisations like dead code elimination.
|
|
||||||
*
|
|
||||||
* ```ts
|
|
||||||
* import { API_KEY } from '$env/static/private';
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Note that all environment variables referenced in your code should be declared (for example in an `.env` file), even if they don't have a value until the app is deployed:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* MY_FEATURE_FLAG=""
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* You can override `.env` values from the command line like so:
|
|
||||||
*
|
|
||||||
* ```bash
|
|
||||||
* MY_FEATURE_FLAG="enabled" npm run dev
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare module '$env/static/private' {
|
|
||||||
export const SHELL: string;
|
|
||||||
export const npm_command: string;
|
|
||||||
export const LSCOLORS: string;
|
|
||||||
export const SESSION_MANAGER: string;
|
|
||||||
export const npm_config_userconfig: string;
|
|
||||||
export const COLORTERM: string;
|
|
||||||
export const npm_config_cache: string;
|
|
||||||
export const npm_package_dev_optional: string;
|
|
||||||
export const LESS: string;
|
|
||||||
export const XDG_MENU_PREFIX: string;
|
|
||||||
export const npm_package_integrity: string;
|
|
||||||
export const _P9K_TTY: string;
|
|
||||||
export const NODE: string;
|
|
||||||
export const JAVA_HOME: string;
|
|
||||||
export const SSH_AUTH_SOCK: string;
|
|
||||||
export const P9K_TTY: string;
|
|
||||||
export const MEMORY_PRESSURE_WRITE: string;
|
|
||||||
export const COLOR: string;
|
|
||||||
export const npm_config_local_prefix: string;
|
|
||||||
export const SDKMAN_CANDIDATES_DIR: string;
|
|
||||||
export const XMODIFIERS: string;
|
|
||||||
export const DESKTOP_SESSION: string;
|
|
||||||
export const npm_config_globalconfig: string;
|
|
||||||
export const GPG_TTY: string;
|
|
||||||
export const EDITOR: string;
|
|
||||||
export const PWD: string;
|
|
||||||
export const LOGNAME: string;
|
|
||||||
export const XDG_SESSION_DESKTOP: string;
|
|
||||||
export const QT_QPA_PLATFORMTHEME: string;
|
|
||||||
export const XDG_SESSION_TYPE: string;
|
|
||||||
export const MANPATH: string;
|
|
||||||
export const npm_package_dev: string;
|
|
||||||
export const npm_config_init_module: string;
|
|
||||||
export const SYSTEMD_EXEC_PID: string;
|
|
||||||
export const _: string;
|
|
||||||
export const XAUTHORITY: string;
|
|
||||||
export const GJS_DEBUG_TOPICS: string;
|
|
||||||
export const MOTD_SHOWN: string;
|
|
||||||
export const GDM_LANG: string;
|
|
||||||
export const HOME: string;
|
|
||||||
export const USERNAME: string;
|
|
||||||
export const npm_package_peer: string;
|
|
||||||
export const LANG: string;
|
|
||||||
export const LS_COLORS: string;
|
|
||||||
export const XDG_CURRENT_DESKTOP: string;
|
|
||||||
export const npm_package_version: string;
|
|
||||||
export const MEMORY_PRESSURE_WATCH: string;
|
|
||||||
export const VTE_VERSION: string;
|
|
||||||
export const WAYLAND_DISPLAY: string;
|
|
||||||
export const npm_package_resolved: string;
|
|
||||||
export const INVOCATION_ID: string;
|
|
||||||
export const MANAGERPID: string;
|
|
||||||
export const INIT_CWD: string;
|
|
||||||
export const QT_QPA_PLATFORM: string;
|
|
||||||
export const INFOPATH: string;
|
|
||||||
export const npm_lifecycle_script: string;
|
|
||||||
export const GJS_DEBUG_OUTPUT: string;
|
|
||||||
export const GNOME_SETUP_DISPLAY: string;
|
|
||||||
export const npm_package_optional: string;
|
|
||||||
export const npm_config_npm_version: string;
|
|
||||||
export const XDG_SESSION_CLASS: string;
|
|
||||||
export const TERMINFO: string;
|
|
||||||
export const TERM: string;
|
|
||||||
export const npm_package_name: string;
|
|
||||||
export const npm_config_prefix: string;
|
|
||||||
export const USER: string;
|
|
||||||
export const SDKMAN_DIR: string;
|
|
||||||
export const DISPLAY: string;
|
|
||||||
export const npm_lifecycle_event: string;
|
|
||||||
export const SHLVL: string;
|
|
||||||
export const PAGER: string;
|
|
||||||
export const QT_IM_MODULE: string;
|
|
||||||
export const _P9K_SSH_TTY: string;
|
|
||||||
export const SDKMAN_CANDIDATES_API: string;
|
|
||||||
export const npm_config_user_agent: string;
|
|
||||||
export const npm_execpath: string;
|
|
||||||
export const XDG_RUNTIME_DIR: string;
|
|
||||||
export const npm_package_json: string;
|
|
||||||
export const P9K_SSH: string;
|
|
||||||
export const TREE_COLORS: string;
|
|
||||||
export const JOURNAL_STREAM: string;
|
|
||||||
export const XDG_DATA_DIRS: string;
|
|
||||||
export const npm_config_noproxy: string;
|
|
||||||
export const PATH: string;
|
|
||||||
export const npm_config_node_gyp: string;
|
|
||||||
export const GDMSESSION: string;
|
|
||||||
export const DBUS_SESSION_BUS_ADDRESS: string;
|
|
||||||
export const SDKMAN_PLATFORM: string;
|
|
||||||
export const npm_config_global_prefix: string;
|
|
||||||
export const MAIL: string;
|
|
||||||
export const npm_node_execpath: string;
|
|
||||||
export const OLDPWD: string;
|
|
||||||
export const npm_package_engines_node: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Similar to [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
|
|
||||||
*
|
|
||||||
* Values are replaced statically at build time.
|
|
||||||
*
|
|
||||||
* ```ts
|
|
||||||
* import { PUBLIC_BASE_URL } from '$env/static/public';
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare module '$env/static/public' {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/main/packages/adapter-node) (or running [`vite preview`](https://kit.svelte.dev/docs/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://kit.svelte.dev/docs/configuration#env) (if configured).
|
|
||||||
*
|
|
||||||
* This module cannot be imported into client-side code.
|
|
||||||
*
|
|
||||||
* Dynamic environment variables cannot be used during prerendering.
|
|
||||||
*
|
|
||||||
* ```ts
|
|
||||||
* import { env } from '$env/dynamic/private';
|
|
||||||
* console.log(env.DEPLOYMENT_SPECIFIC_VARIABLE);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* > In `dev`, `$env/dynamic` always includes environment variables from `.env`. In `prod`, this behavior will depend on your adapter.
|
|
||||||
*/
|
|
||||||
declare module '$env/dynamic/private' {
|
|
||||||
export const env: {
|
|
||||||
SHELL: string;
|
|
||||||
npm_command: string;
|
|
||||||
LSCOLORS: string;
|
|
||||||
SESSION_MANAGER: string;
|
|
||||||
npm_config_userconfig: string;
|
|
||||||
COLORTERM: string;
|
|
||||||
npm_config_cache: string;
|
|
||||||
npm_package_dev_optional: string;
|
|
||||||
LESS: string;
|
|
||||||
XDG_MENU_PREFIX: string;
|
|
||||||
npm_package_integrity: string;
|
|
||||||
_P9K_TTY: string;
|
|
||||||
NODE: string;
|
|
||||||
JAVA_HOME: string;
|
|
||||||
SSH_AUTH_SOCK: string;
|
|
||||||
P9K_TTY: string;
|
|
||||||
MEMORY_PRESSURE_WRITE: string;
|
|
||||||
COLOR: string;
|
|
||||||
npm_config_local_prefix: string;
|
|
||||||
SDKMAN_CANDIDATES_DIR: string;
|
|
||||||
XMODIFIERS: string;
|
|
||||||
DESKTOP_SESSION: string;
|
|
||||||
npm_config_globalconfig: string;
|
|
||||||
GPG_TTY: string;
|
|
||||||
EDITOR: string;
|
|
||||||
PWD: string;
|
|
||||||
LOGNAME: string;
|
|
||||||
XDG_SESSION_DESKTOP: string;
|
|
||||||
QT_QPA_PLATFORMTHEME: string;
|
|
||||||
XDG_SESSION_TYPE: string;
|
|
||||||
MANPATH: string;
|
|
||||||
npm_package_dev: string;
|
|
||||||
npm_config_init_module: string;
|
|
||||||
SYSTEMD_EXEC_PID: string;
|
|
||||||
_: string;
|
|
||||||
XAUTHORITY: string;
|
|
||||||
GJS_DEBUG_TOPICS: string;
|
|
||||||
MOTD_SHOWN: string;
|
|
||||||
GDM_LANG: string;
|
|
||||||
HOME: string;
|
|
||||||
USERNAME: string;
|
|
||||||
npm_package_peer: string;
|
|
||||||
LANG: string;
|
|
||||||
LS_COLORS: string;
|
|
||||||
XDG_CURRENT_DESKTOP: string;
|
|
||||||
npm_package_version: string;
|
|
||||||
MEMORY_PRESSURE_WATCH: string;
|
|
||||||
VTE_VERSION: string;
|
|
||||||
WAYLAND_DISPLAY: string;
|
|
||||||
npm_package_resolved: string;
|
|
||||||
INVOCATION_ID: string;
|
|
||||||
MANAGERPID: string;
|
|
||||||
INIT_CWD: string;
|
|
||||||
QT_QPA_PLATFORM: string;
|
|
||||||
INFOPATH: string;
|
|
||||||
npm_lifecycle_script: string;
|
|
||||||
GJS_DEBUG_OUTPUT: string;
|
|
||||||
GNOME_SETUP_DISPLAY: string;
|
|
||||||
npm_package_optional: string;
|
|
||||||
npm_config_npm_version: string;
|
|
||||||
XDG_SESSION_CLASS: string;
|
|
||||||
TERMINFO: string;
|
|
||||||
TERM: string;
|
|
||||||
npm_package_name: string;
|
|
||||||
npm_config_prefix: string;
|
|
||||||
USER: string;
|
|
||||||
SDKMAN_DIR: string;
|
|
||||||
DISPLAY: string;
|
|
||||||
npm_lifecycle_event: string;
|
|
||||||
SHLVL: string;
|
|
||||||
PAGER: string;
|
|
||||||
QT_IM_MODULE: string;
|
|
||||||
_P9K_SSH_TTY: string;
|
|
||||||
SDKMAN_CANDIDATES_API: string;
|
|
||||||
npm_config_user_agent: string;
|
|
||||||
npm_execpath: string;
|
|
||||||
XDG_RUNTIME_DIR: string;
|
|
||||||
npm_package_json: string;
|
|
||||||
P9K_SSH: string;
|
|
||||||
TREE_COLORS: string;
|
|
||||||
JOURNAL_STREAM: string;
|
|
||||||
XDG_DATA_DIRS: string;
|
|
||||||
npm_config_noproxy: string;
|
|
||||||
PATH: string;
|
|
||||||
npm_config_node_gyp: string;
|
|
||||||
GDMSESSION: string;
|
|
||||||
DBUS_SESSION_BUS_ADDRESS: string;
|
|
||||||
SDKMAN_PLATFORM: string;
|
|
||||||
npm_config_global_prefix: string;
|
|
||||||
MAIL: string;
|
|
||||||
npm_node_execpath: string;
|
|
||||||
OLDPWD: string;
|
|
||||||
npm_package_engines_node: string;
|
|
||||||
[key: `PUBLIC_${string}`]: undefined;
|
|
||||||
[key: `${string}`]: string | undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Similar to [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
|
|
||||||
*
|
|
||||||
* Note that public dynamic environment variables must all be sent from the server to the client, causing larger network requests — when possible, use `$env/static/public` instead.
|
|
||||||
*
|
|
||||||
* Dynamic environment variables cannot be used during prerendering.
|
|
||||||
*
|
|
||||||
* ```ts
|
|
||||||
* import { env } from '$env/dynamic/public';
|
|
||||||
* console.log(env.PUBLIC_DEPLOYMENT_SPECIFIC_VARIABLE);
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare module '$env/dynamic/public' {
|
|
||||||
export const env: {
|
|
||||||
[key: `PUBLIC_${string}`]: string | undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
export { matchers } from './matchers.js';
|
|
||||||
|
|
||||||
export const nodes = [
|
|
||||||
() => import('./nodes/0'),
|
|
||||||
() => import('./nodes/1')
|
|
||||||
];
|
|
||||||
|
|
||||||
export const server_loads = [];
|
|
||||||
|
|
||||||
export const dictionary = {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
export const hooks = {
|
|
||||||
handleError: (({ error }) => { console.error(error) }),
|
|
||||||
|
|
||||||
reroute: (() => {})
|
|
||||||
};
|
|
||||||
|
|
||||||
export { default as root } from '../root.svelte';
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export const matchers = {};
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export { default as component } from "../../../../node_modules/@sveltejs/kit/src/runtime/components/layout.svelte";
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export { default as component } from "../../../../src/routes/+error.svelte";
|
|
||||||
25
.svelte-kit/non-ambient.d.ts
vendored
25
.svelte-kit/non-ambient.d.ts
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
|
|
||||||
// this file is generated — do not edit it
|
|
||||||
|
|
||||||
|
|
||||||
declare module "svelte/elements" {
|
|
||||||
export interface HTMLAttributes<T> {
|
|
||||||
'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;
|
|
||||||
'data-sveltekit-noscroll'?: true | '' | 'off' | undefined | null;
|
|
||||||
'data-sveltekit-preload-code'?:
|
|
||||||
| true
|
|
||||||
| ''
|
|
||||||
| 'eager'
|
|
||||||
| 'viewport'
|
|
||||||
| 'hover'
|
|
||||||
| 'tap'
|
|
||||||
| 'off'
|
|
||||||
| undefined
|
|
||||||
| null;
|
|
||||||
'data-sveltekit-preload-data'?: true | '' | 'hover' | 'tap' | 'off' | undefined | null;
|
|
||||||
'data-sveltekit-reload'?: true | '' | 'off' | undefined | null;
|
|
||||||
'data-sveltekit-replacestate'?: true | '' | 'off' | undefined | null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"paths": {},
|
|
||||||
"rootDirs": [
|
|
||||||
"..",
|
|
||||||
"./types"
|
|
||||||
],
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"lib": [
|
|
||||||
"esnext",
|
|
||||||
"DOM",
|
|
||||||
"DOM.Iterable"
|
|
||||||
],
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"module": "esnext",
|
|
||||||
"noEmit": true,
|
|
||||||
"target": "esnext"
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"ambient.d.ts",
|
|
||||||
"non-ambient.d.ts",
|
|
||||||
"./types/**/$types.d.ts",
|
|
||||||
"../vite.config.js",
|
|
||||||
"../vite.config.ts",
|
|
||||||
"../src/**/*.js",
|
|
||||||
"../src/**/*.ts",
|
|
||||||
"../src/**/*.svelte",
|
|
||||||
"../tests/**/*.js",
|
|
||||||
"../tests/**/*.ts",
|
|
||||||
"../tests/**/*.svelte"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"../node_modules/**",
|
|
||||||
"../src/service-worker.js",
|
|
||||||
"../src/service-worker.ts",
|
|
||||||
"../src/service-worker.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
1300
package-lock.json
generated
1300
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -21,7 +21,6 @@
|
||||||
"vite": "^5.2.12"
|
"vite": "^5.2.12"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sveltejs/kit": "^2.5.22",
|
|
||||||
"marked": "^12.0.2",
|
"marked": "^12.0.2",
|
||||||
"svelte-kit": "^1.2.0",
|
"svelte-kit": "^1.2.0",
|
||||||
"svelte-spa-router": "^4.0.0"
|
"svelte-spa-router": "^4.0.0"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
// Call the analytics function on initial page load and after each navigation
|
|
||||||
let previousPath = '';
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
let searchTerm = '';
|
let searchTerm = '';
|
||||||
|
|
|
||||||
|
|
@ -7,38 +7,13 @@
|
||||||
|
|
||||||
let posts: {id: String, date: Date, title: String, author: String, description: String}[] = [];
|
let posts: {id: String, date: Date, title: String, author: String, description: String}[] = [];
|
||||||
|
|
||||||
let filteredPosts: {id: String, date: SimpleDate, title: String, author: String, description: String}[] = [];
|
let filteredPosts: {id: String, date: Date, title: String, author: String, description: String}[] = [];
|
||||||
|
|
||||||
let error = false;
|
let error = false;
|
||||||
let loading = true;
|
let loading = true;
|
||||||
|
|
||||||
let noPostMessage = '';
|
let noPostMessage = '';
|
||||||
|
|
||||||
class SimpleDate {
|
|
||||||
public year: number;
|
|
||||||
public month: number;
|
|
||||||
public day: number;
|
|
||||||
public datestring: string;
|
|
||||||
|
|
||||||
constructor(dateString: string) {
|
|
||||||
const [year, month, day] = dateString.split('-').map(Number);
|
|
||||||
|
|
||||||
this.year = year;
|
|
||||||
this.month = month;
|
|
||||||
this.day = day;
|
|
||||||
this.datestring = `${year}/${month}/${day}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
public toUnixTimestamp(): number {
|
|
||||||
// Create a Date object using the given year, month, and day.
|
|
||||||
// Month is zero-based, so subtract 1 from the month.
|
|
||||||
const date = new Date(Date.UTC(this.year, this.month - 1, this.day));
|
|
||||||
|
|
||||||
// Get the Unix timestamp by dividing the time (in milliseconds) by 1000.
|
|
||||||
return Math.floor(date.getTime() / 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('https://cdn.jonasjones.dev/blog/index.json');
|
const response = await fetch('https://cdn.jonasjones.dev/blog/index.json');
|
||||||
|
|
@ -51,15 +26,15 @@
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// for each post, convert the date string to a Date object
|
// for each post, conver the date string to a Date object
|
||||||
posts.forEach(post => {
|
posts.forEach(post => {
|
||||||
post.date = new SimpleDate(post.date);
|
post.date = new Date(post.date);
|
||||||
});
|
});
|
||||||
|
|
||||||
filteredPosts = posts.filter(post => post.title.toLowerCase().includes(query.toLowerCase()));
|
filteredPosts = posts.filter(post => post.title.toLowerCase().includes(query.toLowerCase()));
|
||||||
|
|
||||||
// sort the posts by date
|
// sort the posts by date
|
||||||
filteredPosts.sort((a, b) => b.date.toUnixTimestamp() - a.date.toUnixTimestamp());
|
filteredPosts.sort((a, b) => b.date - a.date);
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -80,11 +55,11 @@
|
||||||
<div class="postList">
|
<div class="postList">
|
||||||
{#each filteredPosts as post}
|
{#each filteredPosts as post}
|
||||||
<div class="postDiv">
|
<div class="postDiv">
|
||||||
<a href="/#/post/{post.date.year}/{post.date.month}/{post.date.day}/{post.id}">
|
<a href="/#/post/{post.date.getFullYear()}/{post.date.getMonth() + 1}/{post.date.getDate()}/{post.id}">
|
||||||
<h2 class="postTitle">{post.title}</h2>
|
<h2 class="postTitle">{post.title}</h2>
|
||||||
<div class="inline">
|
<div class="inline">
|
||||||
<p class="postAuthor">{post.author}</p>
|
<p class="postAuthor">{post.author}</p>
|
||||||
<p class="postDate">{post.date.datestring}</p>
|
<p class="postDate">{post.date.toLocaleDateString()}</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="postDescription">{post.description}</p>
|
<p class="postDescription">{post.description}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import { recordRequest } from './analytics';
|
|
||||||
|
|
||||||
const posts = writable([]);
|
const posts = writable([]);
|
||||||
const selectedPost = writable({});
|
const selectedPost = writable({});
|
||||||
|
|
@ -16,7 +15,6 @@
|
||||||
let now = false;
|
let now = false;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
recordRequest();
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('https://cdn.jonasjones.dev/blog/index.json');
|
const response = await fetch('https://cdn.jonasjones.dev/blog/index.json');
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let errorCode: {status: number, message: string} = {status: 404, message: "Not Found"};
|
export let errorCode: {status: number, message: string} = {status: 404, message: "Not Found"};
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { recordRequest } from './analytics';
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
recordRequest();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="error">
|
<div id="error">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import PostList from "../components/PostList.svelte";
|
import PostList from "../components/PostList.svelte";
|
||||||
import { onMount } from "svelte";
|
|
||||||
import { recordRequest } from "./analytics";
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
recordRequest();
|
|
||||||
});
|
|
||||||
|
|
||||||
export let searchquery: string = "";
|
export let searchquery: string = "";
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import Loading from '../components/Loading.svelte';
|
import Loading from '../components/Loading.svelte';
|
||||||
import NotFound from "./Error.svelte";
|
import NotFound from "./Error.svelte";
|
||||||
import { recordRequest } from './analytics';
|
import navigate from 'svelte-spa-router';
|
||||||
|
import { parse } from "svelte/compiler";
|
||||||
|
|
||||||
export let params: {year: string, month: string, day: string, title: string} = {
|
export let params: {year: string, month: string, day: string, title: string} = {
|
||||||
year: "",
|
year: "",
|
||||||
|
|
@ -30,11 +31,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
window.addEventListener('popstate', () => {
|
|
||||||
location.reload()
|
|
||||||
});
|
|
||||||
redirectUrl()
|
redirectUrl()
|
||||||
recordRequest();
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (params.month?.toString().length === 1) {
|
if (params.month?.toString().length === 1) {
|
||||||
|
|
@ -90,10 +87,8 @@
|
||||||
async function redirectUrl() {
|
async function redirectUrl() {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (thisHref != location.href) {
|
if (thisHref != location.href) {
|
||||||
if (location.href != "#/") {
|
location.reload()
|
||||||
location.reload()
|
console.log("reloading")
|
||||||
console.log("reloading")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
// Function to record the request with analytics
|
|
||||||
export async function recordRequest() {
|
|
||||||
|
|
||||||
const analyticsData = {
|
|
||||||
timestamp: Date.now(),
|
|
||||||
domain: window.location.hostname,
|
|
||||||
method: 'GET', // Assuming the request method is GET; adjust as necessary
|
|
||||||
path: window.location.pathname,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('Recording request:', analyticsData);
|
|
||||||
|
|
||||||
const ANALYTICS_URL = 'https://analytics.jonasjones.dev/requests/record/ipunknown';
|
|
||||||
const ANALYTICS_API_KEY = import.meta.env.VITE_ANALYTICS_API_KEY;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(ANALYTICS_URL, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': ANALYTICS_API_KEY,
|
|
||||||
},
|
|
||||||
body: JSON.stringify(analyticsData),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
console.log('Request recorded successfully');
|
|
||||||
} else {
|
|
||||||
console.error('Failed to record request:', response.status, await response.text());
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error recording request:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue