Compare commits

..

No commits in common. "master" and "develop" have entirely different histories.

92 changed files with 680 additions and 1004 deletions

View File

@ -1,17 +0,0 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*
*.js
dist/

15
.gitignore vendored
View File

@ -1,6 +1,15 @@
### TS
node_modules/
dist/
videos/
ftp/
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
media
migrations/
### Testing ###
.coverage

View File

@ -1,16 +0,0 @@
FROM node:18-alpine AS builder
WORKDIR /app
RUN npm install -g typescript
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM node:18-alpine AS server
WORKDIR /app
COPY package* ./
RUN npm install --production
COPY --from=builder /app/dist ./dist
COPY . .
EXPOSE 8080
CMD ["npm", "start"]

View File

@ -1,5 +0,0 @@
services:
web:
build: .
ports:
- 8080:8080

9
deploy.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
rsync -rv webpage django:/home/django/personalWebpage/
ssh django "bash -s" <<EOF
cd /home/django/personalWebpage/
python3 manage.py collectstatic --noinput
python3 manage.py makemigrations
python3 manage.py migrate
EOF

22
manage.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'personalWebpage.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

782
package-lock.json generated
View File

@ -1,782 +0,0 @@
{
"name": "website",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "website",
"dependencies": {
"express": "^4.19.2",
"nunjucks": "^3.2.4"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/nunjucks": "^3.2.6"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
},
"node_modules/@types/body-parser": {
"version": "1.19.5",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/connect": "*",
"@types/node": "*"
}
},
"node_modules/@types/connect": {
"version": "3.4.38",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/express": {
"version": "4.17.21",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^4.17.33",
"@types/qs": "*",
"@types/serve-static": "*"
}
},
"node_modules/@types/express-serve-static-core": {
"version": "4.19.0",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
"@types/qs": "*",
"@types/range-parser": "*",
"@types/send": "*"
}
},
"node_modules/@types/http-errors": {
"version": "2.0.4",
"dev": true,
"license": "MIT"
},
"node_modules/@types/mime": {
"version": "1.3.5",
"dev": true,
"license": "MIT"
},
"node_modules/@types/node": {
"version": "20.12.14",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.14.tgz",
"integrity": "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/@types/nunjucks": {
"version": "3.2.6",
"dev": true,
"license": "MIT"
},
"node_modules/@types/qs": {
"version": "6.9.15",
"dev": true,
"license": "MIT"
},
"node_modules/@types/range-parser": {
"version": "1.2.7",
"dev": true,
"license": "MIT"
},
"node_modules/@types/send": {
"version": "0.17.4",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/mime": "^1",
"@types/node": "*"
}
},
"node_modules/@types/serve-static": {
"version": "1.15.7",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/http-errors": "*",
"@types/node": "*",
"@types/send": "*"
}
},
"node_modules/a-sync-waterfall": {
"version": "1.0.1",
"license": "MIT"
},
"node_modules/accepts": {
"version": "1.3.8",
"license": "MIT",
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/array-flatten": {
"version": "1.1.1",
"license": "MIT"
},
"node_modules/asap": {
"version": "2.0.6",
"license": "MIT"
},
"node_modules/body-parser": {
"version": "1.20.2",
"license": "MIT",
"dependencies": {
"bytes": "3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.11.0",
"raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind": {
"version": "1.0.7",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"set-function-length": "^1.2.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/commander": {
"version": "5.1.0",
"license": "MIT",
"engines": {
"node": ">= 6"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"license": "MIT",
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.6.0",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.0.6",
"license": "MIT"
},
"node_modules/debug": {
"version": "2.6.9",
"license": "MIT",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/define-data-property": {
"version": "1.1.4",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"gopd": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/depd": {
"version": "2.0.0",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/destroy": {
"version": "1.2.0",
"license": "MIT",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"license": "MIT"
},
"node_modules/encodeurl": {
"version": "1.0.2",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"get-intrinsic": "^1.2.4"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "4.19.2",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
"body-parser": "1.20.2",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
"cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.2.0",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.7",
"qs": "6.11.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "0.18.0",
"serve-static": "1.15.0",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
}
},
"node_modules/finalhandler": {
"version": "1.2.0",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "2.4.1",
"parseurl": "~1.3.3",
"statuses": "2.0.1",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "0.5.2",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.2.4",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3",
"hasown": "^2.0.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/gopd": {
"version": "1.0.1",
"license": "MIT",
"dependencies": {
"get-intrinsic": "^1.1.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-property-descriptors": {
"version": "1.0.2",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-proto": {
"version": "1.0.3",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.0",
"license": "MIT",
"dependencies": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"license": "ISC"
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/merge-descriptors": {
"version": "1.0.1",
"license": "MIT"
},
"node_modules/methods": {
"version": "1.1.2",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime": {
"version": "1.6.0",
"license": "MIT",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.0.0",
"license": "MIT"
},
"node_modules/negotiator": {
"version": "0.6.3",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/nunjucks": {
"version": "3.2.4",
"license": "BSD-2-Clause",
"dependencies": {
"a-sync-waterfall": "^1.0.0",
"asap": "^2.0.3",
"commander": "^5.1.0"
},
"bin": {
"nunjucks-precompile": "bin/precompile"
},
"engines": {
"node": ">= 6.9.0"
},
"peerDependencies": {
"chokidar": "^3.3.0"
},
"peerDependenciesMeta": {
"chokidar": {
"optional": true
}
}
},
"node_modules/object-inspect": {
"version": "1.13.1",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.7",
"license": "MIT"
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"license": "MIT",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.11.0",
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "2.5.2",
"license": "MIT",
"dependencies": {
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"license": "MIT"
},
"node_modules/send": {
"version": "0.18.0",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "2.4.1",
"range-parser": "~1.2.1",
"statuses": "2.0.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"license": "MIT"
},
"node_modules/serve-static": {
"version": "1.15.0",
"license": "MIT",
"dependencies": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.18.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/set-function-length": {
"version": "1.2.2",
"license": "MIT",
"dependencies": {
"define-data-property": "^1.1.4",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"license": "ISC"
},
"node_modules/side-channel": {
"version": "1.0.6",
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.7",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.4",
"object-inspect": "^1.13.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"license": "MIT",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "1.6.18",
"license": "MIT",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/typescript": {
"version": "5.4.5",
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"dev": true,
"license": "MIT"
},
"node_modules/unpipe": {
"version": "1.0.0",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/utils-merge": {
"version": "1.0.1",
"license": "MIT",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
}
}
}

View File

@ -1,23 +0,0 @@
{
"name": "website",
"module": "index.ts",
"type": "module",
"devDependencies": {
"@types/nunjucks": "^3.2.6",
"@types/express": "^4.17.21"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"express": "^4.19.2",
"nunjucks": "^3.2.4"
},
"scripts": {
"build": "tsc -p .",
"start": "NODE_PATH=./dist node dist/index.js",
"buildandpush": "docker buildx build --push --platform=linux/amd64,linux/arm64 -t git.fai.st/bizcochito/bizcochito.onion .",
"deploy": "npm run buildandpush && sleep 3 && kubectl rollout restart deploy/web -n web",
"dev": "npm run build && npm run start"
}
}

View File

16
personalWebpage/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for personalWebpage project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'personalWebpage.settings')
application = get_asgi_application()

136
personalWebpage/settings.py Executable file
View File

@ -0,0 +1,136 @@
"""
Django settings for personalWebpage project.
Generated by 'django-admin startproject' using Django 4.2.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-&az@!wa-x@+y6cs#q(0ak6ju+3t$46o#5u)i4dn%t9ftn5@dx%'
""" Prod
with open("/home/django/secret_key.txt") as f:
SECRET_KEY = f.read().strip()
"""
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ["*"]
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
# Application definition
INSTALLED_APPS = [
"webpage.apps.ConfigWebpage",
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'personalWebpage.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'personalWebpage.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = "static/"
STATIC_ROOT = "static/"
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# CSRF stuff
CSRF_TRUSTED_ORIGINS = [
'http://localhost:8000',
"https://yari.fai.st"
]

8
personalWebpage/urls.py Normal file
View File

@ -0,0 +1,8 @@
from django.contrib import admin
from django.urls import path, include
app_name = "personalWebsite"
urlpatterns = [
path('admin/', admin.site.urls),
path("", include("webpage.urls"))
]

16
personalWebpage/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for personalWebpage project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'personalWebpage.settings')
application = get_wsgi_application()

View File

@ -1,35 +0,0 @@
import { readdirSync } from "fs";
import type { Response, Request } from "express";
function ad() {
const ad_list = readdirSync("static/ads/hor/");
const ad = ad_list[Math.floor(Math.random() * ad_list.length)];
return ad;
}
function remove_extension(filename: string) {
return filename.substring(0, filename.lastIndexOf(".")) || filename;
}
function image(type: string) {
const images_list = readdirSync(`static/icons/${type}/`);
const image_list = images_list.map((image) => ({
name: image,
url: remove_extension(image),
folder: type,
}));
return image_list;
}
class App {
index(_req: Request, res: Response) {
res.render("index.njk", {
page: "index",
title: "THE INDEX",
image,
ad,
});
}
}
export default new App();

View File

@ -1,23 +0,0 @@
import express from "express";
import nunjucks from "nunjucks";
import app from "./app.js";
const site = express();
const maxAge = 1000 * 60 * 60 * 24 * 7;
nunjucks.configure("templates", {
autoescape: true,
express: site,
});
site.use(
express.static(".", {
maxAge: maxAge,
immutable: true,
})
);
site.get("/", app.index);
site.listen(8080, () => console.log("app listening on 8080"));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,7 +0,0 @@
{% macro adimage(ad) %}
<div class="centerade">
<a>
<img src="/static/ads/hor/{{ ad }}" alt="ad" />
</a>
</div>
{% endmacro %}

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/static/style.css" />
<link rel="icon" href="/static/icon.png" />
<title>{{ title }}</title>
</head>
<body id="{{ page }}">
{% block body %}
{% endblock body %}
</body>
</html>

View File

@ -1,12 +0,0 @@
{% macro images_list(image_list, height=31, url=false) %}
<div class="img">
{% for image in image_list %}
<a href="{%- if url -%}https://{{ image.url }}{%- endif -%}">
<img style="height:{{ height }}px;
width:auto"
src="static/icons/{{ image.folder }}/{{ image.name }}"
alt="{{ image.url }}" />
</a>
{% endfor %}
</div>
{% endmacro %}

View File

@ -1,47 +0,0 @@
{% extends "base.njk" %}
{% block body %}
<div class="centercubeplease">
<h1>
I'm bizcochito, hey!
</h1>
<h2>
Banners
</h2>
{% from "imagelist.njk" import images_list as il1 %}
{{ il1(image("banner") ) }}
<h2>
Funni gifs
</h2>
{% from "imagelist.njk" import images_list as il2 %}
{{ il2(image("gif") , height=50 ) }}
<h2>
Frens
</h2>
{% from "imagelist.njk" import images_list as il3 %}
{{ il3(image("8831") , url=true ) }}
<h2>
Another banner that is unused
</h2>
<div class="img">
<a href="">
<img style="height:33px;
width:81px"
src="/static/icons/coconut.png"
alt="cronut.cafe/~bizcochito" />
</a>
</div>
<h2>
BANNER
</h2>
<div class="img">
<a href="https://yari.fai.st">
<img style="height:33px;
width:81px"
src="/static/icons/bizcochito.gif"
alt="yari.fai.st" />
</a>
</div>
</div>
{% from "ad.njk" import adimage %}
{{ adimage(ad() ) }}
{% endblock body %}

View File

@ -1,22 +0,0 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"outDir": "dist",
/* Bundler mode */
"moduleResolution": "Bundler",
"verbatimModuleSyntax": true,
/* Linting */
"skipLibCheck": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "./src"
},
"include": ["src/**/*.ts"]
}

0
webpage/__init__.py Normal file
View File

7
webpage/admin.py Normal file
View File

@ -0,0 +1,7 @@
from django.contrib import admin
from .models import Booksigner
# Register your models here.
admin.site.register(Booksigner)

4
webpage/apps.py Normal file
View File

@ -0,0 +1,4 @@
from django.apps import AppConfig
class ConfigWebpage(AppConfig):
name = 'webpage'

16
webpage/forms.py Normal file
View File

@ -0,0 +1,16 @@
from re import Pattern
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as txt
class SignbookForm(forms.Form):
name = forms.CharField(label="Name")
website = forms.CharField(label="Website", required=False)
email = forms.EmailField(label="Email", required=False)
comment = forms.CharField(label="Comment", required=False)
capcha = forms.CharField(label="Tell me that you love 'me'")
def validate_capcha(self):
if self.cleaned_data["capcha"].lower() != "i love me":
raise ValidationError(txt('Invalid captcha'), code="invalid")
return self

8
webpage/models.py Normal file
View File

@ -0,0 +1,8 @@
from django.db import models
# Create your models here.
class Booksigner(models.Model):
name = models.CharField(max_length=50)
website = models.CharField(blank=True, max_length=200)
email = models.EmailField(blank=True, )
comment = models.CharField(blank=True, max_length=500)

6
webpage/static/ads/ads Executable file
View File

@ -0,0 +1,6 @@
<a href="ads.php"><img src="ads/hor/orb.gif" alt="Silly ad of engarging your orb"></a>
<a href="ads.php"><img src="ads/hor/ie.png" alt="Silly ad of internet explorer 3.0"></a>
<a href="ads.php"><img src="ads/hor/ram.png" alt="Download more RAM"></a>
<a href="ads.php"><img src="ads/hor/lies.jpg" alt="Insert lies here!"></a>
<a href="ads.php"><img src="ads/hor/catgirl.png" alt="Cute trans girls in my CS class?"></a>
<a href="ads.php"><img src="ads/hor/gay.jpg" alt="Little gay people on my machine?"></a>

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 125 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 246 KiB

After

Width:  |  Height:  |  Size: 246 KiB

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 696 KiB

After

Width:  |  Height:  |  Size: 696 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 616 B

View File

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 346 B

BIN
webpage/static/icons/fediring.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 MiB

After

Width:  |  Height:  |  Size: 7.2 MiB

View File

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 438 KiB

View File

Before

Width:  |  Height:  |  Size: 272 KiB

After

Width:  |  Height:  |  Size: 272 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 933 KiB

After

Width:  |  Height:  |  Size: 933 KiB

BIN
webpage/static/icons/last.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
webpage/static/icons/next.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

15
webpage/static/stats/index.cgi Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
echo "Content-Type: text/plain"
echo
echo "This is \"`hostname`\" server running `uname -srm` on `lscpu -J | jq -r '.lscpu[2].data'` * `lscpu -J | jq -r '.lscpu[7].data'` `lscpu -J | jq -r '.lscpu[9].data'` CPU @ `lscpu -J | jq -r '.lscpu[11].data'` MHz."
echo
uptime
echo "System stats"
echo "=================================="
echo "Processes:\t RUN: `ps -r | wc -l`, TOTAL: `ps -A | wc -l`"
head -n 2 /proc/meminfo
echo
echo "Generated on `date -R`."
echo
echo "https://yari.fai.st"

114
webpage/templates/about.html Executable file
View File

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
{% include "head.html" %}
<body id="about">
<div class="centercubeplease">
<h1>
So hey, you want to know more about me. Here u have!
</h1>
<div class="centerade">
<p>
A thing i need to say is that this page one day could be deprecated bc
of me just not remembering to change anything.
</p>
<h2>
Index
</h2>
<ul class="disclosure-closed">
<li>
<a href="#how">How to adress me</a>
</li>
<li>
<a href="#who">Who i am</a>
</li>
<li>
<a href="#what">What i am</a>
</li>
<li>
<a href="#where">Where to contact me</a>
</li>
</ul>
<h2 id="how">
How to adress me
</h2>
<p>
So first of all if you are not gonna adress me directly or you don't
know me yet just call me Bizcochito!
<br />
</p>
<h3>
You can call me:
</h3>
<ul class="disclosure-closed">
<li>
Yari
</li>
<li>
Alicia
</li>
<li>
Maria
</li>
<li>
Bizcochito
</li>
</ul>
<p>
Also if you are gonna "pronoun" me, please think before if u can just
use the name "Yari" that is literaly like "They" long.
</p>
<h3>
If you insist in using pronouns you can use this
<b> (in order of preference) </b> :
</h3>
<ul class="disclosure-closed">
<li>
<b>My names</b>
</li>
<li>
Literally anything but he
</li>
</ul>
<h2 id="who">
Who i am
</h2>
<p>
Existential question i have yet not answered
</p>
<h2 id="what">
What i am
</h2>
<p>
A silly colection of bytes
</p>
<h2 id="where">
Where to contact me
</h2>
<div class="centerade">
{# djlint: ignore D018 #}<a href="xmpp:bizcochito@fai.st">
<img style="border: 0px;
height: 36px;
width: auto"
src="https://xmpp.org/images/logos/xmpp-logo.svg"
alt="XMPP" />
</a>
<a href="mailto:bizcochito@anartist.org">
<img style="border: 0px;
height: 36px;
width: auto"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/%28at%29.svg/170px-%28at%29.svg.png"
alt="Personal Mail" />
</a>
<a href="https://awoo.fai.st/MeDueleLaTeta">
<img style="border: 0px;
height: 36px;
width: auto"
src="https://upload.wikimedia.org/wikipedia/commons/9/93/Fediverse_logo_proposal.svg"
alt="Pleroma" />
</a>
</div>
</div>
<a href="{% url "webpage:index" %}">IDK return back</a>
</div>
</body>
</html>

View File

@ -0,0 +1,26 @@
{% load static %}
<div class="centerade">
<div>
<a href="https://fediring.net/previous?host=yari.fai.st">
<img style="height: 30px;
width: auto"
src="{% static 'icons/last.png' %}"
alt="LAST" />
</a>
<a href="https://fediring.net/">
<img style="height: 30px;
width: auto"
src="{% static 'icons/fediring.png' %}"
alt="FEDIRING" />
</a>
<a href="https://fediring.net/next?host=yari.fai.st">
<img style="height: 30px;
width: auto"
src="{% static 'icons/next.png' %}"
alt="NEXT" />
</a>
</div>
<p>
Fediring links
</p>
</div>

View File

@ -0,0 +1,6 @@
{% load static %}
<head>
<link rel="stylesheet" href="{% static 'style.css' %}" />
<link rel="icon" href="{% static 'icon.png' %}" />
<title>{{ title }}</title>
</head>

86
webpage/templates/index.html Executable file
View File

@ -0,0 +1,86 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
{% include "head.html" %}
<body id="index">
{% include "fediring.html" %}
<div id="noscript">
<div class="centercubeplease">
<h1>
I'm bizcochito, hey!
</h1>
<h2>
-Pages:
</h2>
<ul class="disclosure-closed">
<li>
<a href=" {% url 'webpage:signbook' %} ">Signbook</a>
</li>
</ul>
<h2>
-Banners
</h2>
<div class="img">
{% for gif in banger_list %}
<img style="max-height:50px;width:auto" src="{% static "icons/banner/" %}{{ gif.name }}" alt="{{ gif.url }}" />
{% endfor %}
</div>
<h2>
-Funni gifs
</h2>
<div class="img">
{% for gif in gif_list %}
<img style="max-height:50px;width:auto" src="{% static "icons/gif/" %}{{ gif.name }}" alt="{{ gif.url }}" />
{% endfor %}
</div>
<h2>
-Frens:
</h2>
<div class="img">
{% for banner in banner_list %}
<a href="https://{{ banner.url }}">
<img style="height:31px; width:81px" src="{% static "icons/88x31/" %}{{ banner.name }}" alt="{{ banner.url }}" />
</a>
{% endfor %}
</div>
<h2>
-Another banner that is unused:
</h2>
<div class="img">
<a href="">
<img style="height:33px;
width:81px"
src="{% static 'icons/coconut.png' %}"
alt="cronut.cafe/~bizcochito" />
</a>
</div>
<h2>
-NEW BANNER:
</h2>
<div class="img">
<a href="https://yari.fai.st">
<img style="height:33px;
width:81px"
src="{% static 'icons/bizcochito.gif' %}"
alt="yari.fai.st" />
</a>
</div>
</div>
<div class="centerade">
<a>
<img src="{% static "ads/hor/" %}{{ ad }}" alt="ad" />
</a>
</div>
</div>
<script>
function nojs() {
document.getElementById("noscript").style.display = "block";
document.getElementById("nojs").style.display = "none";
}
document.getElementById("noscript").style.display = "none";
document.write(
'<div id="nojs" class="centercubeplease"><p>To see the website please disable JS</p><p><a href="#" onclick="nojs()">I cant do that, daddy google does not LET me :(</a></p></div>'
);
</script>
</body>
</html>

58
webpage/templates/signbook.html Executable file
View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
{% include "head.html" %}
<body id="index">
<div class="centercubeplease">
<h1>
Cool signers:
</h1>
{% if signer_list %}
<p>
<ul>
{% for signer in signer_list %}
<li>
<a href="https://{{ signer.website }}">
<b>
{{ signer.name }}
</b>
</a> said:
<b>
{{ signer.comment }}.
</b>
{% if signer.email %}
Pester on:
<a href="mailto:{{ signer.email }}">{{ signer.email }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</p>
{% else %}
<p>
No one signed here :(
</p>
{% endif %}
</div>
<div class="centerade">
<h2>
Be part of this cuties!
</h2>
<p>
<p>
<form method="post" action="">
{% csrf_token %}
{% if error_message %}
<p>
<strong>{{ error_message }}</strong>
</p>
{% endif %}
<table>
{{ form.as_table }}
</table>
<input type="submit" />
</form>
</p>
</p>
</div>
</body>
</html>

3
webpage/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

10
webpage/urls.py Normal file
View File

@ -0,0 +1,10 @@
from django.urls import path
from . import views
app_name = "webpage"
urlpatterns = [
path("signbook/", views.signbook, name="signbook"),
path("about/", views.about, name="about"),
path("", views.index, name="index"),
]

102
webpage/views.py Executable file
View File

@ -0,0 +1,102 @@
import os
import random
from django.forms import ValidationError
from django.http import HttpResponseNotFound
from django.shortcuts import render
from .models import Booksigner
from .forms import SignbookForm
def image_dict_from_name_list(name_list: list[str]):
dict_list = []
for name in name_list:
url = name.split(".")
url.pop()
url = ".".join(url)
dict_list.append({
"name": name,
"url": url
}
)
return dict_list
def index(request):
# Get random ad from ad dir
ad_list = os.listdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "webpage", "static/ads/hor/"))
ad = random.choice(ad_list)
# Get list of 81x33 icons
banner_list = image_dict_from_name_list(os.listdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "webpage", "static/icons/88x31/")))
# Get list of funni gifs
gif_list = image_dict_from_name_list(os.listdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "webpage", "static/icons/gif/")))
# Get list of banners
banger_list = image_dict_from_name_list(os.listdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "webpage", "static/icons/banner/")))
if not ad or not banner_list or not gif_list:
return HttpResponseNotFound()
else:
context = {
"title": "THE INDEX",
"ad": ad,
"banner_list": banner_list,
"gif_list": gif_list,
"banger_list": banger_list,
}
return render(request,"index.html", context)
def about(request):
return render(request, "about.html", {"title": "About Me"})
def signbook(request):
signer_list = Booksigner.objects.all()
if request.method == 'POST':
form = SignbookForm(request.POST)
try:
if form.is_valid() and form.validate_capcha():
newsigner = {}
newsigner["name"] = form.cleaned_data['name']
newsigner["website"] = form.cleaned_data['website']
newsigner["email"] = form.cleaned_data['email']
newsigner["comment"] = form.cleaned_data['comment']
signer_list = Booksigner.objects.all()
if newsigner:
Booksigner.objects.create(
name=newsigner["name"],
email=newsigner["email"],
website=newsigner["website"],
comment=newsigner["comment"],
)
context = {
"title": "THE GUESTBOOK",
"signer_list": signer_list
}
return render(request, "signbook.html", context)
context = {
"title": "THE GUESTBOOK",
"signer_list": signer_list,
"error_message": "You didn't input a required input.",
}
return render(
request,
"signbook.html",
context
)
except ValidationError as e:
print("Error: ", e)
context = {
"title": "THE GUESTBOOK",
"signer_list": signer_list,
"error_message": "Invalid captcha.",
}
return render(
request,
"signbook.html",
context
)
else:
context = {
"title": "THE GUESTBOOK",
"signer_list": signer_list,
"form": SignbookForm()
}
return render(request, "signbook.html", context)