Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ cpu.out
/public/css
/public/fonts
/public/img/webpack
/public/assets/js
/public/assets/css
/public/assets/fonts
/public/assets/img/webpack
/vendor
/web_src/fomantic/node_modules
/web_src/fomantic/build/*
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ FOMANTIC_WORK_DIR := web_src/fomantic

WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
WEBPACK_CONFIGS := webpack.config.js
WEBPACK_DEST := public/js/index.js public/css/index.css
WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts public/assets/img/webpack

BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))

GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go

SVG_DEST_DIR := public/img/svg
SVG_DEST_DIR := public/assets/img/svg

AIR_TMP_DIR := .air

Expand Down
6 changes: 3 additions & 3 deletions build/generate-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function processFile(file, {prefix, fullName} = {}) {
],
});

await writeFile(fileURLToPath(new URL(`../public/img/svg/${name}.svg`, import.meta.url)), data);
await writeFile(fileURLToPath(new URL(`../public/assets/img/svg/${name}.svg`, import.meta.url)), data);
}

function processFiles(pattern, opts) {
Expand All @@ -53,13 +53,13 @@ function processFiles(pattern, opts) {

async function main() {
try {
await mkdir(fileURLToPath(new URL('../public/img/svg', import.meta.url)), {recursive: true});
await mkdir(fileURLToPath(new URL('../public/assets/img/svg', import.meta.url)), {recursive: true});
} catch {}

await Promise.all([
...processFiles('node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
...processFiles('web_src/svg/*.svg'),
...processFiles('public/img/gitea.svg', {fullName: 'gitea-gitea'}),
...processFiles('public/assets/img/gitea.svg', {fullName: 'gitea-gitea'}),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func setWellKnownContentType(w http.ResponseWriter, file string) {

func handleRequest(w http.ResponseWriter, req *http.Request, fs http.FileSystem, file string) bool {
// actually, fs (http.FileSystem) is designed to be a safe interface, relative paths won't bypass its parent directory, it's also fine to do a clean here
f, err := fs.Open(util.PathJoinRelX(file))
f, err := fs.Open(util.PathJoinRelX("assets", file))
if err != nil {
if os.IsNotExist(err) {
return false
Expand Down
4 changes: 2 additions & 2 deletions modules/svg/svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultSize = 16

// Init discovers SVGs and populates the `SVGs` variable
func Init() error {
files, err := public.AssetFS().ListFiles("img/svg")
files, err := public.AssetFS().ListFiles("assets/img/svg")
if err != nil {
return err
}
Expand All @@ -38,7 +38,7 @@ func Init() error {
if path.Ext(file) != ".svg" {
continue
}
bs, err := public.AssetFS().ReadFile("img/svg", file)
bs, err := public.AssetFS().ReadFile("assets/img/svg", file)
if err != nil {
log.Error("Failed to read SVG file %s: %v", file, err)
} else {
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading