Skip to content

Commit

Permalink
Merge pull request #3 from kevinlee-06/unstable
Browse files Browse the repository at this point in the history
Unstable
  • Loading branch information
kevinlee-06 authored Feb 6, 2025
2 parents 18f785b + a90e4ea commit 0d3ee3f
Show file tree
Hide file tree
Showing 20 changed files with 754 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-ghcr-unstable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Build and push
run: |
export TZ="Asia/Taipei"
VERSION=$(date +'%Y-%m-%d.%H.%M.%S')
VERSION=unstable-$(date +'%Y-%m-%d.%H.%M.%S')
docker login ghcr.io -u kevinlee-06 -p ${{secrets.GH_PAT}};
docker build -t ghcr.io/kevinlee-06/linklie:${VERSION} .
docker tag ghcr.io/kevinlee-06/linklie:${VERSION} ghcr.io/kevinlee-06/linklie:unstable
Expand Down
93 changes: 93 additions & 0 deletions docs/api.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>API - Linklie 短網址伺服器</title>
<link rel="icon" href="/public/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<h1>Linklie 短網址伺服器</h1>
<nav>
<ul>
<li><a href="index.html">首頁</a></li>
<li><a href="features.html">特色</a></li>
<li><a href="deploying.html">部屬</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie">GitHub</a></li>
<li><a href="api.html">API</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie/blob/main/docs/DELETE-API.md">刪除 API</a></li>
</ul>
</nav>
</header>
<main>
<h2>概述</h2>
<p>此 API 允許用戶使用自定義 ID 和密碼來縮短 URL,以便將來刪除。API 端點接受 POST 請求以在數據庫中創建縮短的 URL 條目。</p>

<h2>端點</h2>

<h3>POST `/shorten`</h3>
<p>此端點用於縮短給定的 URL。</p>

<h4>請求主體</h4>
<p>請求主體必須是包含以下字段的 JSON 對象:</p>
<ul>
<li><strong>url</strong> (字符串,必填):您想要縮短的長 URL。</li>
<li><strong>id</strong> (字符串,必填):縮短 URL 的自定義 ID。此 ID 必須是唯一的。</li>
<li><strong>password</strong> (字符串,非必填):將用於稍後刪除縮短 URL 的密碼。</li>
</ul>

<h4>範例請求</h4>
<pre><code>{
"url": "https://long-url.com",
"id": "short-id",
"password": "password-for-deletion"
}</code></pre>

<h4>回應</h4>
<p>回應將是一個 JSON,包含原始 URL、自定義 ID 和用於刪除的密碼。</p>

<h5>成功 (HTTP 200)</h5>
<pre><code>{
"url": "https://long-url.com",
"id": "short-id",
"password": "password-for-deletion"
}</code></pre>

<blockquote>
<p><strong>注意:</strong></p>
<ul>
<li>自定義 ID 必須是唯一的;如果 ID 已經存在於資料庫中,請求將以 400 狀態碼回傳失敗。</li>
<li>密碼在存儲到數據庫之前會被哈希處理以確保安全。</li>
<li>確保請求主體正確格式化為 JSON。</li>
</ul>
</blockquote>

<h5>錯誤回應:</h5>
<ol>
<strong>HTTP 400</strong>
</ol>

<h2>範例用法</h2>
<p>要縮短 URL,您可以使用像 <code>curl</code> 這樣的工具:</p>
<pre><code>curl -X POST https://LINKLIE_SERVER/shorten \
-H "Content-Type: application/json" \
-d '{
"url": "https://long-url.com",
"id": "short-id",
"password": "password-for-deletion"
}'
</code></pre>
<p>如果成功,這將回傳縮短的 URL 詳情,或者如果請求有問題,則回傳錯誤消息。</p>

<blockquote>
<p><strong>注意:</strong></p>
<p>不要忘記將 <code>LINKLIE_SERVER</code> 替換為您的 Linklie 伺服器的實際 URL。</p>
</blockquote>
</main>
<footer>
<p>&copy; 2025 [email protected]</p>
</footer>
</body>
</html>
39 changes: 39 additions & 0 deletions docs/contributing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Contributing - Linklie 短網址伺服器</title>
<link rel="icon" href="/public/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<h1>Linklie 短網址伺服器</h1>
<nav>
<ul>
<li><a href="index.html">首頁</a></li>
<li><a href="features.html">特色</a></li>
<li><a href="deploying.html">部屬</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie">GitHub</a></li>
<li><a href="api.html">API</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie/blob/main/docs/DELETE-API.md">刪除 API</a></li>
</ul>
</nav>
</header>
<main>
<h2>How to Contribute</h2>
<p>We welcome contributions! Here’s how you can help:</p>
<ul>
<li>Fork the repository</li>
<li>Create a new branch</li>
<li>Make your changes</li>
<li>Submit a pull request</li>
</ul>
</main>
<footer>
<p>&copy; 2025 [email protected]</p>
</footer>
</body>
</html>

32 changes: 32 additions & 0 deletions docs/deploying.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Deploying - Linklie 短網址伺服器</title>
<link rel="icon" href="/public/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<h1>Linklie 短網址伺服器</h1>
<nav>
<ul>
<li><a href="index.html">首頁</a></li>
<li><a href="features.html">特色</a></li>
<li><a href="deploying.html">部屬</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie">GitHub</a></li>
<li><a href="api.html">API</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie/blob/main/docs/DELETE-API.md">刪除 API</a></li>
</ul>
</nav>
</header>
<main>
<h2>如何部屬</h2>
<p>有關如何部屬應用程式的指示,請參閱 <a href="https://github.com/kevinlee-06/Linklie/blob/main/docs/DEPLOY.md" target="_blank">部屬指南</a></p>
</main>
<footer>
<p>&copy; 2025 [email protected]</p>
</footer>
</body>
</html>
83 changes: 83 additions & 0 deletions docs/features.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Features - Linklie 短網址伺服器</title>
<link rel="icon" href="/public/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<h1>Linklie 短網址伺服器</h1>
<nav>
<ul>
<li><a href="index.html">首頁</a></li>
<li><a href="features.html">特色</a></li>
<li><a href="deploying.html">部屬</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie">GitHub</a></li>
<li><a href="api.html">API</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie/blob/main/docs/DELETE-API.md">刪除 API</a></li>
</ul>
</nav>
</header>
<main>
<div style="text-align: center; align-items: center; display: flex; flex-direction: column;">
<div>
<img src="logo.png" style="margin: 10px;" class="logo">
<a href="https://ntut.club">
<img
alt="An NPC Project"
src="https://img.shields.io/badge/An_NPC_Project-333?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0iI2ZmZiI%2BPHBhdGggZD0iTTQgNHYyNGw4LTggMTYgOFY0bC04IDh6Ii8%2BPC9zdmc%2B"
style="max-width: 100%; height: auto;"
>
</a>
</div>
</div>

<h2>功能</h2>

<h3>刪除的密碼保護</h3>
<ul>
<li>刪除 URL 時需要輸入密碼。您可以在網頁控制台中設置刪除密碼。</li>
<li>密碼以哈希形式存儲在數據庫中。</li>
</ul>

<h3>網頁介面</h3>
<ul>
<li>提供簡單的網頁介面,使用戶能夠輕鬆添加和刪除 URL。</li>
<li>用戶可以在伺服器的根 URL 訪問 UI。</li>
</ul>
<img src="image.png" alt="Web UI" style="max-width: 100%; height: auto;" />

<h3>自定義 URL</h3>
<ul>
<li>用戶可以創建自定義的短 URL,而不是隨機生成的鏈接。此功能便於記憶鏈接。</li>
</ul>

<h3>開源</h3>
<ul>
<li>Linklie 是免費和開源的,並可在 <a href="https://github.com/kevinlee-06/linklie">GitHub</a> 上獲得。歡迎貢獻!</li>
</ul>

<h3>輕鬆部署</h3>
<ul>
<li>Linklie 可以使用 Docker 或 Node.js 輕鬆部署。請按照以下說明快速啟動伺服器。</li>
</ul>

<h3>API</h3>
<ul>
<li>Linklie 提供簡單的 API 用於創建和刪除 URL。API 可以通過 HTTP 請求訪問。</li>
<li>用戶可以使用 API 創建自己的網頁儀表板。</li>
</ul>

<h3>無日誌政策</h3>
<ul>
<li>伺服器不存儲任何訪客日誌,確保用戶隱私和數據保護。</li>
</ul>
</main>
<footer>
<p>&copy; 2025 [email protected]</p>
</footer>
</body>
</html>
Binary file modified docs/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Linklie 短網址伺服器</title>
<link rel="icon" href="/public/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<h1>Linklie 短網址伺服器</h1>
<nav>
<ul>
<li><a href="index.html">首頁</a></li>
<li><a href="features.html">特色</a></li>
<li><a href="deploying.html">部屬</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie">GitHub</a></li>
<li><a href="api.html">API</a></li>
<li><a href="https://github.com/kevinlee-06/Linklie/blob/main/docs/DELETE-API.md">刪除 API</a></li>
</ul>
</nav>
</header>
<main>
<div class="flex-container">
<div>
<h2>UI 展示</h2>
<p>
<a href="https://ntut.uk">ntut.uk</a>
上面可以試用,但資料會不定期清理~
</p>
</div>
<img src="logo.png" alt="Linklie Logo" class="logo">
</div>
<img src="image.png" width="100%" style="margin-top: 20px;">
</main>
<footer>
<p>&copy; 2025 [email protected]</p>
</footer>
</body>
</html>
Binary file removed docs/logo.jpg
Binary file not shown.
Loading

0 comments on commit 0d3ee3f

Please sign in to comment.