remove dev log

This commit is contained in:
wjqserver 2025-08-11 18:35:36 +08:00
parent d389a61f09
commit 5fc6f7ab6f
2 changed files with 4 additions and 10 deletions

View file

@ -1,8 +1,6 @@
package config package config
import ( import (
"fmt"
"log"
"os" "os"
"path/filepath" "path/filepath"
@ -224,7 +222,6 @@ func LoadConfig(filePath string) (*Config, error) {
} }
var config Config var config Config
ext := filepath.Ext(filePath) ext := filepath.Ext(filePath)
log.Printf("Loading config from %s with extension %s", filePath, ext)
if ext == ".wanf" { if ext == ".wanf" {
if err := wanf.DecodeFile(filePath, &config); err != nil { if err := wanf.DecodeFile(filePath, &config); err != nil {
return nil, err return nil, err
@ -247,7 +244,6 @@ func (c *Config) WriteConfig(filePath string) error {
defer file.Close() defer file.Close()
ext := filepath.Ext(filePath) ext := filepath.Ext(filePath)
fmt.Printf("%s", ext)
if ext == ".wanf" { if ext == ".wanf" {
err := wanf.NewStreamEncoder(file).Encode(c) err := wanf.NewStreamEncoder(file).Encode(c)
if err != nil { if err != nil {

View file

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"log"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
@ -54,6 +53,10 @@ var (
// 处理路径各种情况 // 处理路径各种情况
func OciWithImageRouting(cfg *config.Config) touka.HandlerFunc { func OciWithImageRouting(cfg *config.Config) touka.HandlerFunc {
return func(c *touka.Context) { return func(c *touka.Context) {
if !cfg.Docker.Enabled {
ErrorPage(c, NewErrorWithStatusLookup(403, "Docker proxy is not enabled"))
return
}
var ( var (
p1 string p1 string
p2 string p2 string
@ -83,13 +86,10 @@ func OciWithImageRouting(cfg *config.Config) touka.HandlerFunc {
} }
// 根据/分割 /:target/:user/:repo/*ext // 根据/分割 /:target/:user/:repo/*ext
log.Print(ociPath)
ociPath = ociPath[1:] ociPath = ociPath[1:]
i := strings.IndexByte(ociPath, '/') i := strings.IndexByte(ociPath, '/')
if i <= 0 { if i <= 0 {
ErrorPage(c, NewErrorWithStatusLookup(404, "Not Found")) ErrorPage(c, NewErrorWithStatusLookup(404, "Not Found"))
log.Print(1)
return return
} }
p1 = ociPath[:i] p1 = ociPath[:i]
@ -120,7 +120,6 @@ func OciWithImageRouting(cfg *config.Config) touka.HandlerFunc {
i = strings.IndexByte(ociPath, '/') i = strings.IndexByte(ociPath, '/')
if i <= 0 { if i <= 0 {
ErrorPage(c, NewErrorWithStatusLookup(404, "Not Found")) ErrorPage(c, NewErrorWithStatusLookup(404, "Not Found"))
log.Print(2)
return return
} }
p2 = ociPath[:i] p2 = ociPath[:i]
@ -151,7 +150,6 @@ func OciWithImageRouting(cfg *config.Config) touka.HandlerFunc {
i = strings.IndexByte(ociPath, '/') i = strings.IndexByte(ociPath, '/')
if i <= 0 { if i <= 0 {
ErrorPage(c, NewErrorWithStatusLookup(404, "Not Found")) ErrorPage(c, NewErrorWithStatusLookup(404, "Not Found"))
log.Print(3)
return return
} }
p3 = ociPath[:i] p3 = ociPath[:i]