mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Fix: get site summary in dashboard
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestWebsocketCaller(t *testing.T) {
|
||||
time.Sleep(time.Second)
|
||||
c, err := newWebsocketCaller(context.Background(), "ws://localhost:6800/jsonrpc", time.Second, &DummyNotifier{})
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
var info VersionInfo
|
||||
if err := c.Call(aria2GetVersion, []interface{}{}, &info); err != nil {
|
||||
t.Error(err.Error())
|
||||
} else {
|
||||
println(info.Version)
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestHTTPAll(t *testing.T) {
|
||||
const targetURL = "https://nodejs.org/dist/index.json"
|
||||
rpc, err := New(context.Background(), "http://localhost:6800/jsonrpc", "", time.Second, &DummyNotifier{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer rpc.Close()
|
||||
g, err := rpc.AddURI(targetURL)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
println(g)
|
||||
if _, err = rpc.TellActive(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.PauseAll(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellStatus(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetURIs(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetFiles(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetPeers(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellActive(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellWaiting(0, 1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellStopped(0, 1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetOption(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetGlobalOption(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetGlobalStat(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetSessionInfo(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.Remove(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellActive(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebsocketAll(t *testing.T) {
|
||||
const targetURL = "https://nodejs.org/dist/index.json"
|
||||
rpc, err := New(context.Background(), "ws://localhost:6800/jsonrpc", "", time.Second, &DummyNotifier{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer rpc.Close()
|
||||
g, err := rpc.AddURI(targetURL)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
println(g)
|
||||
if _, err = rpc.TellActive(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.PauseAll(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellStatus(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetURIs(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetFiles(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetPeers(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellActive(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellWaiting(0, 1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellStopped(0, 1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetOption(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetGlobalOption(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetGlobalStat(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.GetSessionInfo(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.Remove(g); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, err = rpc.TellActive(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
package conf
|
||||
|
||||
// BackendVersion 当前后端版本号
|
||||
const BackendVersion = string("3.0.0-beta1")
|
||||
var BackendVersion = "3.0.0-beta1"
|
||||
|
||||
// RequiredDBVersion 与当前版本匹配的数据库版本
|
||||
const RequiredDBVersion = string("3.0.0-beta1")
|
||||
var RequiredDBVersion = "3.0.0-beta1"
|
||||
|
||||
// IsPro 是否为Pro版本
|
||||
var IsPro = "true"
|
||||
|
||||
// LastCommit 最后commit id
|
||||
var LastCommit = ""
|
||||
|
||||
@@ -62,6 +62,8 @@ const (
|
||||
CodePolicyNotAllowed = 40006
|
||||
// CodeGroupNotAllowed 用户组无法进行此操作
|
||||
CodeGroupNotAllowed = 40007
|
||||
// CodeAdminRequired 非管理用户组
|
||||
CodeAdminRequired = 40008
|
||||
// CodeDBError 数据库操作失败
|
||||
CodeDBError = 50001
|
||||
// CodeEncryptError 加密失败
|
||||
|
||||
Reference in New Issue
Block a user