diff --git a/.github/workflows/dispatch_copr.yml b/.github/workflows/dispatch_copr.yml index 30d03704..f4dff975 100644 --- a/.github/workflows/dispatch_copr.yml +++ b/.github/workflows/dispatch_copr.yml @@ -5,8 +5,8 @@ on: branches: [main] paths: - "**/*.go" - - "go.mod" - - "go.sum" + - "**/go.mod" + - "**/go.sum" - "gui/**" - ".github/workflows/*.yml" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 01b7e3d8..7850b102 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -5,6 +5,7 @@ on: paths: - "**/*.go" - "service/**" + - "core/**" - "gui/**" - ".github/workflows/*.yml" jobs: diff --git a/.github/workflows/test_build_main.yml b/.github/workflows/test_build_main.yml index 47f0b6a7..5aec571b 100644 --- a/.github/workflows/test_build_main.yml +++ b/.github/workflows/test_build_main.yml @@ -7,8 +7,8 @@ on: - dependabot/* paths: - "**/*.go" - - "go.mod" - - "go.sum" + - "**/go.mod" + - "**/go.sum" - "gui/**" - ".github/workflows/*.yml" - "install/windows-inno/**" diff --git a/core/dns/go_dns.go b/core/dns/go_dns.go deleted file mode 100644 index e1d6c0d3..00000000 --- a/core/dns/go_dns.go +++ /dev/null @@ -1,13 +0,0 @@ -// Package dns provides a standalone DNS module for v2rayA. -// -// This file exists solely to ensure go.sum tracks the github.com/miekg/dns -// dependency, which is required by the DNS module. The actual imports are -// in types.go and listener.go. -// -// This file will be removed once the project's go.mod properly tracks -// all dependencies through normal build workflows. -package dns - -import ( - _ "github.com/miekg/dns" -) diff --git a/gui/src/api/index.ts b/gui/src/api/index.ts index 433c8245..d3063a4c 100644 --- a/gui/src/api/index.ts +++ b/gui/src/api/index.ts @@ -1,4 +1,4 @@ -// One function per backend operation (method + path), 41 in all, named +// One function per backend operation (method + path), 40 in all, named // . Bodies and queries are what the old components sent, so // the recorded requests match byte for byte; types narrow them where the // backend's Go types are known (types.ts) and stay open elsewhere. @@ -69,10 +69,6 @@ export const getHttpLatency = (whiches: Which[]) => }); // ---- connections and the core --------------------------------------------- -export const postConnection = (which: Which, o: RequestOptions = {}) => - call({ url: "connection", method: "post", data: which, ...o }); -export const deleteConnection = (which: Which) => - call({ url: "connection", method: "delete", data: which }); export const putOutboundConnections = (body: { outbound: string; touches: Which[]; diff --git a/install/aur/v2raya-bin/.SRCINFO b/install/aur/v2raya-bin/.SRCINFO deleted file mode 100644 index d9a6c4f2..00000000 --- a/install/aur/v2raya-bin/.SRCINFO +++ /dev/null @@ -1,27 +0,0 @@ -pkgbase = v2raya-bin - pkgdesc = A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan, Tuic and Juicity protocols - pkgver = {{pkgver}} - pkgrel = 1 - url = https://github.com/v2rayA/v2rayA - install = .INSTALL - arch = i686 - arch = x86_64 - arch = armv7h - arch = loong64 - arch = aarch64 - license = AGPL3 - provides = v2raya - conflicts = v2raya - backup = etc/default/v2raya - source_i686 = installer_archlinux_x86_{{pkgver}}.pkg.tar.zst::https://github.com/v2rayA/v2rayA/releases/download/v{{pkgver}}/installer_archlinux_x86_{{pkgver}}.pkg.tar.zst - sha256sums_i686 = {{sha256sums_i686}} - source_x86_64 = installer_archlinux_x64_{{pkgver}}.pkg.tar.zst::https://github.com/v2rayA/v2rayA/releases/download/v{{pkgver}}/installer_archlinux_x64_{{pkgver}}.pkg.tar.zst - sha256sums_x86_64 = {{sha256sums_x86_64}} - source_armv7h = installer_archlinux_armv7_{{pkgver}}.pkg.tar.zst::https://github.com/v2rayA/v2rayA/releases/download/v{{pkgver}}/installer_archlinux_armv7_{{pkgver}}.pkg.tar.zst - sha256sums_armv7h = {{sha256sums_armv7h}} - source_aarch64 = installer_archlinux_arm64_{{pkgver}}.pkg.tar.zst::https://github.com/v2rayA/v2rayA/releases/download/v{{pkgver}}/installer_archlinux_arm64_{{pkgver}}.pkg.tar.zst - sha256sums_aarch64 = {{sha256sums_aarch64}} - source_loong64 = installer_archlinux_loongarch64_{{pkgver}}.pkg.tar.zst::https://github.com/v2rayA/v2rayA/releases/download/v{{pkgver}}/installer_archlinux_loongarch64_{{pkgver}}.pkg.tar.zst - sha256sums_loong64 = {{sha256sums_loong64}} - -pkgname = v2raya-bin diff --git a/install/aur/v2raya/.SRCINFO b/install/aur/v2raya/.SRCINFO deleted file mode 100644 index eb29e83b..00000000 --- a/install/aur/v2raya/.SRCINFO +++ /dev/null @@ -1,25 +0,0 @@ -pkgbase = v2raya - pkgdesc = A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan, Tuic and Juicity protocols - pkgver = {{pkgver}} - pkgrel = 1 - url = https://github.com/v2rayA/v2rayA - install = .INSTALL - arch = i686 - arch = pentium4 - arch = x86_64 - arch = arm - arch = armv7h - arch = armv6h - arch = aarch64 - license = AGPL3 - makedepends = git - makedepends = go>=2:1.17.0-1 - makedepends = nodejs>=14 - makedepends = yarn - depends = glibc - backup = etc/default/v2raya - source = v2raya-{{pkgver}}.tar.gz::https://github.com/v2rayA/v2rayA/archive/v{{pkgver}}.tar.gz - sha512sums = SKIP - -pkgname = v2raya - depends = glibc diff --git a/install/universal/v2raya.run b/install/universal/v2raya.run deleted file mode 100644 index 69a19a7a..00000000 --- a/install/universal/v2raya.run +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# This is the runit script for v2raya. Check out runit, a UNIX init scheme with -# service supervision here: http://smarden.org/runit/ - -# Usage: move this script to the service directory as run, and make it -# executable. Then you can run this service under runit service supervision. -# For exmaple: - -# install -Dm755 v2raya.run /etc/sv/v2raya/run -# ln -s /etc/sv/v2raya /var/service/ - -# Note that the actual service directory and supervision directory may differ -# from disto to disto. - -# For any problem, connect yuandi42 . - -exec 2>&1 - -export V2RAYA_LOG_FILE="/var/log/v2raya/v2raya.log" - -exec /usr/bin/v2raya --log-disable-timestamp diff --git a/service/common/antiPollution/external_dns.go b/service/common/antiPollution/external_dns.go deleted file mode 100644 index cfda3bd0..00000000 --- a/service/common/antiPollution/external_dns.go +++ /dev/null @@ -1,20 +0,0 @@ -package antiPollution - -var publicDNS = []string{ - "8.8.8.8", "4.2.2.4", "94.140.14.14", "176.103.130.130", "156.154.70.5", "8.26.56.26", - "91.239.100.100", "89.233.43.71", "1.1.1.1", "208.67.222.222", "38.132.106.139", "9.9.9.9", - "192.71.245.208", "84.200.69.80", "77.88.8.88", "156.154.70.5", "185.228.168.9", - "8.26.56.26", "91.239.100.100", "45.33.97.5", "64.6.64.6", "198.54.117.10", "195.46.39.39", - "176.103.130.130", "8.8.4.4", "1.0.0.1", "208.67.220.220", "194.187.251.67", - "149.112.112.112", "94.247.43.254", "84.200.70.40", "77.88.8.2", "156.154.71.5", - "185.228.169.9", "8.20.247.20", "89.233.43.71", "37.235.1.177", "64.6.65.6", - "198.54.117.11", "195.46.39.40", "176.103.130.131", -} - -func GetExternalDNS(tag string) []string { - var external []string - for _, dns := range publicDNS { - external = append(external, dns+" -> "+tag) - } - return external -} diff --git a/service/conf/environmentConfig.go b/service/conf/environmentConfig.go index 096cb1b8..85a4723a 100644 --- a/service/conf/environmentConfig.go +++ b/service/conf/environmentConfig.go @@ -18,7 +18,6 @@ type Params struct { Socket string `id:"socket" desc:"Unix socket path for listening"` BaseUrl string `id:"baseurl" default:"/" desc:"Base URL path prefix"` V2rayBin string `id:"v2ray-bin" short:"b" desc:"Executable v2ray binary path. Auto-detect if put it empty."` - CoreType string `id:"core-type" desc:"Specify core type: v2ray or xray. Required when using custom v2ray-bin path."` Config string `id:"config" short:"c" desc:"v2rayA configuration directory"` V2rayConfigDirectory string `id:"v2ray-confdir" desc:"Additional v2ray config directory, files in it will be combined with config generated by v2rayA"` TinyTunBin string `id:"tinytun-bin" desc:"Deprecated and ignored: the TUN is built into the core. Kept so service units that still pass it start."` diff --git a/service/kernel/vmessInfo/vmessInfo.go b/service/kernel/vmessInfo/vmessInfo.go deleted file mode 100644 index 0bf2ec23..00000000 --- a/service/kernel/vmessInfo/vmessInfo.go +++ /dev/null @@ -1,163 +0,0 @@ -package vmessInfo - -import ( - "encoding/base64" - "fmt" - "net" - "net/url" - "strings" - - jsoniter "github.com/json-iterator/go" -) - -// Deprecated: use serverObj instead. -type VmessInfo struct { - Ps string `json:"ps"` - Add string `json:"add"` - Port string `json:"port"` - ID string `json:"id"` - Aid string `json:"aid"` - Net string `json:"net"` - Type string `json:"type"` - Host string `json:"host"` - Path string `json:"path"` - SNI string `json:"sni"` - TLS string `json:"tls"` - Flow string `json:"flow,omitempty"` - Alpn string `json:"alpn,omitempty"` // VLESS only - V string `json:"v"` - PinnedPeerCertSha256 string `json:"pinnedPeerCertSha256,omitempty"` - VerifyPeerCertByName string `json:"verifyPeerCertByName,omitempty"` - Protocol string `json:"protocol"` -} - -func setValue(values *url.Values, key string, value string) { - if value == "" { - return - } - values.Set(key, value) -} - -func (v *VmessInfo) ExportToURL() string { - switch v.Protocol { - case "vless": - // https://github.com/XTLS/Xray-core/issues/91 - var query = make(url.Values) - setValue(&query, "type", v.Net) - setValue(&query, "security", v.TLS) - switch v.Net { - case "websocket", "ws", "http", "h2": - setValue(&query, "path", v.Path) - setValue(&query, "host", v.Host) - case "mkcp", "kcp": - setValue(&query, "headerType", v.Type) - setValue(&query, "seed", v.Path) - case "tcp": - setValue(&query, "headerType", v.Type) - setValue(&query, "host", v.Host) - setValue(&query, "path", v.Path) - case "grpc": - setValue(&query, "serviceName", v.Path) - } - if v.TLS != "none" { - setValue(&query, "sni", v.SNI) - setValue(&query, "alpn", v.Alpn) - } - if v.TLS == "xtls" { - setValue(&query, "flow", v.Flow) - } - - U := url.URL{ - Scheme: "vless", - User: url.User(v.ID), - Host: net.JoinHostPort(v.Add, v.Port), - RawQuery: query.Encode(), - Fragment: v.Ps, - } - return U.String() - case "", "vmess": - v.V = "2" - b, _ := jsoniter.Marshal(v) - return "vmess://" + base64.StdEncoding.EncodeToString(b) - case "ss": - /* ss://BASE64(method:password)@server:port#name */ - u := &url.URL{ - Scheme: "ss", - User: url.User(base64.URLEncoding.EncodeToString([]byte(v.Net + ":" + v.ID))), - Host: net.JoinHostPort(v.Add, v.Port), - Fragment: v.Ps, - } - if v.Type != "" { - a := []string{ - `simple-obfs`, - `obfs=` + v.Type, - `obfs-host=` + v.Host, - } - if v.Type == "http" { - a = append(a, `obfs-path=`+v.Path) - } - plugin := strings.Join(a, ";") - q := u.Query() - q.Set("plugin", plugin) - u.RawQuery = q.Encode() - } - return u.String() - case "ssr": - /* ssr://server:port:proto:method:obfs:URLBASE64(password)/?remarks=URLBASE64(remarks)&protoparam=URLBASE64(protoparam)&obfsparam=URLBASE64(obfsparam)) */ - return fmt.Sprintf("ssr://%v", base64.URLEncoding.EncodeToString([]byte( - fmt.Sprintf( - "%v:%v:%v:%v:%v/?remarks=%v&protoparam=%v&obfsparam=%v", - net.JoinHostPort(v.Add, v.Port), - v.Type, - v.Net, - v.TLS, - base64.URLEncoding.EncodeToString([]byte(v.ID)), - base64.URLEncoding.EncodeToString([]byte(v.Ps)), - base64.URLEncoding.EncodeToString([]byte(v.Host)), - base64.URLEncoding.EncodeToString([]byte(v.Path)), - ), - ))) - case "trojan", "trojan-go": - // trojan://passwd@server:port#URLESCAPE(remarks) - u := &url.URL{ - Scheme: "trojan", - User: url.User(v.ID), - Host: net.JoinHostPort(v.Add, v.Port), - RawQuery: "", - Fragment: v.Ps, - } - q := u.Query() - setValue(&q, "pinnedPeerCertSha256", v.PinnedPeerCertSha256) - setValue(&q, "verifyPeerCertByName", v.VerifyPeerCertByName) - if v.Protocol == "trojan-go" { - u.Scheme = "trojan-go" - if v.Host != "" { - fields := strings.SplitN(v.Host, ",", 2) - q.Set("sni", fields[0]) - q.Set("host", fields[1]) - } - q.Set("encryption", v.Type) - q.Set("type", v.Net) - q.Set("path", v.Path) - } else { - if v.Host != "" { - q.Set("sni", v.Host) - } - } - u.RawQuery = q.Encode() - return u.String() - case "http", "https": - var user *url.Userinfo - if v.ID != "" && v.Aid != "" { - user = url.UserPassword(v.ID, v.Aid) - } - u := &url.URL{ - Scheme: v.Protocol, - User: user, - Host: net.JoinHostPort(v.Add, v.Port), - Fragment: v.Ps, - } - return u.String() - } - return "" -} diff --git a/service/pkg/util/gopeed/down.go b/service/pkg/util/gopeed/down.go deleted file mode 100644 index 607c209a..00000000 --- a/service/pkg/util/gopeed/down.go +++ /dev/null @@ -1,197 +0,0 @@ -package gopeed - -import ( - "fmt" - gonanoid "github.com/matoous/go-nanoid" - "github.com/v2rayA/v2rayA/common" - "github.com/v2rayA/v2rayA/pkg/util/copyfile" - "github.com/v2rayA/v2rayA/pkg/util/log" - "io" - "mime" - "net/http" - "net/http/cookiejar" - "net/url" - "os" - "path/filepath" - "runtime" - "strconv" - "strings" - "sync" -) - -type Download interface { - Resolve(request *http.Request) (*http.Response, error) - Down(request *http.Request, filename string) error -} - -// Resolve return the file response to be downloaded -func Resolve(request *Request) (*Response, error) { - httpRequest, err := BuildHTTPRequest(request) - if err != nil { - return nil, err - } - // Use "Range" header to resolve - httpRequest.Header.Add("Range", "bytes=0-0") - httpClient := BuildHTTPClient() - response, err := httpClient.Do(httpRequest) - if err != nil { - return nil, err - } - defer response.Body.Close() - if response.StatusCode != 200 && response.StatusCode != 206 { - return nil, fmt.Errorf("response status error:%d", response.StatusCode) - } - ret := &Response{} - // Get file name by "Content-Disposition" - contentDisposition := response.Header.Get("Content-Disposition") - if contentDisposition != "" { - _, params, _ := mime.ParseMediaType(contentDisposition) - filename := params["filename"] - if filename != "" { - ret.Name = filename - } - } - // Get file name by URL - if ret.Name == "" { - parse, err := url.Parse(httpRequest.URL.String()) - if err == nil { - // e.g. /files/test.txt => test.txt - ret.Name = subLastSlash(parse.Path) - } - } - // Unknow file name - if ret.Name == "" { - ret.Name = "unknow" - } - // Is support range - ret.Range = response.StatusCode == 206 - // Get file size - if ret.Range { - contentRange := response.Header.Get("Content-Range") - if contentRange != "" { - // e.g. bytes 0-1000/1001 => 1001 - total := subLastSlash(contentRange) - if total != "" && total != "*" { - parse, err := strconv.ParseInt(total, 10, 64) - if err != nil { - return nil, err - } - ret.Size = parse - } - } - } else { - contentLength := response.Header.Get("Content-Length") - if contentLength != "" { - ret.Size, _ = strconv.ParseInt(contentLength, 10, 64) - } - } - return ret, nil -} - -// Down -func Down(request *Request, to string) error { - response, err := Resolve(request) - if err != nil { - return err - } - // allocate file - nanoid, _ := gonanoid.Nanoid() - filename := response.Name + "." + nanoid - tmpPath := filepath.Join(os.TempDir(), filename) - file, err := os.Create(tmpPath) - if err != nil { - return err - } - defer file.Close() - if err := file.Truncate(response.Size); err != nil { - return err - } - // support range - if response.Range { - cons := common.Max(4, runtime.NumCPU()) - chunkSize := response.Size / int64(cons) - waitGroup := &sync.WaitGroup{} - waitGroup.Add(cons) - for i := 0; i < cons; i++ { - start := int64(i) * chunkSize - end := start + chunkSize - if i == cons-1 { - end = response.Size - } - go downChunk(request, response, file, start, end-1, waitGroup) - } - waitGroup.Wait() - } else { - downChunk(request, response, file, 0, response.Size, nil) - } - err = copyfile.CopyFile(tmpPath, to) - if err != nil { - return err - } - file.Close() - _ = os.Remove(tmpPath) - return nil -} - -func subLastSlash(str string) string { - index := strings.LastIndex(str, "/") - if index != -1 { - return str[index+1:] - } - return "" -} - -func BuildHTTPRequest(request *Request) (*http.Request, error) { - // Build request - httpRequest, err := http.NewRequest(strings.ToUpper(request.Method), request.URL, nil) - if err != nil { - return nil, err - } - for k, v := range request.Header { - httpRequest.Header.Add(k, v) - } - return httpRequest, nil -} - -func BuildHTTPClient() *http.Client { - // Cookie handle - jar, _ := cookiejar.New(nil) - - return &http.Client{Jar: jar} -} - -func downChunk(request *Request, response *Response, file *os.File, start int64, end int64, waitGroup *sync.WaitGroup) { - if waitGroup != nil { - defer waitGroup.Done() - } - httpRequest, _ := BuildHTTPRequest(request) - httpRequest.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", start, end)) - log.Info("down<%v> %d-%d\n", response.Name, start, end) - httpClient := BuildHTTPClient() - httpResponse, err := httpClient.Do(httpRequest) - if err != nil { - log.Warn("%v", err) - return - } - defer httpResponse.Body.Close() - buf := make([]byte, 8192) - writeIndex := start - for { - n, err := httpResponse.Body.Read(buf) - if n > 0 { - writeSize, err := file.WriteAt(buf[0:n], writeIndex) - if err != nil { - log.Warn("%v", err) - return - } - writeIndex += int64(writeSize) - } - if err != nil { - if err != io.EOF { - log.Warn("%v", err) - return - } - break - } - } -} diff --git a/service/pkg/util/gopeed/down_test.go b/service/pkg/util/gopeed/down_test.go deleted file mode 100644 index 9c035e55..00000000 --- a/service/pkg/util/gopeed/down_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package gopeed - -import ( - "crypto/md5" - "encoding/hex" - "fmt" - "io" - "os" - "path/filepath" - "reflect" - "testing" -) - -func TestDown(t *testing.T) { - type args struct { - request *Request - } - tests := []struct { - name string - args args - }{ - { - "proxyee-down.ico", - args{ - &Request{ - "get", - "https://raw.githubusercontent.com/proxyee-down-org/proxyee-down/master/front/public/favicon.ico", - map[string]string{ - "Host": "github.com", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "Referer": "http://github.com/proxyee-down-org/proxyee-down/releases", - "Accept-Encoding": "gzip, deflate, br", - "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", - }, - nil, - }, - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - requireNetwork(t) - dest := filepath.Join(t.TempDir(), "favicon.ico") - err := Down(tt.args.request, dest) - if err != nil { - t.Errorf("error down= %v", err) - return - } - // The file is written into dir; reading it from the working - // directory made this test fail on every machine. - downMd5 := fileMd5(dest) - if "8de7a6a2e786861013d61b77b2394012" != downMd5 { - t.Errorf("error md5= %v", downMd5) - return - } - }) - } -} - -func TestResolve(t *testing.T) { - // os.Setenv("HTTP_PROXY", "http://127.0.0.1:8888") - type args struct { - request *Request - } - tests := []struct { - name string - args args - want *Response - wantErr bool - }{ - { - "proxyee-down.ico", - args{ - &Request{ - "get", - "https://raw.githubusercontent.com/proxyee-down-org/proxyee-down/master/front/public/favicon.ico", - map[string]string{ - "Host": "github.com", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", - "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "Referer": "http://github.com/proxyee-down-org/proxyee-down/releases", - "Accept-Encoding": "gzip, deflate, br", - "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", - }, - nil, - }, - }, - &Response{"favicon.ico", 116093, true}, - false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - requireNetwork(t) - got, err := Resolve(tt.args.request) - if (err != nil) != tt.wantErr { - t.Errorf("Resolve() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("Resolve() = %v, want %v", got, tt.want) - } - }) - } -} - -func fileMd5(filePath string) string { - file, _ := os.Open(filePath) - - // Tell the program to call the following function when the current function returns - defer file.Close() - - // Open a new hash interface to write to - hash := md5.New() - - // Copy the file in the hash interface and check for any error - if _, err := io.Copy(hash, file); err != nil { - return "" - } - return hex.EncodeToString(hash.Sum(nil)) -} - -func TestTemp2(t *testing.T) { - fmt.Println("123456789"[2:3]) -} - -// Both tests fetch a file from GitHub and compare it with a fixed checksum, so -// they only mean something with network access and an unchanged upstream file. -// Set V2RAYA_NETWORK_TESTS=1 to run them. -func requireNetwork(t *testing.T) { - t.Helper() - if os.Getenv("V2RAYA_NETWORK_TESTS") != "1" { - t.Skip("set V2RAYA_NETWORK_TESTS=1 to run the tests that download from the network") - } -} diff --git a/service/pkg/util/gopeed/request.go b/service/pkg/util/gopeed/request.go deleted file mode 100644 index 95675259..00000000 --- a/service/pkg/util/gopeed/request.go +++ /dev/null @@ -1,8 +0,0 @@ -package gopeed - -type Request struct { - Method string - URL string - Header map[string]string - Content []byte -} diff --git a/service/pkg/util/gopeed/response.go b/service/pkg/util/gopeed/response.go deleted file mode 100644 index 9cc0f0e6..00000000 --- a/service/pkg/util/gopeed/response.go +++ /dev/null @@ -1,7 +0,0 @@ -package gopeed - -type Response struct { - Name string - Size int64 - Range bool -} diff --git a/service/server/controller/account.go b/service/server/controller/account.go index 70094e59..aaf50acf 100644 --- a/service/server/controller/account.go +++ b/service/server/controller/account.go @@ -50,30 +50,6 @@ func PostLogin(ctx *gin.Context) { }) } -/*修改密码*/ -func PutAccount(ctx *gin.Context) { - var data struct { - Password string `json:"password"` - NewPassword string `json:"newPassword"` - } - err := ctx.ShouldBindJSON(&data) - if err != nil { - common.ResponseError(ctx, badRequest("password and newPassword", "request body must contain \"password\" and \"newPassword\" strings")) - return - } - if ok, err := service.ValidPasswordLength(data.Password); !ok { - common.ResponseError(ctx, logError(err)) - return - } - username := ctx.GetString("Name") - if !service.IsValidAccount(username, data.Password) { - common.ResponseError(ctx, common.Coded("WRONG_CREDENTIALS", logError("wrong username or password"), nil)) - return - } - //TODO: modify password - common.ResponseSuccess(ctx, nil) -} - /*注册*/ var muReg sync.Mutex diff --git a/service/server/router/index.go b/service/server/router/index.go index 99646742..04688b12 100644 --- a/service/server/router/index.go +++ b/service/server/router/index.go @@ -294,7 +294,6 @@ func Run() error { auth.GET("customInbound", controller.GetCustomInbound) auth.POST("customInbound", controller.PostCustomInbound) auth.DELETE("customInbound", controller.DeleteCustomInbound) - //auth.PUT("account", controller.PutAccount) auth.GET("dnsRules", controller.GetDnsRules) auth.PUT("dnsRules", controller.PutDnsRules) auth.GET("routingA", controller.GetRoutingA)