Skip to content

Commit

Permalink
API 被禁用,暂时删除 Hostdare 流量监控接口
Browse files Browse the repository at this point in the history
有个 js 脚本(被混淆了)运行会生成临时 cf token,请求后会返回 cf_clearance Cookie,目前无法生成。
  • Loading branch information
movsb committed Dec 18, 2024
1 parent 370eff4 commit 8457174
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 312 deletions.
16 changes: 0 additions & 16 deletions cmd/config/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,3 @@ func (c *WhoisApiLayerConfig) BeforeSet(paths Segments, obj any) error {
}
return nil
}

type VpsConfig struct {
Current CurrentVpsConfig `json:"current" yaml:"current"`
Hostdare HostdareVpsConfig `json:"hostdare" yaml:"hostdare"`
}

type CurrentVpsConfig string

func (CurrentVpsConfig) CanSave() {}

type HostdareVpsConfig struct {
Username string `json:"username" yaml:"username"`
Password string `json:"password" yaml:"password"`
}

func (HostdareVpsConfig) CanSave() {}
1 change: 0 additions & 1 deletion cmd/config/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Config struct {
// 所以我就在这里定义了针对所有站点适用的自定义样式表(或主题)集合。
Theme ThemeConfig `json:"theme" yaml:"theme"`

VPS VpsConfig `json:"vps" yaml:"vps"`
Notify NotificationConfig `json:"notify" yaml:"notify"`
}

Expand Down
13 changes: 0 additions & 13 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/movsb/taoblog/modules/auth"
"github.com/movsb/taoblog/modules/logs"
"github.com/movsb/taoblog/modules/metrics"
"github.com/movsb/taoblog/modules/metrics/exporters/hostdare"
"github.com/movsb/taoblog/modules/notify"
"github.com/movsb/taoblog/modules/utils"
"github.com/movsb/taoblog/modules/version"
Expand Down Expand Up @@ -103,18 +102,6 @@ func (s *Server) Serve(ctx context.Context, testing bool, cfg *config.Config, re
var mux = http.NewServeMux()
r := metrics.NewRegistry(context.TODO())
mux.Handle(`/v3/metrics`, r.Handler()) // TODO: insecure
switch cfg.VPS.Current {
case `hostdare`:
if hd := cfg.VPS.Hostdare; hd.Username != "" && hd.Password != "" {
exporter, err := hostdare.New(hd.Username, hd.Password)
if err != nil {
log.Println(err)
} else {
r.MustRegister(exporter)
log.Println(`注册 hostdare 指标`)
}
}
}

var store theme_fs.FS
if path := cfg.Data.File.Path; path == "" {
Expand Down
282 changes: 0 additions & 282 deletions modules/metrics/exporters/hostdare/hostdare.go

This file was deleted.

1 change: 1 addition & 0 deletions setup/migration/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var gVersions = []VersionUpdater{
{28, v28},
{29, v29},
{30, v30},
{31, v31},
}

// MaxVersionNumber ...
Expand Down
5 changes: 5 additions & 0 deletions setup/migration/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,8 @@ func v30(tx *sql.Tx) {
mustExec(tx, "ALTER TABLE comments ADD COLUMN `date_timezone` TEXT NOT NULL DEFAULT ''")
mustExec(tx, "ALTER TABLE comments ADD COLUMN `modified_timezone` TEXT NOT NULL DEFAULT ''")
}

func v31(tx *sql.Tx) {
mustExec(tx, `DELETE FROM options WHERE name = 'vps.hostdare'`)
mustExec(tx, `DELETE FROM options WHERE name = 'vps.current'`)
}

0 comments on commit 8457174

Please sign in to comment.