forked from vieter-v/vieter
Bumped v release; files are now served properly
parent
3c0b7156c1
commit
8a0beffbe2
|
@ -13,5 +13,6 @@ pipeline:
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
path:
|
path:
|
||||||
|
- Makefile
|
||||||
- Dockerfile.builder
|
- Dockerfile.builder
|
||||||
- patches/*
|
- patches/*
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -2,7 +2,7 @@
|
||||||
SRC_DIR := src
|
SRC_DIR := src
|
||||||
SOURCES != find '$(SRC_DIR)' -iname '*.v'
|
SOURCES != find '$(SRC_DIR)' -iname '*.v'
|
||||||
|
|
||||||
V_RELEASE := weekly.2022.04
|
V_RELEASE := weekly.2022.05
|
||||||
V_PATH ?= v-$(V_RELEASE)/v
|
V_PATH ?= v-$(V_RELEASE)/v
|
||||||
V := $(V_PATH) -showcc
|
V := $(V_PATH) -showcc
|
||||||
|
|
||||||
|
@ -70,4 +70,4 @@ v-$(V_RELEASE)/v:
|
||||||
make -C 'v-$(V_RELEASE)'
|
make -C 'v-$(V_RELEASE)'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf '$(LARCHIVE_DIR)' 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'v-$(V_RELEASE)'
|
rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'v-$(V_RELEASE)'
|
||||||
|
|
|
@ -44,9 +44,8 @@ fn (r &Repo) sync() ? {
|
||||||
C.archive_write_add_filter_gzip(a_files)
|
C.archive_write_add_filter_gzip(a_files)
|
||||||
C.archive_write_set_format_pax_restricted(a_files)
|
C.archive_write_set_format_pax_restricted(a_files)
|
||||||
|
|
||||||
// TODO add symlink to .tar.gz version
|
db_path := os.join_path_single(r.repo_dir, 'vieter.db.tar.gz')
|
||||||
db_path := os.join_path_single(r.repo_dir, 'repo.db')
|
files_path := os.join_path_single(r.repo_dir, 'vieter.files.tar.gz')
|
||||||
files_path := os.join_path_single(r.repo_dir, 'repo.files')
|
|
||||||
|
|
||||||
C.archive_write_open_filename(a_db, &char(db_path.str))
|
C.archive_write_open_filename(a_db, &char(db_path.str))
|
||||||
C.archive_write_open_filename(a_files, &char(files_path.str))
|
C.archive_write_open_filename(a_files, &char(files_path.str))
|
||||||
|
|
10
src/routes.v
10
src/routes.v
|
@ -27,7 +27,7 @@ fn is_pkg_name(s string) bool {
|
||||||
|
|
||||||
['/health'; get]
|
['/health'; get]
|
||||||
pub fn (mut app App) healthcheck() web.Result {
|
pub fn (mut app App) healthcheck() web.Result {
|
||||||
return app.text('Healthy')
|
return app.text('Healthy')
|
||||||
}
|
}
|
||||||
|
|
||||||
// get_root handles a GET request for a file on the root
|
// get_root handles a GET request for a file on the root
|
||||||
|
@ -35,10 +35,12 @@ pub fn (mut app App) healthcheck() web.Result {
|
||||||
fn (mut app App) get_root(filename string) web.Result {
|
fn (mut app App) get_root(filename string) web.Result {
|
||||||
mut full_path := ''
|
mut full_path := ''
|
||||||
|
|
||||||
if is_pkg_name(filename) {
|
if filename.ends_with('.db') || filename.ends_with('.files') {
|
||||||
full_path = os.join_path_single(app.repo.pkg_dir, filename)
|
full_path = os.join_path_single(app.repo.repo_dir, '${filename}.tar.gz')
|
||||||
|
} else if filename.ends_with('.db.tar.gz') || filename.ends_with('.files.tar.gz') {
|
||||||
|
full_path = os.join_path_single(app.repo.repo_dir, '$filename')
|
||||||
} else {
|
} else {
|
||||||
full_path = os.join_path_single(app.repo.repo_dir, filename)
|
full_path = os.join_path_single(app.repo.pkg_dir, filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.file(full_path)
|
return app.file(full_path)
|
||||||
|
|
|
@ -262,7 +262,6 @@ pub fn (mut ctx Context) file(f_path string) Result {
|
||||||
if ctx.done {
|
if ctx.done {
|
||||||
return Result{}
|
return Result{}
|
||||||
}
|
}
|
||||||
ctx.done = true
|
|
||||||
|
|
||||||
if !os.is_file(f_path) {
|
if !os.is_file(f_path) {
|
||||||
return ctx.not_found()
|
return ctx.not_found()
|
||||||
|
|
Loading…
Reference in New Issue