mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-11-10 20:50:50 +08:00
* feat(drivers/onedrive_app): 支持挂载 SharePoint 站点文档库
- 新增 `is_sharepoint` 与 `site_id` 两个配置项,开启后走 `/sites/{siteId}/drive` 而不是 `/users/{email}/drive`
- 新增 `NormalizeSiteID`,接受 `siteId,siteGuid,webGuid`、`host:/sites/name`、站点 URL 和站点集合根 URL 四种写法
- 路径形式的 site 标识在 `Init` 阶段解析成 Graph 的逗号形式并回写存储,因为 `/sites/{path}:/` 后面不能继续拼 `/drive`
- `Init` 对 SharePoint 模式校验 `site_id`,非 SharePoint 模式校验 `email` 非空
- 配额查询 `getDrive` 同步区分两种模式
- 补充 `NormalizeSiteID` 与 URL 拼接的单元测试
Co-authored-by: Claude <81847+claude@users.noreply.github.com>
* docs(drivers/onedrive_app): 补全并精简 site_id 的帮助文案
- 说明裸域名会解析成站点集合根站点,其默认文档库通常为空
- 补充完整站点 URL 也会被解析成 ID 形式
- 合并为两句话,缩短表单提示气泡长度
Co-authored-by: Claude <81847+claude@users.noreply.github.com>
* fix(drivers/onedrive_app): 根站点标识不再拼接尾冒号
- `NormalizeSiteID` 对空站点路径走 `/sites/{hostname}` 主机名寻址,只有存在站点子路径时才生成 `/sites/{hostname}:/{path}:`
- 统一 `host:/path/:` 这类多重尾字符为单个冒号
- 补充裸主机名、带尾斜杠主机名、`host:/` 三种输入的用例
Co-authored-by: Claude <81847+claude@users.noreply.github.com>
---------
Co-authored-by: Claude <81847+claude@users.noreply.github.com>
34 lines
1.4 KiB
Go
34 lines
1.4 KiB
Go
package onedrive_app
|
|
|
|
import (
|
|
"github.com/OpenListTeam/OpenList/v4/internal/driver"
|
|
"github.com/OpenListTeam/OpenList/v4/internal/op"
|
|
)
|
|
|
|
type Addition struct {
|
|
driver.RootPath
|
|
Region string `json:"region" type:"select" required:"true" options:"global,cn,us,de" default:"global"`
|
|
ClientID string `json:"client_id" required:"true"`
|
|
ClientSecret string `json:"client_secret" required:"true"`
|
|
TenantID string `json:"tenant_id"`
|
|
Email string `json:"email"`
|
|
IsSharepoint bool `json:"is_sharepoint" default:"false" help:"Mount a SharePoint site's default document library instead of a user's OneDrive"`
|
|
SiteID string `json:"site_id" help:"One of: <host>,<siteGuid>,<webGuid>; <host>:/sites/<name>; or a full site URL. Point it at the site that owns the library — a bare host resolves to the empty root-site library"`
|
|
ChunkSize int64 `json:"chunk_size" type:"number" default:"5"`
|
|
CustomHost string `json:"custom_host" help:"Custom host for onedrive download link"`
|
|
DisableDiskUsage bool `json:"disable_disk_usage" default:"false"`
|
|
EnableDirectUpload bool `json:"enable_direct_upload" default:"false" help:"Enable direct upload from client to OneDrive"`
|
|
}
|
|
|
|
var config = driver.Config{
|
|
Name: "OnedriveAPP",
|
|
LocalSort: true,
|
|
DefaultRoot: "/",
|
|
}
|
|
|
|
func init() {
|
|
op.RegisterDriver(func() driver.Driver {
|
|
return &OnedriveAPP{}
|
|
})
|
|
}
|