From b471cbde1e733fa30ad69da59cee21bcf8e66ea1 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Sun, 25 Jan 2026 17:24:19 -0500 Subject: Use Phosphor Icons --- cgithub/src/index.ts | 4 +++ cgithub/static/icons/eye.svg | 1 + cgithub/static/icons/file.svg | 1 + cgithub/static/icons/folder-simple.svg | 1 + cgithub/static/icons/git-branch.svg | 1 + cgithub/static/icons/git-fork.svg | 1 + cgithub/static/icons/link.svg | 1 + cgithub/static/icons/star.svg | 1 + cgithub/static/style.css | 5 ++++ cgithub/views/_tree.eta | 3 ++- cgithub/views/home.eta | 47 ++++++++++++++++++++++++++++++++++ cgithub/views/layout.eta | 2 +- cgithub/views/repo.eta | 8 +++--- 13 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 cgithub/static/icons/eye.svg create mode 100644 cgithub/static/icons/file.svg create mode 100644 cgithub/static/icons/folder-simple.svg create mode 100644 cgithub/static/icons/git-branch.svg create mode 100644 cgithub/static/icons/git-fork.svg create mode 100644 cgithub/static/icons/link.svg create mode 100644 cgithub/static/icons/star.svg create mode 100644 cgithub/views/home.eta (limited to 'cgithub') diff --git a/cgithub/src/index.ts b/cgithub/src/index.ts index 393c5ec..43d4cfa 100644 --- a/cgithub/src/index.ts +++ b/cgithub/src/index.ts @@ -13,6 +13,10 @@ const eta = new Eta({ views: path.join(__dirname, "..", "views") }); app.use("/static/*", serveStatic({ root: path.join(__dirname, "..") })); +app.get("/", async (c) => { + return c.html(await eta.renderAsync("home.eta", {})); +}); + app.get("/:owner/:repo", async (c) => { const { owner, repo } = c.req.param(); const data = await getGitHubRepo(owner, repo); diff --git a/cgithub/static/icons/eye.svg b/cgithub/static/icons/eye.svg new file mode 100644 index 0000000..f6f8230 --- /dev/null +++ b/cgithub/static/icons/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/icons/file.svg b/cgithub/static/icons/file.svg new file mode 100644 index 0000000..f2e7629 --- /dev/null +++ b/cgithub/static/icons/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/icons/folder-simple.svg b/cgithub/static/icons/folder-simple.svg new file mode 100644 index 0000000..36acab2 --- /dev/null +++ b/cgithub/static/icons/folder-simple.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/icons/git-branch.svg b/cgithub/static/icons/git-branch.svg new file mode 100644 index 0000000..4b442e2 --- /dev/null +++ b/cgithub/static/icons/git-branch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/icons/git-fork.svg b/cgithub/static/icons/git-fork.svg new file mode 100644 index 0000000..ca318b2 --- /dev/null +++ b/cgithub/static/icons/git-fork.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/icons/link.svg b/cgithub/static/icons/link.svg new file mode 100644 index 0000000..25ffe17 --- /dev/null +++ b/cgithub/static/icons/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/icons/star.svg b/cgithub/static/icons/star.svg new file mode 100644 index 0000000..4e640f4 --- /dev/null +++ b/cgithub/static/icons/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cgithub/static/style.css b/cgithub/static/style.css index bd36dce..e552787 100644 --- a/cgithub/static/style.css +++ b/cgithub/static/style.css @@ -4,6 +4,11 @@ body { font-family: Helvetica, Arial, sans-serif; } +.icon { + height: 1lh; + vertical-align: text-bottom; +} + pre.blob { margin: 1rem 0; padding: 1rem; diff --git a/cgithub/views/_tree.eta b/cgithub/views/_tree.eta index ac7b2b1..2549bb8 100644 --- a/cgithub/views/_tree.eta +++ b/cgithub/views/_tree.eta @@ -2,10 +2,11 @@ <% for (const item of it.items) { %> - <%= item.contentType === 'directory' ? '📁' : '📄' %> <% if (item.contentType === 'directory') { %> + tree <%= item.name %> <% } else { %> + blob <%= item.name %> <% } %> diff --git a/cgithub/views/home.eta b/cgithub/views/home.eta new file mode 100644 index 0000000..adb71f2 --- /dev/null +++ b/cgithub/views/home.eta @@ -0,0 +1,47 @@ + + + + + cgithub + + + +
+

cgithub

+

Lightweight GitHub alternative frontend

+
+ +
+

Browse any GitHub repository by navigating to /:owner/:repo

+
+ +

Credits

+

Icons by Phosphor Icons

+
+ Phosphor Icons License (MIT) +
+MIT License
+
+Copyright (c) 2023 Phosphor Icons
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+    
+
+ + diff --git a/cgithub/views/layout.eta b/cgithub/views/layout.eta index 8e5d9d9..982f8c0 100644 --- a/cgithub/views/layout.eta +++ b/cgithub/views/layout.eta @@ -8,7 +8,7 @@

<%= it.repo.owner %>/<%= it.repo.name %>

-
branch: <%= it.branch %>
+
branch <%= it.branch %>
<% if (it.path) { %>
path: root<% diff --git a/cgithub/views/repo.eta b/cgithub/views/repo.eta index 0b345df..4338708 100644 --- a/cgithub/views/repo.eta +++ b/cgithub/views/repo.eta @@ -6,16 +6,16 @@
<%= it.info.description %>
<% } %> <% if (it.info.website) { %> -
<%= it.info.website %>
+
<%= it.info.website %>
<% } %> <% if (it.info.stars) { %> - ★ <%= it.info.stars %> + stars <%= it.info.stars %> <% } %> <% if (it.info.watchers) { %> - 👁 <%= it.info.watchers %> + watchers <%= it.info.watchers %> <% } %> <% if (it.info.forks) { %> - 🔀 <%= it.info.forks %> + forks <%= it.info.forks %> <% } %>
<% } %> -- cgit v1.3.1