OnePoint config.json 配置详解

in 映射网盘 with 0 comment

概述

OnePoint 将配置与部署相分离,本文档将重点介绍 config.json 文件的配置过程,至于部署,请参考其他文档。

以下教程适用于 OnePoint v1.3

总览

config.json 分为三个部分

全局配置 G_CONFIG

云盘索引 DRIVE_MAP

域名索引 DOMAIN_MAP

G_CONFIG

全局配置部分,各部分介绍如下

    "G_CONFIG": {
        "admin_password": "admin",//管理员密码
        "render_name": "simple",//主题名称
        
        "site_name": "onePoint Demo",//网站名称
        "site_title": "onePoint Demo",//网站标题
        "site_icon": "https://ukuq.github.io/onepoint/favicon.png",//图标
        "site_keywords": "onePoint",//关键词
        "site_description": "onePoint description",//描述
        "site_script": "",//全站脚本,可用于存放统计等信息
        
        "proxy": [//可选代理
            "https://proxy.onesrc.workers.dev/"
        ]
    }

这里额外提一下 proxy,部署代码来自 利用 cloudflare 写了个下载辅助工具

DRIVE_MAP

云盘索引部分,各部分意义如下:

"<映射路径>":{
    "funcName": "<模块名>",
    "spConfig": {
        "root":""//根目录偏移,可以留空
    },
    "password": "mmx"//云盘级密码,访问该云盘时触发
}

映射路径

映射路径是需要映射的路径,类似于 linux 里面的 mount 操作,可以映射为任意类型的路径。但需要注意 不能使用 /admin/.*/api/.*/tmp/.* 三个保留路径。

只要你愿意,映射路径甚至可以为 /a/b/c/d/ ,但要注意必须保证开头和结尾均为 /.

云盘模块

各个模块配置(spConfig)略有差别,目前支持的模块有

DOMAIN_MAP

反向代理时使用,格式为

"<ip>": {
    "domain": "<域名>",
    "path": "<路径 p0>"
}

完整示例

{
    "G_CONFIG": {
        "admin_password": "admin",
        "render_name": "simple",
        "site_name": "OnePoint Demo",
        "site_title": "OnePoint Demo",
        "site_icon": "https://ukuq.github.io/onepoint/favicon.png",
        "site_keywords": "OnePoint",
        "site_description": "OnePoint description",
        "site_script": "",
        "proxy": [
            "https://proxy.onesrc.workers.dev/"
        ]
    },
    "DRIVE_MAP": {
        "/demo_sharepoint/": {
            "funcName": "onedrive_sharepoint",
            "spConfig": {
                "shareUrl": "https://lovelearn-my.sharepoint.com/:f:/g/personal/admin_share_onesrc_cc/Es6CMetI4fJCr4GqWZ3uvA0BEnzJxxb4CU-iQr04VYomLQ?e=C9K35U",
                "root": ""
            }
        },
        "/demo_linux/": {
            "funcName": "linux_scf",
            "spConfig": {
                "root": ""
            }
        },
        "/demo_goindex/": {
            "funcName": "gdrive_goindex",
            "spConfig": {
                "password": "index",
                "cfurl": "https://goindex.onesrc.workers.dev"
            }
        },
        "/demo_onedrive/": {
            "funcName": "onedrive_graph",
            "spConfig": {
                "refresh_token": "OAQABAAAAAACQN9QBRU3jT6bcBQLZNUj7qYv3YSeiMsEu9BaICGzevCs5Fh8UDBFaDp0DdAA_vse2HYPIjcTS27BJb_Vh_FBj6gXv7Xf37SpLyiw6I8GMofyMUM7PpjbJdIuaA7QRunZKijQxEGSDnLPj-GoVrlnMlsyxRgYptnNuciTxRLiwzO67B-_TxAdU5RTyhLSVhSOORYmTDfrZolR5KtIVvqMztUAs1-kMUZAXOEiqBBHO_arzD3Z35yAocoXsiBi1-NdNGz9agVYLzOhnV3xzwIp_3FLkQbXom4tJpLQCtsR-g_1izairu2JALzYq0rDDhL1w225YJi0yS93Fq96tfwJDtgshe8et0q9YMIRxwaW5eK1mDJBQkmJGgm39AGjRmNW2SNiZPdgqIapi6cJzVqnB-a-ctp6mW4p4o_p8kgMhFJGSdAOR_RT6J0zsBt1dbVyvO_xaeh0jkPi6v0N_Frku3uYWPvpSEjQ3e-F8GWmN3Wr9QGNHLwAVVNRL3urvLKXmRZ-yVZfE1xlqys4loqBrg50kcUOWeWhG-60PaO1hTQgxL28mnNc02QZHGBP3Y_72HsTJZWRneVFh-L6N7kwaktoIV6yxC7ocnW6rHpWPW5efujc9U-ZYaTwUaevYC7SOVdA-LnnTw-ydGtNLghM5jTaQR8k6-mgo0v7gi32yzoNDHhFQeKJptBlyb9vdzviFfJMtkZj3-uQy1kHtDAs6cfwOPUlENnRhIpWvxqFxYfkBKvhtWBOm4C_MJdDuHc9SojLkOByI5lwrFU7FAmI-IAA",
                "oauth": 0
            }
        },
        "/demo_password_123/": {
            "funcName": "onedrive_sharepoint",
            "spConfig": {
                "shareUrl": "https://lovelearn-my.sharepoint.com/:f:/g/personal/admin_share_onesrc_cc/Es6CMetI4fJCr4GqWZ3uvA0BEnzJxxb4CU-iQr04VYomLQ?e=C9K35U",
                "root": "/image"
            },
            "password": "123"
        },
        "/": {
            "funcName": "system_phony",
            "spConfig": {}
        },
        "/demo_phony/": {
            "funcName": "system_phony",
            "spConfig": {
                "list": {
                    "/": ["https://ukuq.github.io/onepoint/log.md","https://ukuq.github.io/hello-word/README.md","https://ukuq.github.io/onepoint/favicon.png","http://www.w3school.com.cn/i/horse.ogg","http://www.w3school.com.cn/i/movie.mp4","http://www.w3school.com.cn/i/movie.ogg"]
                }
            }
        }
    },
    "DOMAIN_MAP": {
        "110.11.110.11": {
            "domain": "www.example.com",
            "path": "/point"
        }
    }
}
Responses