0000
This commit is contained in:
parent
07dbaea8ec
commit
d3104df626
@ -49,7 +49,7 @@ if command -v node &> /dev/null; then
|
||||
|
||||
# Download the Node.js proxy script
|
||||
echo "Downloading index.js..."
|
||||
if ! curl -o "index.js" "https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/index.js"; then
|
||||
if ! curl -o "index.js" "https://git.x-php.com/XiaoMo/alist-proxy/raw/branch/master/index.js"; then
|
||||
echo "Failed to download index.js. Please check your internet connection and try again."
|
||||
exit 1
|
||||
fi
|
||||
@ -97,7 +97,7 @@ else
|
||||
# Check if index.php file exists, if not, download it
|
||||
if [ ! -f "index.php" ]; then
|
||||
echo "Downloading index.php..."
|
||||
if ! curl -o "index.php" "https://x-mo.cn:9009/XiaoMo/alist-proxy/raw/branch/master/index.php"; then
|
||||
if ! curl -o "index.php" "https://git.x-php.com/XiaoMo/alist-proxy/raw/branch/master/index.php"; then
|
||||
echo "Failed to download index.php. Please check your internet connection and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
10
source.js
10
source.js
@ -31,7 +31,7 @@ const viewsInfo = {
|
||||
|
||||
// 默认端口号和 API 地址
|
||||
let port = 9001;
|
||||
let apiEndpoint = 'https://oss.x-php.com/get/';
|
||||
let apiEndpoint = 'http://47.107.93.139/get';
|
||||
|
||||
// 解析命令行参数
|
||||
args.forEach(arg => {
|
||||
@ -110,7 +110,7 @@ const server = http.createServer(async (req, res) => {
|
||||
// 当没有 token 或 undefined
|
||||
if (token === '' || typeof token === 'undefined') {
|
||||
token = reqPath;
|
||||
reqPath = 'go';
|
||||
reqPath = 'app';
|
||||
}
|
||||
|
||||
// 检查第一个路径只能是 avatar,endpoint,go,bbs,www
|
||||
@ -247,13 +247,15 @@ const isCacheValid = (cacheMetaFile, cacheContentFile) => {
|
||||
// 从 API 获取数据
|
||||
const fetchApiData = (reqPath, token, sign) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 将请求路径和参数进行编码
|
||||
const queryParams = querystring.stringify({
|
||||
type: reqPath,
|
||||
sign: sign
|
||||
});
|
||||
const apiUrl = `${apiEndpoint}?${queryParams}`;
|
||||
const apiReq = https.request(apiUrl, {
|
||||
const parsedUrl = url.parse(apiUrl);
|
||||
const protocol = parsedUrl.protocol === 'https:' ? https : http;
|
||||
|
||||
const apiReq = protocol.request(apiUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json; charset=utf-8',
|
||||
|
Loading…
x
Reference in New Issue
Block a user