chore: compile with -skip-unused
ci/woodpecker/pr/docs Pipeline was successful Details
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details
ci/woodpecker/pr/man Pipeline was successful Details
ci/woodpecker/pr/docker Pipeline was successful Details
ci/woodpecker/pr/test Pipeline was successful Details

pull/323/head
Jef Roosens 2022-12-22 23:10:10 +01:00
parent dc517c23c5
commit 3342eedfa4
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
7 changed files with 20 additions and 20 deletions

View File

@ -3,7 +3,7 @@ SRC_DIR := src
SOURCES != find '$(SRC_DIR)' -iname '*.v'
V_PATH ?= v
V := $(V_PATH) -showcc -gc boehm -W -d use_openssl
V := $(V_PATH) -showcc -gc boehm -W -d use_openssl -skip-unused
all: vieter

View File

@ -4,7 +4,7 @@ import web
import web.response { new_data_response, new_response }
// v1_poll_job_queue allows agents to poll for new build jobs.
['/api/v1/jobs/poll'; auth; get]
['/api/v1/jobs/poll'; auth; get; markused]
fn (mut app App) v1_poll_job_queue() web.Result {
arch := app.query['arch'] or {
return app.json(.bad_request, new_response('Missing arch query arg.'))
@ -21,7 +21,7 @@ fn (mut app App) v1_poll_job_queue() web.Result {
}
// v1_queue_job allows queueing a new one-time build job for the given target.
['/api/v1/jobs/queue'; auth; post]
['/api/v1/jobs/queue'; auth; markused; post]
fn (mut app App) v1_queue_job() web.Result {
target_id := app.query['target'] or {
return app.json(.bad_request, new_response('Missing target query arg.'))

View File

@ -11,7 +11,7 @@ import models { BuildLog, BuildLogFilter }
// v1_get_logs returns all build logs in the database. A 'target' query param can
// optionally be added to limit the list of build logs to that repository.
['/api/v1/logs'; auth; get]
['/api/v1/logs'; auth; get; markused]
fn (mut app App) v1_get_logs() web.Result {
filter := models.from_params<BuildLogFilter>(app.query) or {
return app.json(.bad_request, new_response('Invalid query parameters.'))
@ -22,7 +22,7 @@ fn (mut app App) v1_get_logs() web.Result {
}
// v1_get_single_log returns the build log with the given id.
['/api/v1/logs/:id'; auth; get]
['/api/v1/logs/:id'; auth; get; markused]
fn (mut app App) v1_get_single_log(id int) web.Result {
log := app.db.get_build_log(id) or { return app.status(.not_found) }
@ -30,7 +30,7 @@ fn (mut app App) v1_get_single_log(id int) web.Result {
}
// v1_get_log_content returns the actual build log file for the given id.
['/api/v1/logs/:id/content'; auth; get]
['/api/v1/logs/:id/content'; auth; get; markused]
fn (mut app App) v1_get_log_content(id int) web.Result {
log := app.db.get_build_log(id) or { return app.status(.not_found) }
file_name := log.start_time.custom_format('YYYY-MM-DD_HH-mm-ss')
@ -50,7 +50,7 @@ fn parse_query_time(query string) !time.Time {
}
// v1_post_log adds a new log to the database.
['/api/v1/logs'; auth; post]
['/api/v1/logs'; auth; markused; post]
fn (mut app App) v1_post_log() web.Result {
// Parse query params
start_time_int := app.query['startTime'].int()
@ -121,7 +121,7 @@ fn (mut app App) v1_post_log() web.Result {
}
// v1_delete_log allows removing a build log from the system.
['/api/v1/logs/:id'; auth; delete]
['/api/v1/logs/:id'; auth; delete; markused]
fn (mut app App) v1_delete_log(id int) web.Result {
log := app.db.get_build_log(id) or { return app.status(.not_found) }
full_path := os.join_path(app.conf.data_dir, logs_dir_name, log.path())

View File

@ -6,7 +6,7 @@ import db
import models { Target, TargetArch, TargetFilter }
// v1_get_targets returns the current list of targets.
['/api/v1/targets'; auth; get]
['/api/v1/targets'; auth; get; markused]
fn (mut app App) v1_get_targets() web.Result {
filter := models.from_params<TargetFilter>(app.query) or {
return app.json(.bad_request, new_response('Invalid query parameters.'))
@ -17,7 +17,7 @@ fn (mut app App) v1_get_targets() web.Result {
}
// v1_get_single_target returns the information for a single target.
['/api/v1/targets/:id'; auth; get]
['/api/v1/targets/:id'; auth; get; markused]
fn (mut app App) v1_get_single_target(id int) web.Result {
target := app.db.get_target(id) or { return app.status(.not_found) }
@ -25,7 +25,7 @@ fn (mut app App) v1_get_single_target(id int) web.Result {
}
// v1_post_target creates a new target from the provided query string.
['/api/v1/targets'; auth; post]
['/api/v1/targets'; auth; markused; post]
fn (mut app App) v1_post_target() web.Result {
mut params := app.query.clone()
@ -55,7 +55,7 @@ fn (mut app App) v1_post_target() web.Result {
}
// v1_delete_target removes a given target from the server's list.
['/api/v1/targets/:id'; auth; delete]
['/api/v1/targets/:id'; auth; delete; markused]
fn (mut app App) v1_delete_target(id int) web.Result {
app.db.delete_target(id)
app.job_queue.invalidate(id)
@ -64,7 +64,7 @@ fn (mut app App) v1_delete_target(id int) web.Result {
}
// v1_patch_target updates a target's data with the given query params.
['/api/v1/targets/:id'; auth; patch]
['/api/v1/targets/:id'; auth; markused; patch]
fn (mut app App) v1_patch_target(id int) web.Result {
app.db.update_target(id, app.query)

View File

@ -10,7 +10,7 @@ import web.response { new_data_response, new_response }
// healthcheck just returns a string, but can be used to quickly check if the
// server is still responsive.
['/health'; get]
['/health'; get; markused]
pub fn (mut app App) healthcheck() web.Result {
return app.json(.ok, new_response('Healthy.'))
}
@ -18,7 +18,7 @@ pub fn (mut app App) healthcheck() web.Result {
// get_repo_file handles all Pacman-related routes. It returns both the
// repository's archives, but also package archives or the contents of a
// package's desc file.
['/:repo/:arch/:filename'; get; head]
['/:repo/:arch/:filename'; get; head; markused]
fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Result {
mut full_path := ''
@ -48,7 +48,7 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
}
// put_package handles publishing a package to a repository.
['/:repo/publish'; auth; post]
['/:repo/publish'; auth; markused; post]
fn (mut app App) put_package(repo string) web.Result {
// api is a reserved keyword for api routes & should never be allowed to be
// a repository.

View File

@ -3,7 +3,7 @@ module server
import web
// delete_package tries to remove the given package.
['/:repo/:arch/:pkg'; auth; delete]
['/:repo/:arch/:pkg'; auth; delete; markused]
fn (mut app App) delete_package(repo string, arch string, pkg string) web.Result {
res := app.repo.remove_pkg_from_arch_repo(repo, arch, pkg, true) or {
app.lerror('Error while deleting package: $err.msg()')
@ -23,7 +23,7 @@ fn (mut app App) delete_package(repo string, arch string, pkg string) web.Result
}
// delete_arch_repo tries to remove the given arch-repo.
['/:repo/:arch'; auth; delete]
['/:repo/:arch'; auth; delete; markused]
fn (mut app App) delete_arch_repo(repo string, arch string) web.Result {
res := app.repo.remove_arch_repo(repo, arch) or {
app.lerror('Error while deleting arch-repo: $err.msg()')
@ -43,7 +43,7 @@ fn (mut app App) delete_arch_repo(repo string, arch string) web.Result {
}
// delete_repo tries to remove the given repo.
['/:repo'; auth; delete]
['/:repo'; auth; delete; markused]
fn (mut app App) delete_repo(repo string) web.Result {
res := app.repo.remove_repo(repo) or {
app.lerror('Error while deleting repo: $err.msg()')

View File

@ -5,7 +5,7 @@ import net.http
// Method attributes that should be ignored when parsing, as they're used
// elsewhere.
const attrs_to_ignore = ['auth']
const attrs_to_ignore = ['auth', 'markused']
// Parsing function attributes for methods and path.
fn parse_attrs(name string, attrs []string) !([]http.Method, string) {