diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-06 01:55:21 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-06 02:08:58 +0800 |
commit | faa5ca8fab23176d390e9522f1485d467851545b (patch) | |
tree | d3b1d081e0ea5e7f71a94dc1d301e2540a8abcc8 /resources.go | |
parent | Slight refactor on NewServer (diff) | |
download | forge-0.1.28.tar.gz forge-0.1.28.tar.zst forge-0.1.28.zip |
Move stuff into internal/unsortedv0.1.28
Diffstat (limited to '')
-rw-r--r-- | internal/unsorted/resources.go (renamed from resources.go) | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/resources.go b/internal/unsorted/resources.go index 514c0ae..d09ee60 100644 --- a/resources.go +++ b/internal/unsorted/resources.go @@ -1,25 +1,18 @@ // SPDX-License-Identifier: AGPL-3.0-only // SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> -package forge +package unsorted import ( - "embed" "html/template" "io/fs" "github.com/tdewolff/minify/v2" "github.com/tdewolff/minify/v2/html" + "go.lindenii.runxiyu.org/forge/internal/embed" "go.lindenii.runxiyu.org/forge/internal/misc" ) -//go:embed LICENSE source.tar.gz -var embeddedSourceFS embed.FS - -//go:embed templates/* static/* -//go:embed hookc/hookc git2d/git2d -var embeddedResourcesFS embed.FS - // loadTemplates minifies and loads HTML templates. func (s *Server) loadTemplates() (err error) { minifier := minify.New() @@ -37,12 +30,12 @@ func (s *Server) loadTemplates() (err error) { "minus": misc.Minus, }) - err = fs.WalkDir(embeddedResourcesFS, "templates", func(path string, d fs.DirEntry, err error) error { + err = fs.WalkDir(embed.Resources, "templates", func(path string, d fs.DirEntry, err error) error { if err != nil { return err } if !d.IsDir() { - content, err := fs.ReadFile(embeddedResourcesFS, path) + content, err := fs.ReadFile(embed.Resources, path) if err != nil { return err } |