Skip to content
Draft

V3 #4

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
c6a4d37
Clean old files
patrick11514 May 3, 2025
924800a
Initial commit
patrick11514 May 3, 2025
350de87
Init DB schema
patrick11514 May 3, 2025
2f04b2f
Added bootstrap icons
patrick11514 May 3, 2025
6fc7cf2
Added nav + translations
patrick11514 May 3, 2025
c1128a6
Reworked state management
patrick11514 May 3, 2025
c251d37
Added footer
patrick11514 May 3, 2025
5440137
Some basic design for nav
patrick11514 May 3, 2025
d6cd473
Added tw merge
patrick11514 May 3, 2025
161dbd6
Setup origins + csrf
patrick11514 May 4, 2025
bcace21
Correct typing of entries and fromEntries
patrick11514 May 4, 2025
bfc7c96
Create foundation for logging user visits
patrick11514 May 4, 2025
b9c82cf
Added mobile design for navigation
patrick11514 May 4, 2025
4db7f7e
Added clickOutside
patrick11514 May 4, 2025
cc8df5e
Reactive language
patrick11514 May 4, 2025
35955de
Almost done with main page
patrick11514 May 4, 2025
37037e8
Remove default file
patrick11514 May 4, 2025
b4ae3f7
Force redirect to /cs when accessing without any path
patrick11514 May 4, 2025
802fcdc
Main page done
patrick11514 May 4, 2025
ba9625d
Changed navigation size
patrick11514 May 4, 2025
879af10
Reformat
patrick11514 May 4, 2025
fece823
Error console statements
patrick11514 May 4, 2025
48e428d
Fix migration script
patrick11514 May 4, 2025
25cdc72
Removed per page desc + added embed things
patrick11514 May 4, 2025
fd54bfc
Log visitors
patrick11514 May 4, 2025
a187fe4
404 Error page done
patrick11514 May 4, 2025
f51e659
Reformat + eslint things
patrick11514 May 4, 2025
b07c5a1
Copy env file before build
patrick11514 May 4, 2025
99d4371
Move starback into layout
patrick11514 May 5, 2025
7212b7d
Rich text should use target _blank
patrick11514 May 5, 2025
55ff5c5
Added migration for accounts
patrick11514 May 5, 2025
af91134
Update packages
patrick11514 May 9, 2025
6310db8
Wip login
patrick11514 May 9, 2025
9e28514
Don't leave / at the end of url when redirecting
patrick11514 May 9, 2025
94d842b
Finished login
patrick11514 May 9, 2025
3f077ff
Main Admin page done
patrick11514 May 9, 2025
56fc68c
Updated responsivity
patrick11514 May 9, 2025
02dbe93
Finished Dashboard
patrick11514 May 9, 2025
066d2c5
Format + lint
patrick11514 May 9, 2025
4e1f6dc
Create database structure for gallery
patrick11514 May 9, 2025
1c49904
Cenrter vertically
patrick11514 May 9, 2025
d892ed0
Only allow console.error in API routes
patrick11514 May 10, 2025
7fb0095
When redirecting to login, put queryParams + custom redirect function
patrick11514 May 10, 2025
a0856fd
Installed sweet alers
patrick11514 May 10, 2025
5db45bd
Added support for migration up/down
patrick11514 May 10, 2025
dbd3f6a
Resolve translation from string; replace placeholders
patrick11514 May 10, 2025
c87624b
Added required
patrick11514 May 10, 2025
c27c45d
Sync schema
patrick11514 May 10, 2025
d99fc22
Added equipment type things
patrick11514 May 10, 2025
8537777
Reformat
patrick11514 May 10, 2025
f74925d
Fallback to cs langauge
patrick11514 May 11, 2025
db233bd
Added selecti
patrick11514 May 11, 2025
eeb4f8b
Added w-full for FormItem
patrick11514 May 11, 2025
858aa52
Finished equipment things
patrick11514 May 14, 2025
1b5e4ba
Change default target to null
patrick11514 May 20, 2025
3268074
Update button padding
patrick11514 May 20, 2025
69b3b28
Added new colors
patrick11514 May 20, 2025
92141ce
Justify content to start instead of center
patrick11514 May 20, 2025
577ca22
Reworked design
patrick11514 May 20, 2025
51b7108
Refactor Equipment page
patrick11514 May 21, 2025
83998a7
Added Article page
patrick11514 May 21, 2025
1ff8534
Cleaned migrations
patrick11514 May 21, 2025
da5d1e6
Some adjustements
patrick11514 May 21, 2025
ff62497
Fix types
patrick11514 May 21, 2025
fd278d7
Upload images + Image component
patrick11514 May 21, 2025
1f0fd32
Moved uuid of image to name
patrick11514 May 22, 2025
f66aa75
WIP Article create/edit
patrick11514 May 22, 2025
93fedb0
Reformat
patrick11514 May 22, 2025
990537c
Added config for tailwind typography
patrick11514 Jun 3, 2025
c7bbb50
Added markdown component
patrick11514 Jun 3, 2025
ab22a91
Finished uploading + removing images
patrick11514 Jun 3, 2025
02ea674
Moved yes/no to global translates
patrick11514 Jun 3, 2025
aa3b1c9
Added startWith for admin
patrick11514 Jun 3, 2025
48480f1
Added class for FormItem
patrick11514 Jun 3, 2025
feacacb
Added route for uploads API
patrick11514 Jun 3, 2025
653fb11
Set canvas to fixed
patrick11514 Jun 3, 2025
a7060d2
Working on article creation
patrick11514 Jun 3, 2025
d352f68
Match height of input and select
patrick11514 Jun 6, 2025
7c7054a
Added input for dates and date times
patrick11514 Jun 6, 2025
7a7fd28
Some table components
patrick11514 Jun 6, 2025
c63a15e
Bool to format without time
patrick11514 Jun 6, 2025
02fd432
Added proper typing for specific inputs: Text/Number
patrick11514 Jun 6, 2025
7afa4ad
Updated logging
patrick11514 Jun 7, 2025
cc3644e
Reformat
patrick11514 Jun 9, 2025
2e60de6
Added route for update + delete, and moved shemes
patrick11514 Jun 9, 2025
074dd99
Added lang for articles
patrick11514 Jun 9, 2025
66962be
Article management done
patrick11514 Jun 9, 2025
8dcc594
Insert only if some data presentedx
patrick11514 Jun 16, 2025
6987ab4
Added priority to equipment, migrate to table components
patrick11514 Jun 16, 2025
5f86a49
Fix responsive design
patrick11514 Jun 16, 2025
3c9ac59
Unify h1, h2 to component
patrick11514 Jun 16, 2025
c385c53
Update h1 + fix dialog
patrick11514 Jun 16, 2025
9e3fae9
Article must contain at leas one image
patrick11514 Jun 16, 2025
c44689a
Limit inputs, add description
patrick11514 Jun 16, 2025
12350c9
Added gallery main page
patrick11514 Jun 16, 2025
29d991c
Set lang to state, for redirects to use
patrick11514 Jun 16, 2025
b49cee5
Use own redirect function
patrick11514 Jun 16, 2025
ef28819
Remove import + add anchor tag
patrick11514 Jun 16, 2025
fea8dac
Match start for normal pages
patrick11514 Jun 16, 2025
4122ba3
Add exposure to preview, and sort in admin by created
patrick11514 Jun 16, 2025
b4f3121
Use normal redirect for the next parameter
patrick11514 Jun 16, 2025
1d8301a
On mobile, there should be only one article in row
patrick11514 Jun 16, 2025
b91ebdb
Use background color instead of black
patrick11514 Jun 16, 2025
34a9fd2
Special syntax for: 1 předmět, 2 předměty...
patrick11514 Jun 16, 2025
3600f28
Dots for element list
patrick11514 Jun 16, 2025
a7c4db7
Finished gallery
patrick11514 Jun 16, 2025
fe19e4e
Reformat
patrick11514 Jun 16, 2025
f8af7b6
Test deploy on beta website
patrick11514 Jun 16, 2025
3513555
Add tsx for running migrations
patrick11514 Jun 16, 2025
6c2b1c6
Disable darkreader on my site
patrick11514 Jun 16, 2025
0e0475f
Reformat
patrick11514 Jun 16, 2025
5c857a4
Don't reset the exposure info
patrick11514 Jun 17, 2025
c37f050
Fit gallery item to whole width on mobile
patrick11514 Jun 17, 2025
8d4fd63
Fix links + z index of navigation
patrick11514 Jun 17, 2025
7102ded
Cosmetics
patrick11514 Jun 17, 2025
9bca3d1
Links in RichText can disable blank target
patrick11514 Jun 17, 2025
7e88102
Whole article as link + fix equipment showcase
patrick11514 Jun 17, 2025
4e7fce1
Reformat
patrick11514 Jul 4, 2025
3ed3481
fix lint staged
patrick11514 Jul 4, 2025
0b388bd
Added contact page
patrick11514 Jul 4, 2025
d4406ed
Testing logging
patrick11514 Jul 4, 2025
7b10be1
Fixed main bottle neck, when I was reading the original big file alwa…
patrick11514 Jul 4, 2025
2c4646b
Optimize gallery image loading with streaming and proper lazy loading…
Copilot Nov 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
#webserver config
# node server config
HOST=0.0.0.0
PORT=5178
ORIGIN=http://localhost:5178
PUBLIC_ORIGIN=https://myweb.cz
BODY_SIZE_LIMIT=16777216 # max upload size in bytes
#database config
# database config
DATABASE_IP=10.10.10.223
DATABASE_PORT=3306
DATABASE_USER=superclovek
DATABASE_PASSWORD=tajnyheslo123456
DATABASE_NAME=website
DATABASE_URL=mysql://superclovek:tajnyheslo123456@10.10.10.223:3306/website
#secret pro JWT (tím se bude podepisovat JWT token - https://jwt.io/)
DATABASE_NAME=db
DATABASE_URL=mysql://superclovek:tajnyheslo123456@10.10.10.223:3306/db
# jwt settings
JWT_SECRET=text
#v sekundách (10 min = 10 * 60)
#expiruje pouze pokud uživatel danou dobu nic nedělá (neprochází stránky)
# marks how many seconds until session cookie expire
COOKIE_EXPIRE=1200
#v sekundách (5 minut = 5 * 60)
PUBLIC_CHECK_COOKIE_INTERVAL=300
# default account which will be created in migrations
DEFAULT_USERNAME=patrick115
DEFAULT_PASSWORD=test123
HASH_ROUNDS=12
# folder for uploaded images
FILE_FOLDER=./uploads
MAX_FILE_SIZE=104857600
BODY_SIZE_LIMIT=104857600
127 changes: 127 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: CI

on:
push:

jobs:
lint:
name: 'Lint code'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pnpm
run: npm install -g pnpm

- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Copy env
run: cp .env.example .env

- name: Build
run: pnpm run build

- name: Check lint
run: pnpm run lint

- name: TypeScript check
run: pnpm run check

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: lint
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Deploy via SSH
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /opt/NodeApps/Web

echo "Setting up nvm"
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
nvm use

echo "Pulling latest changes from git"
git pull

echo "Installing dependencies"
npm install -g pnpm

echo "Installing dependencies"
pnpm install --frozen-lockfile

echo "Building the app"
pnpm run build

echo "Run migrations"
pnpm run migrate

echo "Restarting the app"
sudo systemctl restart web
echo "Deployment completed"
deploybeta:
name: DeployBeta
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Deploy via SSH
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /opt/NodeApps/WebBeta

echo "Setting up nvm"
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
nvm use

echo "Pulling latest changes from git"
git pull

echo "Installing dependencies"
npm install -g pnpm

echo "Installing dependencies"
pnpm install --frozen-lockfile

echo "Building the app"
pnpm run build

echo "Run migrations"
pnpm run migrate

echo "Restarting the app"
sudo systemctl restart web-beta
echo "Deployment completed"
31 changes: 21 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
.DS_Store
node_modules
/build

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/package
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

#custom folders
/projects
.cache
# logs
logs/*

#lock files
pnpm-lock.yaml
package-lock.json
yarn.lock
# image storage
.cache
uploads
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpx lint-staged
6 changes: 4 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lock
bun.lockb
22 changes: 14 additions & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"useTabs": false,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 180,
"semi": true,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"useTabs": false,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 180,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
],
"tabWidth": 2
}
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Info

Source code of my main website [patrick115.eu](https://patrick115.eu)
TODO

## Dev mode

```bash
npm run dev

# or start the server and open the app in a new browser tab

npm run dev -- --open
```

Expand All @@ -19,26 +20,21 @@ Building app:
npm run build
```

Show builded preview: `npm run preview`.
Show builded preview: \`npm run preview\`.
Start builded app using `npm run start` with [Node Adapter](https://kit.svelte.dev/docs/adapter-node) or config command in package.json using your own [Adapter](https://kit.svelte.dev/docs/adapters)

## Example ENV file (.env.example)

```YAML
#webserver config
HOST=0.0.0.0
PORT=5178
ORIGIN=http://localhost:5178
PUBLIC_ORIGIN=https://myweb.cz
BODY_SIZE_LIMIT=16777216 # max upload size in bytes
#database config
DATABASE_IP=10.10.10.223
DATABASE_PORT=3306
DATABASE_USER=superclovek
DATABASE_PASSWORD=tajnyheslo123456
DATABASE_NAME=website
DATABASE_URL=mysql://superclovek:tajnyheslo123456@10.10.10.223:3306/website
#secret pro JWT (tím se bude podepisovat JWT token - https://jwt.io/)
DATABASE_NAME=db
DATABASE_URL=mysql://superclovek:tajnyheslo123456@10.10.10.223:3306/db
JWT_SECRET=text
#v sekundách (10 min = 10 * 60)
#expiruje pouze pokud uživatel danou dobu nic nedělá (neprochází stránky)
Expand Down
25 changes: 25 additions & 0 deletions config/patrick115.eu
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
listen 80;
listen [::]:80;

server_name beta.patrick115.eu;

return 301 https://$host$request_uri;

}

server {

listen [::]:443 ssl http2;
listen 443 ssl http2;

server_name beta.patrick115.eu;

access_log /opt/NodeApps/WebBeta/logs/access.log;
error_log /opt/NodeApps/WebBeta/logs/error.log;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass "http://127.0.0.1:5188";
}
}
1 change: 1 addition & 0 deletions config/web.service
40 changes: 26 additions & 14 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
import prettier from 'eslint-config-prettier';
import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';

const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));

export default ts.config(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
...svelte.configs.recommended,
prettier,
...svelte.configs['flat/prettier'],
...svelte.configs.prettier,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
globals: { ...globals.browser, ...globals.node }
},
rules: { 'no-undef': 'off' }
},
{
files: ['./src/lib/server/_routes/**/*.ts'],
rules: {
'no-console': ['error', { allow: ['error'] }]
}
},
{
files: ['**/*.svelte'],
ignores: ['./src/lib/server/_routes/**/*.ts'],
rules: {
'svelte/no-at-html-tags': 'off'
},

'no-console': 'error'
}
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
parser: ts.parser
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
);
11 changes: 11 additions & 0 deletions kysely.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"outFile": "./src/types/database.ts",
"overrides": {
"columns": {
"article.id": "Generated<string>",
"article_equipment.article_id": "string",
"exposure.article_id": "string",
"gallery_image.article_id": "string"
}
}
}
Empty file added logs/.gitkeep
Empty file.
Loading