One-click configuration: Vless Encryption + XHTTP
This commit is contained in:
parent
6301c9ac56
commit
ab5aad6ab3
@ -967,3 +967,25 @@ func (s *ServerService) GetNewmlkem768() (any, error) {
|
|||||||
|
|
||||||
return keyPair, nil
|
return keyPair, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveLinkHistory saves a new link and trims the history to the latest 10
|
||||||
|
func (s *ServerService) SaveLinkHistory(historyType, link string) error {
|
||||||
|
record := &database.LinkHistory{
|
||||||
|
Type: historyType,
|
||||||
|
Link: link,
|
||||||
|
CreatedAt: time.Now(),
|
||||||
|
}
|
||||||
|
// 【中文注释】: 调用数据库方法将记录写入 WAL 文件
|
||||||
|
err := database.AddLinkHistory(record)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// 【中文注释】【新增代码】: 强制执行一次 Checkpoint 操作。
|
||||||
|
// 【中文注释】: 确保 WAL 文件中的新数据被立即写入并持久化到主数据库文件中,从而解决刷新后数据丢失的问题。
|
||||||
|
return database.Checkpoint()
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadLinkHistory loads the latest 10 links from the database
|
||||||
|
func (s *ServerService) LoadLinkHistory() ([]*database.LinkHistory, error) {
|
||||||
|
return database.GetLinkHistory()
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user