// ==UserScript==
// @name OneDrive 挂载授权修复 (E5/商业版)
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 自动将 OneDrive 授权 URL 中的逗号替换为空格,解决挂载无反应的问题
// @author YourName
// @match https://login.microsoftonline.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
// 检查当前 URL 是否包含错误的 scope 拼接(逗号分隔)
if (window.location.href.indexOf("User.Read,files.readwrite") !== -1) {
console.log("检测到错误的 OneDrive 授权 URL,正在尝试修正...");
// 执行替换:将逗号替换为标准的 %20 (空格)
let newUrl = window.location.href
.replace(/User.Read,files.readwrite,offline_access/g, "User.Read%20files.readwrite%20offline_access");
// 如果你的程序还包含其他权限,可以在这里继续链式替换,例如:
// .replace(/,Sites.Read.All/g, "%20Sites.Read.All")
// 只有在 URL 确实发生改变时才跳转,防止死循环
if (newUrl !== window.location.href) {
window.location.replace(newUrl);
}
}
})();
找gemini写了个油猴脚本解决了