Remove nuxt + 100 other things..

This commit is contained in:
2020-07-08 19:46:04 +02:00
parent 3b80ae051d
commit 44b463d9d5
132 changed files with 6202 additions and 10961 deletions
+21
View File
@@ -0,0 +1,21 @@
database:
host: ${MYSQL_HOST:-localhost}
port: ${MYSQL_PORT:-3306}
name: ${MYSQL_DATABASE:-notes}
username: ${MYSQL_USER:-notes}
password: ${MYSQL_PASSWORD:-notes}
server:
host: ${HOST:-127.0.0.1}
port: ${PORT:-8081}
cors: ${CORS:-false}
jwt:
auth:
secret: ${JWT_SECRET:-uiqzRNiMYwbObn/Ps5xTasYVeu/63ZuI+1oB98Ez+lY=} # Can be generated with `openssl rand -base64 32`
validity: 24
unit: HOURS
refresh:
secret: ${JWT_REFRESH_SECRET=-wWchkx44YGig4Q5Z7b7+E/3ymGEGd6PS7UGedMul3bg=} # Can be generated with `openssl rand -base64 32`
validity: 15
unit: DAYS
@@ -0,0 +1,36 @@
create table Users
(
id int auto_increment primary key,
username varchar(50) not null,
password varchar(255) not null,
constraint username unique (username)
) character set 'utf8mb4'
collate 'utf8mb4_general_ci';
create table Notes
(
uuid binary(16) not null primary key,
title varchar(50) not null,
markdown mediumtext not null,
html mediumtext not null,
user_id int not null,
updated_at datetime null,
constraint Notes_fk_user foreign key (user_id) references Users (id) on delete cascade
) character set 'utf8mb4'
collate 'utf8mb4_general_ci';
create index user_id on Notes (user_id);
create table Tags
(
id int auto_increment primary key,
name varchar(50) not null,
note_uuid binary(16) not null,
constraint Tags_fk_note foreign key (note_uuid) references Notes (uuid) on delete cascade
) character set 'utf8mb4'
collate 'utf8mb4_general_ci';
create index note_uuid on Tags (note_uuid);
+20
View File
@@ -0,0 +1,20 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<encoder>
<pattern>%cyan(%d{YYYY-MM-dd HH:mm:ss.SSS}) [%thread] %highlight(%-5level) %magenta(%logger{36}) - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
<logger name="me.liuwj.ktorm.database" level="INFO"/>
<logger name="com.zaxxer.hikari" level="INFO"/>
<logger name="org.eclipse.jetty" level="INFO"/>
<logger name="io.netty" level="INFO"/>
<logger name="org.flywaydb.core" level="INFO"/>
<logger name="org.testcontainers" level="INFO"/>
<logger name="com.github.dockerjava" level="WARN"/>
<logger name="🐳 [mariadb:10.3.6]" level="WARN"/>
</configuration>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+2
View File
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
+16
View File
@@ -0,0 +1,16 @@
{% import "__macros__.html" as macros %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="description" content="new note"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>{{ title }} - SimpleNotes</title>
{{ macros.stylesheet("styles.css") }}
</head>
<body class="bg-gray-900 text-white">
{% include "components/navbar.html" %}
{% block content %}default content{% endblock %}
</body>
</html>
+5
View File
@@ -0,0 +1,5 @@
{% macro stylesheet(path) %}
{% set path = styles(path) %}
<link rel="preload" href="{{ path }}" as="style">
<link rel="stylesheet" href="{{ path }}">
{% endmacro %}
+8
View File
@@ -0,0 +1,8 @@
{% set title = note.title %} {% extends "__base__.html" %} {% block content %}
<div class="container mx-auto p-4">
<h1 class="text-3xl underline mb-4">{{ note.title }}</h1>
<div id="note">{{ note.html | raw }}</div>
</div>
{% endblock %}
@@ -0,0 +1,6 @@
{% macro warning(title, warning) %}
<div class="bg-red-500 border border-red-400 text-red-200 px-4 py-3 mb-4 rounded relative" role="alert">
<strong class="font-bold">{{ title }}</strong>
<span class="block sm:inline">{{ warning }}</span>
</div>
{% endmacro %}
+27
View File
@@ -0,0 +1,27 @@
<!-- {id, label, placeholder?, autocomplete?} -->
{% macro input(args) %}
<div class="mb-4">
<label
for="{{ args.id }}"
class="font-bold text-grey-darker block mb-2"
>{{ args.label }}</label>
<input
id="{{ args.id }}"
name="{{ args.id }}"
{% if args.autocomplete %}autocomplete="{{ args.autocomplete }}"{% endif %}
{% if args.placeholder %}placeholder="{{ args.placeholder }}"{% endif %}
class="shadow focus:shadow-outline block appearance-none w-full bg-gray-700 border-gray-500 hover:border-gray-500 px-2 py-2 rounded shadow"
/>
</div>
{% endmacro %}
{% macro submit(value) %}
<div class="flex items-center mt-6">
<button
type="submit"
class="w-full bg-teal-500 hover:bg-teal-400 text-white font-bold py-2 px-4 rounded"
>
{{ value }}
</button>
</div>
{% endmacro %}
@@ -0,0 +1,21 @@
<nav
class="nav bg-teal-700 shadow-md flex items-center justify-between px-4"
>
<a href="/" class="text-2xl text-gray-800 font-bold">SimpleNotes</a>
<ul>
{% if user %}
<li class="inline text-gray-800 ml-2 text-md font-semibold">
<a href="/notes">Notes</a>
</li>
<li class="inline text-gray-800 ml-2 text-md font-semibold bg-green-500 hover:bg-green-700 rounded px-4 py-2">
<form class="inline" action="/logout" method="post">
<button type="submit">Logout</button>
</form>
</li>
{% else %}
<li class="inline text-gray-800 pl-2 text-md font-semibold">
<a href="/login">Sign In</a>
</li>
{% endif %}
</ul>
</nav>
+11
View File
@@ -0,0 +1,11 @@
{% set title = status %}
{% extends "__base__.html" %}
{% block content %}
<div class="centered container mx-auto flex justify-center items-center">
<div class="bg-gray-800 md:w-1/3 w-full rounded-lg m-4 p-6 text-center">
<h1 class="text-3xl">Error</h1>
<div class="text-red-400">{{ status }}</div>
</div>
</div>
{% endblock %}
+12
View File
@@ -0,0 +1,12 @@
{% set title = "Notes" %}
{% extends "__base__.html" %}
{% block content %}
<div class="centered container mx-auto flex justify-center items-center">
<div class="bg-gray-800 md:w-1/3 w-full rounded-lg m-4 p-6 text-center">
<h1 class="text-3xl">SimpleNotes</h1>
<div class="text-teal-400">Welcome</div>
<div class="text-gray-200">TODO</div>
</div>
</div>
{% endblock %}
+24
View File
@@ -0,0 +1,24 @@
{% set title = "Notes" %}
{% extends "__base__.html" %}
{% block content %}
<div class="container mx-auto p-4">
<div class="flex justify-between">
<h1 class="text-2xl underline">Notes</h1>
<a
href="/notes/new"
class="inline text-gray-800 ml-2 text-md font-semibold bg-green-500 hover:bg-green-700 rounded px-4 py-2">New</a>
</div>
{% if notes.size() > 0 -%}
<ul>
{% for note in notes -%}
<li class="text-blue-200 hover:underline">
<a href="/notes/{{ note.uuid }}">{{ note.title }}</a>
</li>
{% endfor %}
</ul>
{% else %}
<span>No notes :c</span>
{% endif %}
</div>
{% endblock %}
+40
View File
@@ -0,0 +1,40 @@
{% set title = "Sign In" %}
{% extends "__base__.html" %}
{% block content %}
<div class="centered container mx-auto flex justify-center items-center">
<div class="w-full md:w-1/2 lg:w-1/3 m-4">
<h1 class="font-semibold text-lg mb-6 text-center">Sign In</h1>
<div
class="bg-gray-800 border-teal-500 p-8 border-t-8 bg-white mb-6 rounded-lg shadow-lg"
>
{%- if error %}
{% import "components/alert.html" as alerts %}
{{ alerts.warning("Error", error) }}
{% endif -%}
<form method="post" enctype="multipart/form-data">
{% import "components/forms.html" as forms %}
{{ forms.input({
"id": "username", "label": "Username",
"placeholder": "Your Username", "autocomplete": "username"
}) }}
{{ forms.input({
"id": "password", "label": "Password",
"placeholder": "Your Password", "autocomplete": "current-password"
}) }}
{{ forms.submit("Sign In") }}
</form>
</div>
<div class="text-center">
<p class="text-gray-200 text-sm">
Don't have an account?
<a href="/register" class="no-underline text-blue-500 font-bold">Create an Account</a>
</p>
</div>
</div>
</div>
{% endblock %}
+42
View File
@@ -0,0 +1,42 @@
{% set title = "Notes" %} {% extends "__base__.html" %} {% block content %}
<div class="container mx-auto">
<h1 class="text-2xl">{{ method }}</h1>
{%- if error %}
{% import "components/alert.html" as alerts %}
<div class="mt-4">
{{ alerts.warning("Error", error) }}
</div>
{% endif -%}
<form method="post" enctype="multipart/form-data">
<textarea
id="markdown"
name="markdown"
aria-label="markdown input"
rows="20"
class="w-full bg-gray-800 p-5 outline-none font-mono"
spellcheck="false"
>
{%- if value %}{{ value }}{% else %}
---
title: ''
---
{% endif -%}</textarea
>
<div class="mt-2">
<button
class="bg-green-500 hover:bg-green-700 rounded px-4 py-2"
type="submit"
>
Submit
</button>
</div>
</form>
<p>{{ value }}</p>
</div>
{% endblock %}
+42
View File
@@ -0,0 +1,42 @@
{% set title = "Create an Account" %}
{% extends "__base__.html" %}
{% block content %}
<div class="centered container mx-auto flex justify-center items-center">
<div class="w-full md:w-1/2 lg:w-1/3 m-4">
<h1 class="font-semibold text-lg mb-6 text-center">Create an Account</h1>
<div
class="bg-gray-800 border-teal-500 p-8 border-t-8 bg-white mb-6 rounded-lg shadow-lg"
>
{%- if error %}
{% import "components/alert.html" as alerts %}
{% for e in error %}
{{ alerts.warning("Error", e) }}
{% endfor %}
{% endif -%}
<form method="post" enctype="multipart/form-data">
{% import "components/forms.html" as forms %}
{{ forms.input({
"id": "username", "label": "Username",
"placeholder": "Your Username", "autocomplete": "username"
}) }}
{{ forms.input({
"id": "password", "label": "Password",
"placeholder": "Your Password", "autocomplete": "current-password"
}) }}
{{ forms.submit("Sign In") }}
</form>
</div>
<div class="text-center">
<p class="text-gray-200 text-sm">
Already have an account?
<a href="/login" class="no-underline text-blue-500 font-bold">Sign In</a>
</p>
</div>
</div>
</div>
{% endblock %}