A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)
1// SiYuan - Refactor your thinking
2// Copyright (c) 2020-present, b3log.org
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Affero General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Affero General Public License for more details.
13//
14// You should have received a copy of the GNU Affero General Public License
15// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17package util
18
19var CurrentCloudRegion = 0
20
21func IsChinaCloud() bool {
22 return 0 == CurrentCloudRegion
23}
24
25func GetCloudServer() string {
26 if 0 == CurrentCloudRegion {
27 return chinaServer
28 }
29 return northAmericaServer
30}
31
32func GetCloudWebSocketServer() string {
33 if 0 == CurrentCloudRegion {
34 return chinaWebSocketServer
35 }
36 return northAmericaWebSocketServer
37}
38
39func GetCloudSyncServer() string {
40 if 0 == CurrentCloudRegion {
41 return chinaSyncServer
42 }
43 return northAmericaSyncServer
44}
45
46func GetCloudAssetsServer() string {
47 if 0 == CurrentCloudRegion {
48 return chinaCloudAssetsServer
49 }
50 return northAmericaCloudAssetsServer
51}
52
53func GetCloudAccountServer() string {
54 if 0 == CurrentCloudRegion {
55 return chinaAccountServer
56 }
57 return northAmericaAccountServer
58}
59
60func GetCloudForumAssetsServer() string {
61 if 0 == CurrentCloudRegion {
62 return chinaForumAssetsServer
63 }
64 return northAmericaForumAssetsServer
65}
66
67func GetGitHubApiEndpoint() string {
68 return GitHubApiEndpoint
69}
70
71func GetGitHubSiyuanRepo() string {
72 return GitHubSiyuanRepo
73}
74
75func GetGitHubBazaarRepo() string {
76 return GitHubBazaarRepo
77}
78
79func GetGitHubBazaarBranch() string {
80 return GitHubBazaarBranch
81}
82
83const (
84 chinaServer = "https://chinaServer.invalid" // 中国大陆云端服务地址,阿里云负载均衡,用于接口(数据同步文件上传、下载会走七牛云 OSS ChinaSyncServer)
85 chinaWebSocketServer = "wss://chinaWebSocketServer.invalid" // 中国大陆云端 WebSocket 服务地址,阿里云负载均衡
86 chinaSyncServer = "https://chinaSyncServer.invalid/" // 中国大陆云端数据同步服务地址,七牛云 OSS,用于数据同步文件上传、下载
87 chinaCloudAssetsServer = "https://chinaCloudAssetsServer.invalid/" // 中国大陆云端图床服务地址,用于导出预览模式下订阅会员渲染图床
88 chinaAccountServer = "https://chinaAccountServer.invalid" // 中国大陆链滴服务地址,用于账号登录、分享发布帖子
89 chinaForumAssetsServer = "https://chinaForumAssetsServer.invalid/" // 中国大陆链滴图床服务地址,用于发布文章到社区
90
91 northAmericaServer = "https://northAmericaServer.invalid" // 北美云端服务地址,Cloudflare,用于接口(数据同步文件上传、下载会走七牛云 OSS northAmericaSyncServer)
92 northAmericaWebSocketServer = "wss://northAmericaWebSocketServer.invalid" // 北美云端 WebSocket 服务地址,Cloudflare,
93 northAmericaSyncServer = "https://northAmericaSyncServer.invalid/" // 北美云端数据同步服务地址,七牛云 OSS,用于数据同步文件上传、下载
94 northAmericaCloudAssetsServer = "https://northAmericaCloudAssetsServer.invalid/" // 北美云端图床服务地址,用于导出预览模式下订阅会员渲染图床
95 northAmericaAccountServer = "https://northAmericaAccountServer.invalid" // 流云服务地址,用于账号登录、分享发布帖子
96 northAmericaForumAssetsServer = "https://northAmericaForumAssetsServer.invalid/" // 北美云端图床服务地址,用于发布文章到社区
97
98 GitHubApiEndpoint = "https://api.github.com"
99 GitHubSiyuanRepo = "siyuan-note/siyuan"
100 GitHubBazaarRepo = "siyuan-note/bazaar"
101 GitHubBazaarBranch = "main"
102
103 BazaarStatServer = "https://bazaar.b3logfile.com" // 集市包统计服务地址,七牛云,全球 CDN
104 BazaarOSSServer = "https://oss.b3logfile.com" // 云端对象存储地址,七牛云,仅用于读取集市包,全球 CDN
105)