🎨 Support LiuYun account login https://github.com/siyuan-note/siyuan/issues/8578
This commit is contained in:
parent
bebb75d389
commit
4459413493
18 changed files with 117 additions and 103 deletions
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"cloudRegionNorthAmerica": "LiuYun (Data Center in North America)",
|
||||
"cloudRegionChina": "LianDi (Data Center in Mainland China)",
|
||||
"currentKernel": "Current kernel",
|
||||
"otherOnlineKernels": "Other online kernels",
|
||||
"syncPerception": "⚗\uFE0F Sync perception",
|
||||
|
@ -687,7 +689,7 @@
|
|||
"login": "Login",
|
||||
"accountTip": "I have read and agree <a target='_blank' href='https://b3log.org/siyuan/privacy.html'>SiYuan Privacy Policy</a>",
|
||||
"forgetPassword": "Forget Password",
|
||||
"accountName": "Username/Email/Phone Number",
|
||||
"accountName": "Username/Email",
|
||||
"account": "Account",
|
||||
"globalGraph": "Global Graph",
|
||||
"backlinks": "Backlinks",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"cloudRegionNorthAmerica": "LiuYun (Centro de datos en América del Norte)"
|
||||
"cloudRegionChina": "LianDi (Centro de datos en China continental)",
|
||||
"currentKernel": "Núcleo actual",
|
||||
"otherOnlineKernels": "Otros núcleos en línea",
|
||||
"syncPerception": "⚗\uFE0F Percepción de sincronización",
|
||||
|
@ -687,7 +689,7 @@
|
|||
"login": "Iniciar sesión",
|
||||
"accountTip": "He leído y estoy de acuerdo con la <a target='_blank' href='https://b3log.org/siyuan/privacy.html'>Política de privacidad de SiYuan</a>",
|
||||
"forgetPassword": "Olvidar la contraseña",
|
||||
"accountName": "Nombre de usuario/correo electrónico/número de teléfono",
|
||||
"accountName": "Nombre de usuario/correo electrónico",
|
||||
"account": "Cuenta",
|
||||
"globalGraph": "Gráfico global",
|
||||
"backlinks": "Enlaces externos",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"cloudRegionNorthAmerica": "LiuYun (centre de données en Amérique du Nord)"
|
||||
"cloudRegionChina": "LianDi (centre de données en Chine continentale)",
|
||||
"currentKernel": "Noyau actuel",
|
||||
"otherOnlineKernels": "Autres noyaux en ligne",
|
||||
"syncPerception": "⚗\uFE0F Perception de la synchronisation",
|
||||
|
@ -687,7 +689,7 @@
|
|||
"login": "Login",
|
||||
"accountTip": "J'ai lu et accepté <a target='_blank' href='https://b3log.org/siyuan/privacy.html'>Politique de confidentialité de SiYuan</a>",
|
||||
"forgetPassword": "Mot de passe oublié",
|
||||
"accountName": "Nom d'utilisateur/Email/numéro de téléphone",
|
||||
"accountName": "Nom d'utilisateur/Email",
|
||||
"account": "Compte",
|
||||
"globalGraph": "Graphique global",
|
||||
"backlinks": "Backlinks",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"cloudRegionNorthAmerica": "流雲(北美數據中心)",
|
||||
"cloudRegionChina": "鏈滴(中國大陸數據中心)",
|
||||
"currentKernel": "當前內核",
|
||||
"otherOnlineKernels": "其他聯機內核",
|
||||
"syncPerception": "⚗\uFE0F 同步感知",
|
||||
|
@ -687,7 +689,7 @@
|
|||
"login": "登入",
|
||||
"accountTip": "我已閱讀並同意<a target='_blank' href='https://b3log.org/siyuan/privacy.html'>思源筆記隱私政策</a>",
|
||||
"forgetPassword": "忘記密碼",
|
||||
"accountName": "用戶名/電子信箱/手機號",
|
||||
"accountName": "用戶名/電子信箱",
|
||||
"account": "帳號",
|
||||
"globalGraph": "全域關係圖",
|
||||
"backlinks": "反向連結",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"cloudRegionNorthAmerica": "流云(北美数据中心)",
|
||||
"cloudRegionChina": "链滴(中国大陆数据中心)",
|
||||
"currentKernel": "当前内核",
|
||||
"otherOnlineKernels": "其他联机内核",
|
||||
"syncPerception": "⚗\uFE0F 同步感知",
|
||||
|
@ -687,7 +689,7 @@
|
|||
"login": "登录",
|
||||
"accountTip": "我已阅读并同意<a target='_blank' href='https://b3log.org/siyuan/privacy.html'>思源笔记隐私政策</a>",
|
||||
"forgetPassword": "忘记密码",
|
||||
"accountName": "用户名/邮箱/手机号",
|
||||
"accountName": "用户名/邮箱",
|
||||
"account": "账号",
|
||||
"globalGraph": "全局关系图",
|
||||
"backlinks": "反向链接",
|
||||
|
|
|
@ -137,8 +137,8 @@ ${window.siyuan.languages.account9}
|
|||
<div class="b3-form__icon">
|
||||
<svg class="b3-form__icon-icon"><use xlink:href="#iconFocus"></use></svg>
|
||||
<select class="b3-select b3-form__icon-input fn__block" id="cloudRegion">
|
||||
<option value="0">ld246.com(China)</option>
|
||||
<option value="1">liuyun.io(Other)</option>
|
||||
<option value="0">${window.siyuan.languages.cloudRegionChina}</option>
|
||||
<option value="1">${window.siyuan.languages.cloudRegionNorthAmerica}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="b3-form__img fn__none">
|
||||
|
|
|
@ -108,8 +108,8 @@ export const login = () => {
|
|||
<div class="b3-form__icon">
|
||||
<svg class="b3-form__icon-icon"><use xlink:href="#iconFocus"></use></svg>
|
||||
<select class="b3-select b3-form__icon-input fn__block" id="cloudRegion">
|
||||
<option value="0">ld246.com(China)</option>
|
||||
<option value="1">liuyun.io(Other)</option>
|
||||
<option value="0">${window.siyuan.languages.cloudRegionChina}</option>
|
||||
<option value="1">${window.siyuan.languages.cloudRegionNorthAmerica}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="b3-form__img fn__none">
|
||||
|
|
|
@ -553,7 +553,7 @@ func incPackageDownloads(repoURLHash, systemID string) {
|
|||
}
|
||||
|
||||
repo := strings.Split(repoURLHash, "@")[0]
|
||||
u := util.ChinaServer + "/apis/siyuan/bazaar/addBazaarPackageDownloadCount"
|
||||
u := util.GetCloudServer() + "/apis/siyuan/bazaar/addBazaarPackageDownloadCount"
|
||||
httpclient.NewCloudRequest30s().SetBody(
|
||||
map[string]interface{}{
|
||||
"systemID": systemID,
|
||||
|
|
|
@ -367,7 +367,7 @@ func uploadAssets2Cloud(sqlAssets []*sql.Asset, bizType string) (err error) {
|
|||
SetCookies(&http.Cookie{Name: "symphony", Value: uploadToken}).
|
||||
SetHeader("meta-type", metaType).
|
||||
SetHeader("biz-type", bizType).
|
||||
Post(util.ChinaServer + "/apis/siyuan/upload?ver=" + util.Ver)
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/upload?ver=" + util.Ver)
|
||||
if nil != reqErr {
|
||||
logging.LogErrorf("upload assets failed: %s", reqErr)
|
||||
return ErrFailedToConnectCloudServer
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
// SiYuan - Build Your Eternal Digital Garden
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package model
|
||||
|
||||
import "github.com/siyuan-note/siyuan/kernel/util"
|
||||
|
||||
func getCloudServer() string {
|
||||
if 0 == Conf.CloudRegion {
|
||||
return util.ChinaServer
|
||||
}
|
||||
return util.NorthAmericaServer
|
||||
}
|
||||
|
||||
func getCloudWebSocketServer() string {
|
||||
if 0 == Conf.CloudRegion {
|
||||
return util.ChinaWebSocketServer
|
||||
}
|
||||
return util.NorthAmericaWebSocketServer
|
||||
}
|
||||
|
||||
func getCloudSyncServer() string {
|
||||
if 0 == Conf.CloudRegion {
|
||||
return util.ChinaSyncServer
|
||||
}
|
||||
return util.NorthAmericaSyncServer
|
||||
}
|
||||
|
||||
func getCloudAssetsServer() string {
|
||||
if 0 == Conf.CloudRegion {
|
||||
return util.ChinaCloudAssetsServer
|
||||
}
|
||||
return util.NorthAmericaCloudAssetsServer
|
||||
}
|
||||
|
||||
func getCloudAccountServer() string {
|
||||
if 0 == Conf.CloudRegion {
|
||||
return util.ChinaAccountServer
|
||||
}
|
||||
return util.NorthAmericaAccountServer
|
||||
}
|
|
@ -186,6 +186,8 @@ func InitConf() {
|
|||
Conf.FileTree.DocCreateSavePath = strings.TrimSpace(Conf.FileTree.DocCreateSavePath)
|
||||
}
|
||||
|
||||
util.CurrentCloudRegion = Conf.CloudRegion
|
||||
|
||||
if nil == Conf.Tag {
|
||||
Conf.Tag = conf.NewTag()
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ func Export2Liandi(id string) (err error) {
|
|||
resp, getErr := request.
|
||||
SetSuccessResult(result).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Get(util.ChinaAccountServer + "/api/v2/article/update/" + articleId)
|
||||
Get(util.GetCloudAccountServer() + "/api/v2/article/update/" + articleId)
|
||||
if nil != getErr {
|
||||
logging.LogErrorf("get liandi article info failed: %s", getErr)
|
||||
return getErr
|
||||
|
@ -105,7 +105,7 @@ func Export2Liandi(id string) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
apiURL := util.ChinaAccountServer + "/api/v2/article"
|
||||
apiURL := util.GetCloudAccountServer() + "/api/v2/article"
|
||||
if foundArticle {
|
||||
apiURL += "/" + articleId
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ func Export2Liandi(id string) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
msg := fmt.Sprintf(Conf.Language(181), util.ChinaAccountServer+"/article/"+articleId)
|
||||
msg := fmt.Sprintf(Conf.Language(181), util.GetCloudAccountServer()+"/article/"+articleId)
|
||||
util.PushMsg(msg, 7000)
|
||||
return
|
||||
}
|
||||
|
@ -992,7 +992,7 @@ func ExportStdMarkdown(id string) string {
|
|||
|
||||
cloudAssetsBase := ""
|
||||
if IsSubscriber() {
|
||||
cloudAssetsBase = util.ChinaCloudAssetsServer + Conf.User.UserId + "/"
|
||||
cloudAssetsBase = util.GetCloudAssetsServer() + Conf.User.UserId + "/"
|
||||
}
|
||||
return exportMarkdownContent0(tree, cloudAssetsBase, false,
|
||||
Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
|
||||
|
|
|
@ -61,7 +61,7 @@ func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool, err
|
|||
SetSuccessResult(requestResult).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
SetBody(payload).
|
||||
Post(util.ChinaServer + "/apis/siyuan/ai/chatGPT")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/ai/chatGPT")
|
||||
if nil != err {
|
||||
logging.LogErrorf("chat gpt failed: %s", err)
|
||||
err = ErrFailedToConnectCloudServer
|
||||
|
@ -106,7 +106,7 @@ func StartFreeTrial() (err error) {
|
|||
_, err = request.
|
||||
SetSuccessResult(requestResult).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/user/startFreeTrial")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/user/startFreeTrial")
|
||||
if nil != err {
|
||||
logging.LogErrorf("start free trial failed: %s", err)
|
||||
return ErrFailedToConnectCloudServer
|
||||
|
@ -123,7 +123,7 @@ func DeactivateUser() (err error) {
|
|||
resp, err := request.
|
||||
SetSuccessResult(requestResult).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/user/deactivate")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/user/deactivate")
|
||||
if nil != err {
|
||||
logging.LogErrorf("deactivate user failed: %s", err)
|
||||
return ErrFailedToConnectCloudServer
|
||||
|
@ -149,7 +149,7 @@ func SetCloudBlockReminder(id, data string, timed int64) (err error) {
|
|||
SetSuccessResult(requestResult).
|
||||
SetBody(payload).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/calendar/setBlockReminder")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/calendar/setBlockReminder")
|
||||
if nil != err {
|
||||
logging.LogErrorf("set block reminder failed: %s", err)
|
||||
return ErrFailedToConnectCloudServer
|
||||
|
@ -181,7 +181,7 @@ func LoadUploadToken() (err error) {
|
|||
resp, err := request.
|
||||
SetSuccessResult(requestResult).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/upload/token")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/upload/token")
|
||||
if nil != err {
|
||||
logging.LogErrorf("get upload token failed: %s", err)
|
||||
return ErrFailedToConnectCloudServer
|
||||
|
@ -401,7 +401,7 @@ func RemoveCloudShorthands(ids []string) (err error) {
|
|||
SetSuccessResult(&result).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
SetBody(body).
|
||||
Post(util.ChinaServer + "/apis/siyuan/inbox/removeCloudShorthands")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/inbox/removeCloudShorthands")
|
||||
if nil != err {
|
||||
logging.LogErrorf("remove cloud shorthands failed: %s", err)
|
||||
err = ErrFailedToConnectCloudServer
|
||||
|
@ -428,7 +428,7 @@ func GetCloudShorthand(id string) (ret map[string]interface{}, err error) {
|
|||
resp, err := request.
|
||||
SetSuccessResult(&result).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/inbox/getCloudShorthand?id=" + id)
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/inbox/getCloudShorthand?id=" + id)
|
||||
if nil != err {
|
||||
logging.LogErrorf("get cloud shorthand failed: %s", err)
|
||||
err = ErrFailedToConnectCloudServer
|
||||
|
@ -459,7 +459,7 @@ func GetCloudShorthands(page int) (result map[string]interface{}, err error) {
|
|||
resp, err := request.
|
||||
SetSuccessResult(&result).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/inbox/getCloudShorthands?p=" + strconv.Itoa(page))
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/inbox/getCloudShorthands?p=" + strconv.Itoa(page))
|
||||
if nil != err {
|
||||
logging.LogErrorf("get cloud shorthands failed: %s", err)
|
||||
err = ErrFailedToConnectCloudServer
|
||||
|
@ -496,7 +496,7 @@ func getUser(token string) (*conf.User, error) {
|
|||
_, err := request.
|
||||
SetSuccessResult(&result).
|
||||
SetBody(map[string]string{"token": token}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/user")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/user")
|
||||
if nil != err {
|
||||
logging.LogErrorf("get community user failed: %s", err)
|
||||
return nil, errors.New(Conf.Language(18))
|
||||
|
@ -530,7 +530,7 @@ func UseActivationcode(code string) (err error) {
|
|||
SetSuccessResult(requestResult).
|
||||
SetBody(map[string]string{"data": code}).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/useActivationcode")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/useActivationcode")
|
||||
if nil != err {
|
||||
logging.LogErrorf("check activation code failed: %s", err)
|
||||
return ErrFailedToConnectCloudServer
|
||||
|
@ -551,7 +551,7 @@ func CheckActivationcode(code string) (retCode int, msg string) {
|
|||
SetSuccessResult(requestResult).
|
||||
SetBody(map[string]string{"data": code}).
|
||||
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.User.UserToken}).
|
||||
Post(util.ChinaServer + "/apis/siyuan/checkActivationcode")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/checkActivationcode")
|
||||
if nil != err {
|
||||
logging.LogErrorf("check activation code failed: %s", err)
|
||||
msg = ErrFailedToConnectCloudServer.Error()
|
||||
|
@ -567,13 +567,14 @@ func CheckActivationcode(code string) (retCode int, msg string) {
|
|||
func Login(userName, password, captcha string, cloudRegion int) (ret *gulu.Result, err error) {
|
||||
Conf.CloudRegion = cloudRegion
|
||||
Conf.Save()
|
||||
util.CurrentCloudRegion = cloudRegion
|
||||
|
||||
result := map[string]interface{}{}
|
||||
request := httpclient.NewCloudRequest30s()
|
||||
_, err = request.
|
||||
SetSuccessResult(&result).
|
||||
SetBody(map[string]string{"userName": userName, "userPassword": password, "captcha": captcha}).
|
||||
Post(getCloudServer() + "/apis/siyuan/login")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/login")
|
||||
if nil != err {
|
||||
logging.LogErrorf("login failed: %s", err)
|
||||
return nil, errors.New(Conf.Language(18))
|
||||
|
@ -600,7 +601,7 @@ func Login2fa(token, code string) (map[string]interface{}, error) {
|
|||
SetSuccessResult(&result).
|
||||
SetBody(map[string]string{"twofactorAuthCode": code}).
|
||||
SetHeader("token", token).
|
||||
Post(util.ChinaServer + "/apis/siyuan/login/2fa")
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/login/2fa")
|
||||
if nil != err {
|
||||
logging.LogErrorf("login 2fa failed: %s", err)
|
||||
return nil, errors.New(Conf.Language(18))
|
||||
|
|
|
@ -1668,12 +1668,12 @@ func buildCloudConf() (ret *cloud.Conf, err error) {
|
|||
UserID: userId,
|
||||
Token: token,
|
||||
AvailableSize: availableSize,
|
||||
Server: util.ChinaServer,
|
||||
Server: util.GetCloudServer(),
|
||||
}
|
||||
|
||||
switch Conf.Sync.Provider {
|
||||
case conf.ProviderSiYuan:
|
||||
ret.Endpoint = util.ChinaSyncServer
|
||||
ret.Endpoint = util.GetCloudSyncServer()
|
||||
case conf.ProviderS3:
|
||||
ret.S3 = &cloud.ConfS3{
|
||||
Endpoint: Conf.Sync.S3.Endpoint,
|
||||
|
|
|
@ -573,7 +573,7 @@ func planSyncAfter(d time.Duration) {
|
|||
}
|
||||
|
||||
func isProviderOnline(byHand bool) (ret bool) {
|
||||
checkURL := util.ChinaSyncServer
|
||||
checkURL := util.GetCloudSyncServer()
|
||||
skipTlsVerify := false
|
||||
switch Conf.Sync.Provider {
|
||||
case conf.ProviderSiYuan:
|
||||
|
@ -744,7 +744,7 @@ var KernelID = gulu.Rand.String(7)
|
|||
|
||||
func dialSyncWebSocket() (c *websocket.Conn, err error) {
|
||||
//endpoint := "ws://127.0.0.1:64388" + "/apis/siyuan/dejavu/ws"
|
||||
endpoint := util.ChinaWebSocketServer + "/apis/siyuan/dejavu/ws"
|
||||
endpoint := util.GetCloudWebSocketServer() + "/apis/siyuan/dejavu/ws"
|
||||
header := http.Header{
|
||||
"x-siyuan-uid": []string{Conf.User.UserId},
|
||||
"x-siyuan-kernel": []string{KernelID},
|
||||
|
|
71
kernel/util/cloud.go
Normal file
71
kernel/util/cloud.go
Normal file
|
@ -0,0 +1,71 @@
|
|||
// SiYuan - Build Your Eternal Digital Garden
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package util
|
||||
|
||||
var CurrentCloudRegion = 0
|
||||
|
||||
func GetCloudServer() string {
|
||||
if 0 == CurrentCloudRegion {
|
||||
return chinaServer
|
||||
}
|
||||
return northAmericaServer
|
||||
}
|
||||
|
||||
func GetCloudWebSocketServer() string {
|
||||
if 0 == CurrentCloudRegion {
|
||||
return chinaWebSocketServer
|
||||
}
|
||||
return northAmericaWebSocketServer
|
||||
}
|
||||
|
||||
func GetCloudSyncServer() string {
|
||||
if 0 == CurrentCloudRegion {
|
||||
return chinaSyncServer
|
||||
}
|
||||
return northAmericaSyncServer
|
||||
}
|
||||
|
||||
func GetCloudAssetsServer() string {
|
||||
if 0 == CurrentCloudRegion {
|
||||
return chinaCloudAssetsServer
|
||||
}
|
||||
return northAmericaCloudAssetsServer
|
||||
}
|
||||
|
||||
func GetCloudAccountServer() string {
|
||||
if 0 == CurrentCloudRegion {
|
||||
return chinaAccountServer
|
||||
}
|
||||
return northAmericaAccountServer
|
||||
}
|
||||
|
||||
const (
|
||||
chinaServer = "https://siyuan-sync.b3logfile.com" // 中国大陆云端服务地址,阿里云负载均衡,用于接口,数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer
|
||||
chinaWebSocketServer = "wss://siyuan-sync.b3logfile.com" // 中国大陆云端服务地址,阿里云负载均衡,用于接口,数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer
|
||||
chinaSyncServer = "https://siyuan-data.b3logfile.com/" // 中国大陆云端数据同步服务地址,七牛云 OSS,用于数据同步文件上传、下载
|
||||
chinaCloudAssetsServer = "https://assets.b3logfile.com/siyuan/" // 中国大陆云端图床服务地址,用于导出预览模式下订阅会员渲染图床
|
||||
chinaAccountServer = "https://ld246.com" // 中国大陆链滴服务地址,用于账号登录、分享发布帖子
|
||||
|
||||
northAmericaServer = "https://siyuan-cloud.liuyun.io" // 北美云端服务地址,Cloudflare
|
||||
northAmericaWebSocketServer = "wss://siyuan-cloud.liuyun.io" // 北美云端服务地址,Cloudflare,用于接口,数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer
|
||||
northAmericaSyncServer = "https://siyuan-data.liuyun.io/" // 北美云端数据同步服务地址,七牛云 OSS,用于数据同步文件上传、下载
|
||||
northAmericaCloudAssetsServer = "https://assets.liuyun.io/siyuan/" // 北美云端图床服务地址,用于导出预览模式下订阅会员渲染图床
|
||||
northAmericaAccountServer = "https://liuyun.io" // 流云服务地址,用于账号登录、分享发布帖子
|
||||
|
||||
BazaarStatServer = "http://bazaar.b3logfile.com" // 集市包统计服务地址,直接对接 Bucket 没有 CDN
|
||||
BazaarOSSServer = "https://oss.b3logfile.com" // 云端对象存储地址,七牛云,仅用于读取集市包,全球 CDN
|
||||
)
|
|
@ -35,22 +35,6 @@ var (
|
|||
UserAgent = "SiYuan/" + Ver
|
||||
)
|
||||
|
||||
const (
|
||||
ChinaServer = "https://siyuan-sync.b3logfile.com" // 中国大陆云端服务地址,阿里云负载均衡,用于接口,数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer
|
||||
ChinaWebSocketServer = "wss://siyuan-sync.b3logfile.com" // 中国大陆云端服务地址,阿里云负载均衡,用于接口,数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer
|
||||
ChinaSyncServer = "https://siyuan-data.b3logfile.com/" // 中国大陆云端数据同步服务地址,七牛云 OSS,用于数据同步文件上传、下载
|
||||
ChinaCloudAssetsServer = "https://assets.b3logfile.com/siyuan/" // 中国大陆云端图床服务地址,用于导出预览模式下订阅会员渲染图床
|
||||
ChinaAccountServer = "https://ld246.com" // 中国大陆链滴服务地址,用于账号登录、分享发布帖子
|
||||
|
||||
NorthAmericaServer = "https://siyuan-cloud.liuyun.io" // 北美云端服务地址,Cloudflare
|
||||
NorthAmericaWebSocketServer = "wss://siyuan-cloud.liuyun.io" // 北美云端服务地址,Cloudflare,用于接口,数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer
|
||||
NorthAmericaSyncServer = "https://siyuan-data.liuyun.io/" // 北美云端数据同步服务地址,七牛云 OSS,用于数据同步文件上传、下载
|
||||
NorthAmericaCloudAssetsServer = "https://assets.liuyun.io/siyuan/" // 北美云端图床服务地址,用于导出预览模式下订阅会员渲染图床
|
||||
NorthAmericaAccountServer = "https://liuyun.io" // 流云服务地址,用于账号登录、分享发布帖子
|
||||
|
||||
BazaarStatServer = "http://bazaar.b3logfile.com" // 集市包统计服务地址,直接对接 Bucket 没有 CDN
|
||||
BazaarOSSServer = "https://oss.b3logfile.com" // 云端对象存储地址,七牛云,仅用于读取集市包,全球 CDN
|
||||
)
|
||||
|
||||
func ShortPathForBootingDisplay(p string) string {
|
||||
if 25 > len(p) {
|
||||
|
|
|
@ -38,7 +38,7 @@ func GetRhyResult(force bool) (map[string]interface{}, error) {
|
|||
}
|
||||
|
||||
request := httpclient.NewCloudRequest30s()
|
||||
_, err := request.SetSuccessResult(&cachedRhyResult).Get(ChinaServer + "/apis/siyuan/version?ver=" + Ver)
|
||||
_, err := request.SetSuccessResult(&cachedRhyResult).Get(GetCloudServer() + "/apis/siyuan/version?ver=" + Ver)
|
||||
if nil != err {
|
||||
logging.LogErrorf("get version info failed: %s", err)
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Reference in a new issue