diff --git a/.env.example b/.env.example
index aa48810..5734690 100644
--- a/.env.example
+++ b/.env.example
@@ -1,5 +1,6 @@
NAME=Krll
HOST=https://krll.me
+CONTACT=mailto:example@gmail.com
POSTGRES_HOST=db:5432
POSTGRES_DATABASE=postgres
diff --git a/.gitignore b/.gitignore
index 85e47f7..b307255 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,6 @@ __pycache__/
docker-compose.yml
-postgres/
\ No newline at end of file
+postgres/
+
+rule.html
\ No newline at end of file
diff --git a/README.md b/README.md
index ab8240b..c15f9ac 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,22 @@
# Krll
-Krll, a privacy-friendly URL shortener
+Krll, a privacy-friendly open source URL shortener
https://krll.me
-## Dev
-Copy `.env.example` to `.env` and edit it
-```
+## Run
+1. Copy `.env.example` to `.env` and edit it
+- NAME: Krll server's name(ex: Krll)
+- HOST: Krll server's host(ex: https://krll.me)
+- CONTACT: Server operator's contact info
+- POSTGRES_...: PostgreSQL setting(If you'll run postgresql with docker compose, you should edit just 'POSTGRES_PASSWORD', if not, you should edit 'POSTGRES_HOST' to your postgresql's host.)
+
+2. RUN
+```bash
+# with docker compose
+cp docker-compose.example.yml docker-compose.yml
+docker compose up -d
+
+# without docker compose
python -m venv venv
source ./venv/bin/activate/
pip install -r requirements.txt
diff --git a/main.py b/main.py
index 9732edf..5d43557 100644
--- a/main.py
+++ b/main.py
@@ -7,11 +7,17 @@ from fastapi.templating import Jinja2Templates
from src.database import engine
from src import models
from src.routes.url import url_route
+from src.env import NAME, HOST, CONTACT
-from src.env import NAME, HOST
+import os
-DEFAULT_CONTEXT = { "name": NAME, "host": HOST }
+# server's settings
+DEFAULT_CONTEXT = { "name": NAME, "host": HOST, "contact": CONTACT }
+
+# server's rule page
+rule_f = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "rule.html"))
+RULE = "\n".join(rule_f.readlines())
models.Base.metadata.create_all(bind=engine)
@@ -44,6 +50,15 @@ def index(request: Request):
)
+@app.get("/rule", response_class=HTMLResponse)
+def rule(request: Request):
+ return templates.TemplateResponse(
+ request=request,
+ name="rule_frame.html",
+ context=DEFAULT_CONTEXT | { "rule": RULE }
+ )
+
+
@app.get("/about", response_class=HTMLResponse)
def about(request: Request):
return templates.TemplateResponse(
diff --git a/rule.example.html b/rule.example.html
new file mode 100644
index 0000000..2595936
--- /dev/null
+++ b/rule.example.html
@@ -0,0 +1,5 @@
+
Rule
+
+ - Do not use Krll for spam.
+ - Be legal.
+
\ No newline at end of file
diff --git a/src/env.py b/src/env.py
index d88eb34..c79b859 100644
--- a/src/env.py
+++ b/src/env.py
@@ -6,6 +6,7 @@ load_dotenv()
NAME = os.environ.get("NAME")
HOST = os.environ.get("HOST")
+CONTACT = os.environ.get("CONTACT")
POSTGRES_DATABASE = os.environ.get("POSTGRES_DATABASE")
POSTGRES_USER = os.environ.get("POSTGRES_USER")
diff --git a/static/about/style.css b/static/about/style.css
index 9f768c6..950001c 100644
--- a/static/about/style.css
+++ b/static/about/style.css
@@ -1,5 +1,7 @@
main {
align-items: center;
+ display: flex;
+ flex-direction:column;
}
section {
@@ -9,4 +11,5 @@ section {
a {
text-decoration: none;
+ color: var(--link-color);
}
\ No newline at end of file
diff --git a/static/images/logo.png b/static/images/logo.png
new file mode 100644
index 0000000..81591e0
Binary files /dev/null and b/static/images/logo.png differ
diff --git a/static/dQw4w9WgXcQ.js b/static/index/dQw4w9WgXcQ.js
similarity index 100%
rename from static/dQw4w9WgXcQ.js
rename to static/index/dQw4w9WgXcQ.js
diff --git a/static/script.js b/static/index/script.js
similarity index 100%
rename from static/script.js
rename to static/index/script.js
diff --git a/static/style.css b/static/index/style.css
similarity index 94%
rename from static/style.css
rename to static/index/style.css
index 440f791..216f86b 100644
--- a/static/style.css
+++ b/static/index/style.css
@@ -1,5 +1,8 @@
main {
align-items: center;
+ padding-top: 100px;
+ display: flex;
+ flex-direction:column;
}
.input-container {
diff --git a/static/menu.js b/static/menu.js
new file mode 100644
index 0000000..34f34b0
--- /dev/null
+++ b/static/menu.js
@@ -0,0 +1,14 @@
+const menu_btn = document.getElementById("menu-btn");
+const menu = document.getElementById("menu");
+
+menu_btn.onclick = () => {
+ menu.classList.toggle("show");
+}
+
+window.onclick = e => {
+ if (!e.target.matches(".menu-btn")) {
+ if (menu.classList.contains("show")) {
+ menu.classList.remove("show");
+ }
+ }
+}
\ No newline at end of file
diff --git a/static/root.css b/static/root.css
index cf6722f..936ac1e 100644
--- a/static/root.css
+++ b/static/root.css
@@ -2,6 +2,7 @@
* {
font-family: 'Poppins', sans-serif;
+ box-sizing: border-box;
}
:root {
@@ -13,7 +14,7 @@
--text-color: light-dark(black, white);
--footer-text-color: light-dark(rgb(90, 90, 90), rgb(173, 173, 173));
--button-text-color: white;
- --link-color: light-dark(#2e2e2e, #7a7a7a);
+ --link-color: light-dark(#797979, #9e9e9e);
--border-color: light-dark(lightgray, gray);
--border-highlight-color: darkgray;
@@ -28,14 +29,68 @@ body {
flex-direction: column;
margin: 0;
background-color: var(--background-color);
- padding-top: 100px;
box-sizing: border-box;
}
-main {
+header ul {
+ padding: 10px;
+ margin: 0;
display: flex;
- flex-direction:column;
- flex: 1 0 auto;
+ align-items: center;
+}
+
+header ul * {
+ margin: 0 5px;
+}
+
+header img {
+ width: 40px;
+ height: 40px;
+ margin-top: 5px;
+}
+
+header button {
+ background: none;
+ border: none;
+ cursor: pointer;
+}
+
+.menu {
+ display: none;
+ flex-direction: column;
+ font-size: 17px;
+ background-color: var(--input-background-color);
+ position: absolute;
+ margin-top: 5px;
+ margin-left: 5px;
+ border-radius: 5px;
+ width: 200px;
+}
+
+.show {
+ display: flex;
+}
+
+.menu a {
+ text-decoration: none;
+ color: var(--text-color);
+ width: 100%;
+ padding: 20px;
+}
+
+.menu a:hover {
+ background-color: rgba(0, 0, 0, 0.3);
+}
+
+/* @media screen and (max-width: 1000px) {
+ .menu {
+ width: 100vw;
+ height: 100%;
+ }
+} */
+
+main {
+ height: 100%;
}
footer {
diff --git a/static/rule/style.css b/static/rule/style.css
new file mode 100644
index 0000000..8dccca1
--- /dev/null
+++ b/static/rule/style.css
@@ -0,0 +1,15 @@
+main {
+ align-items: center;
+ display: flex;
+ flex-direction: column;
+}
+
+section {
+ width: 90%;
+ max-width: 600px;
+}
+
+a {
+ text-decoration: none;
+ color: var(--link-color);
+}
\ No newline at end of file
diff --git a/templates/about.html b/templates/about.html
index 654a7d6..44bab47 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -10,26 +10,16 @@
About Krll
- Krll은 개인정보 수집 없이 URL을 단축하는 서비스입니다. 방해꾼 없이 빠르게 URL을 단축하고 공유하세요.
- repository: https://git.worldc.one/sunwoo1524/krll
+ Krll은 개인정보 수집이 없는 오픈 소스 링크 단축 서비스입니다.
- 특징
-
- - 개인정보 수집과 광고가 없습니다.
- - 단축 시 QR 코드가 함께 생성되어 다른 디바이스로 빠르게 공유할 수 있습니다.
- - 크롬, 파이어폭스 확장을 설치하여 웹사이트 내의 하이퍼링크를 우클릭 후 메뉴 선택 만으로 빠르게 단축할 수 있습니다.
-
+ 기여하기
+ Krll은 MIT 라이센스가 적용되어 누구나 코드를 사용하고 이 프로젝트에 기여할 수 있습니다. 하지만 한 가지 부탁 드릴 것이 있습니다. GitHub에 Krll의 코드를 업로드하지 말아주세요.
+ 자체 호스팅 중인 Forgejo에서 기여할 수 있습니다.
- 브라우저 확장
+ 브라우저 확장
+ 크롬, 파이어폭스 확장을 설치하여 웹사이트 내의 하이퍼링크를 우클릭 후 메뉴 선택 만으로 빠르게 단축할 수 있습니다.
Chrome(스토어에 올라와있지 않아 직접 압축 파일로 다운로드하고 설치해야합니다.)
Firefox
-
- 규칙
- 이것들을 막을 방법은 없지만 안정적인 서비스 운영을 위해서 따라주세요.
-
- - 대한민국 법에 저촉되는 링크를 단축하지 마세요.
- - 스팸을 위해서 사용하지 마세요.
-
{% endblock %}
diff --git a/templates/index.html b/templates/index.html
index 03de80d..de8246f 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,7 +3,7 @@
{% block head %}
{{ super() }}
-
+
{% endblock %}
{% block content %}
@@ -25,5 +25,5 @@
const host = "{{ host }}";
-
+
{% endblock %}
diff --git a/templates/layout.html b/templates/layout.html
index 27b0459..2462b0b 100644
--- a/templates/layout.html
+++ b/templates/layout.html
@@ -7,14 +7,32 @@
{% block title %}{% endblock %}
+
+
+
+
{% endblock %}
+
+
+
+
+
+
+
+
+
{% block content %}{% endblock %}
+
+