Skip to content

Commit 6188f73

Browse files
committedSep 20, 2024
新增 [带密码的分享链接自动输密码] 对 ?pwd=?passwd= 的支持
1 parent 7dfc753 commit 6188f73

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed
 

‎Lanzou-Enhanced.user.js

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 蓝奏云网盘增强
3-
// @version 1.5.5
3+
// @version 1.5.6
44
// @author X.I.U
55
// @description 文件排序、刷新不回根目录、快捷返回上一级(右键网页空白处)、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、一键复制所有分享链接、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、优化编辑框初始大小
66
// @match *://lanzou.com/u
@@ -148,6 +148,7 @@
148148

149149
if (window.top.location.pathname === '/u' || window.top.location.pathname.indexOf('account.php') > -1 || window.top.location.pathname.indexOf('mydisk.php') > -1) { // 后台页
150150
if (window.top.location.href != 'https://pc.woozooo.com/mydisk.php') window.top.location.href = 'https://pc.woozooo.com/mydisk.php';
151+
RememberLoginStatus() // 通过延长 cookie 到期时间来一直记住登录状态
151152
var mainframe;
152153
iframe();
153154
} else if (window.top.location.pathname.indexOf('%') > -1) { // > 带密码的分享链接页面
@@ -197,16 +198,16 @@
197198
shareLink = location.origin + shareLink[0]
198199
let password = location.pathname.replace('%E5%AF%86%E7%A0%81',':').replace(/%([A-Z]|[0-9]){2}/ig, '').split(':')
199200
if (password.length > 0) {
200-
location.replace(shareLink + '?password=' + password[password.length - 1])
201+
location.replace(shareLink + '?pwd=' + password[password.length - 1])
201202
}
202203
}
203204
}
204205
}
205206

206207

207-
// 自动输入密码(仅支持访问 带密码的分享链接 时)
208+
// 自动输入密码(仅支持访问 带密码的分享链接 时,比如上面 [带密码的分享链接自动输密码] 功能重定向后的链接
208209
function enterPassword() {
209-
if (location.search.indexOf('?password=') > -1) {
210+
if (location.search.indexOf('?pwd=') > -1 || location.search.indexOf('?passwd=') > -1 || location.search.indexOf('?password=') > -1) {
210211
let password = location.search.split('=')
211212
if (password.length > 0) {
212213
document.getElementById('pwd').value = password[password.length - 1]
@@ -624,6 +625,24 @@
624625
observer.observe(mainframe.document, { childList: true, subtree: true });
625626
}
626627

628+
// 通过延长 cookie 到期时间来一直记住登录状态
629+
function RememberLoginStatus() {
630+
// 获取 Cookie
631+
function getCookie(name) {
632+
if (!name) return ''
633+
let arr = document.cookie.split(';');
634+
name += '=';
635+
for (let i=0; i<arr.length; i++) {let now = arr[i].trim();if (now.indexOf(name) == 0) return now.substring(name.length, now.length);}
636+
return '';
637+
}
638+
639+
const ylogin = getCookie('ylogin'), phpdisk_info = getCookie('phpdisk_info')
640+
if (ylogin !== '' && phpdisk_info !== '') { // 如果已登录(有相应 cookie),那么就延长至浏览器支持的到期时间上限(不同浏览器对到期时间的限制不一样,一般是 1-5 年)
641+
document.cookie='ylogin=' + ylogin + '; domain=.woozooo.com; expires=Thu, 18 Dec 2099 12:00:00 GMT; path=/'
642+
document.cookie='phpdisk_info=' + phpdisk_info + '; domain=pc.woozooo.com; expires=Thu, 18 Dec 2099 12:00:00 GMT; path=/'
643+
}
644+
}
645+
627646
// 文件排序
628647
function filesSort() {
629648
const frame = mainframe;

0 commit comments

Comments
 (0)
Please sign in to comment.