├── README.md
├── index.html
├── index.js
├── logo.ico
├── main.css
└── main.js
/README.md:
--------------------------------------------------------------------------------
1 | # 189-down
2 | 天翼云网盘分享直链解析,支持目录
3 |
4 | demo:[Github Pages版本](https://libsgh.github.io/189-down/)
5 | [cf workers版本](https://pan.noki.workers.dev/)
6 |
7 | ### 食用方法:
8 | 1. fork本项目
9 | 2. 开启Github Pages
10 | 3. 绑定域名(可选)
11 | 4. enjoy it!
12 | > cf-workers也是可以部署的,复制[index.js](https://cdn.jsdelivr.net/gh/libsgh/189-down@main/index.js)
13 |
14 | ### 接口说明
15 |
16 | - ~~接口源自隔壁:[PanIndex](https://github.com/libsgh/PanIndex)~~
17 | - 由于PanIndex支持多网盘模式,接口可能会失效,所以我将接口独立了出来
18 |
19 | ```
20 | https://api.noki.top/pan/cloud189/shareToDown
21 | ```
22 | - 可以在`main.js`中替换自己的api地址
23 | - 直接部署
24 | 下载 https://github.com/libsgh/189-down/releases/ 下载api程序
25 | 设置环境变量
26 | ```
27 | $ vi /etc/profile
28 | # export cloud189_user=xxx
29 | # export cloud189_password=xxx
30 | # export access_token=找我获取
31 | $ source /etc/profile
32 | ```
33 | 解压
34 | ```
35 | $ echo
36 | $ nohup ./189-share-api -port=8080 &
37 | ```
38 | - docker部署
39 | ```
40 | docker stop 189-share-api
41 | docker rm 189-share-api
42 | docker run -itd \
43 | --name 189-share-api \
44 | -d -p 8080:8080 \
45 | -e PORT=8080 \
46 | -e cloud189_user=xxx \
47 | -e cloud189_password=xxx \
48 | -e access_token=找我获取 \
49 | iicm/189-share-api:latest
50 | ```
51 | - 免费试用授权token,有效期至2022-02-08
52 | `Yt1mz7bUWMmWdEqnYdb7ZSOnrrxb828FczklEeBvVsfQxC6EBOtCDFLkjNRhmg8ODvTeuZhnRj0lRKHbcgClWsXOh0E4UTFZ0KQdhhZ9xae53OjglRTwd8LSuyHVJaDVfK+NvbyhDDJrss8lN2vodBxT1S6njRV5FIqqn12jOoQ=`
53 |
54 |
55 | ### 测试分享链接
56 | * 无密码文件
57 |
58 | - 链接:https://cloud.189.cn/t/aQjy6nBfUZJf
59 | * 密码文件
60 |
61 | - 链接:https://cloud.189.cn/t/6zIBFnA32M3u
62 |
63 | - 访问码:8h2j
64 | * 无密码文件夹
65 |
66 | - 链接:https://cloud.189.cn/t/NbeiEfBzqee2
67 | * 密码文件夹
68 |
69 | - 链接:https://cloud.189.cn/t/EJbeIf2In6zq
70 |
71 | - 访问码:6lrv
72 |
73 | ### TODO List
74 |
75 | - [x] 阿里云盘分享解析
76 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
17 |
18 | 天翼云盘分享直链解析
19 |
20 |
21 |
22 |
23 |
天翼云盘分享直链解析
24 |
若没有分享密码则无需填写
25 |
文件夹会先展示列表
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
47 |
50 |
57 |
58 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const html = `
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
17 |
18 | 天翼云盘分享直链解析
19 |
20 |
21 |
22 |
23 |
天翼云盘分享直链解析
24 |
若没有分享密码则无需填写
25 |
文件夹会先展示列表
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
47 |
50 |
57 |
58 |
63 |
64 |
65 | `
66 |
67 | async function handleRequest(request) {
68 | return new Response(html, {
69 | headers: {
70 | "content-type": "text/html;charset=UTF-8",
71 | },
72 | })
73 | }
74 |
75 | addEventListener("fetch", event => {
76 | return event.respondWith(handleRequest(event.request))
77 | })
--------------------------------------------------------------------------------
/logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libsgh/189-down/d149d0103ecd40f57f904520045f7862af8f3f8f/logo.ico
--------------------------------------------------------------------------------
/main.css:
--------------------------------------------------------------------------------
1 | .mdui-appbar .mdui-toolbar{
2 | height:56px;
3 | font-size: 16px;
4 | }
5 | .mdui-toolbar>*{
6 | padding: 0 6px;
7 | margin: 0 2px;
8 | opacity:0.5;
9 | }
10 | .mdui-toolbar>.mdui-typo-headline{
11 | padding: 0 16px 0 0;
12 | }
13 | .mdui-toolbar>i{
14 | padding: 0;
15 | }
16 | .mdui-toolbar>a:hover,a.mdui-typo-headline,a.active{
17 | opacity:1;
18 | }
19 | .mdui-container{
20 | max-width:980px;
21 | }
22 | .mdui-list-item{
23 | -webkit-transition:none;
24 | transition:none;
25 | }
26 | .mdui-list>.th{
27 | background-color:initial;
28 | }
29 | .mdui-list-item>a{
30 | width:100%;
31 | line-height: 48px
32 | }
33 | .mdui-list-item{
34 | margin: 2px 0px;
35 | padding:0;
36 | }
37 | .mdui-toolbar>a:last-child{
38 | opacity:1;
39 | }
40 | @media screen and (max-width:980px){
41 | .mdui-list-item .mdui-text-right{
42 | display: none;
43 | }
44 | .mdui-container{
45 | width:100% !important;
46 | margin:0px;
47 | }
48 | .mdui-toolbar>*{
49 | display: none;
50 | }
51 | .mdui-toolbar>a:last-child,.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>i:first-child{
52 | display: block;
53 | }
54 | }
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | var $ = mdui.$;
2 | var api = 'https://api.noki.icu/pan/cloud189/shareToDown';
3 | $("#downBtn").on('click', function (e) {
4 | getFolder("", false, "");
5 | });
6 | function initFiles(d, flag, pId){
7 | var initHtml = ''+
8 | ' 文件 expand_more
'+
9 | ' 修改时间 expand_more
'+
10 | ' 大小 expand_more
'+
11 | '';
12 | if(flag){
13 | initHtml+=''+
14 | ' '+
15 | ' '+
16 | ' arrow_upward'+
17 | ' ..'+
18 | '
'+
19 | ' '+
20 | ' '+
21 | ' '+
22 | ' ';
23 | }
24 | //文件夹
25 | $.each(d.fileListAO.folderList, function(i, item){
26 | initHtml += ''+
27 | ' '+
28 | ' '+
29 | ' folder_open'+
30 | ' '+item.name+
31 | '
'+
32 | ' '+item.lastOpTime+'
'+
33 | ' '+formatFileSize(0)+'
'+
34 | ' '+
35 | ' ';
36 | });
37 | //文件
38 | $.each(d.fileListAO.fileList, function(i, item){
39 | initHtml += ''+
40 | ' '+
41 | ' '+
42 | ' insert_drive_file'+
43 | ' '+item.name+
44 | '
'+
45 | ' '+item.lastOpTime+'
'+
46 | ' '+formatFileSize(item.size)+'
'+
47 | ' '+
48 | ' ';
49 | });
50 | $("ul").html(initHtml);
51 | }
52 | function getFolder(fileId, flag, pId){
53 | var url = $("input[name=url]").val();
54 | if(url == ""){
55 | mdui.snackbar({
56 | message: '您还没有输入分享链接!'
57 | });
58 | }
59 | $.ajax({
60 | method: 'GET',
61 | url: api,
62 | data: $.param({ url: $("input[name=url]").val(), passCode: $("input[name=passCode]").val(),fileId:fileId}),
63 | success: function (data) {
64 | if(isJSON(data)){
65 | var d = JSON.parse(data);
66 | initFiles(d, flag, pId);
67 | }else{
68 | if(data == "https://cloud.189.cn/"){
69 | mdui.snackbar({
70 | message: '请输入正确的分享链接和密码!'
71 | });
72 | }else{
73 | if (data == "400"){
74 | //文件内容违规,下载失败
75 | mdui.snackbar({
76 | message: '文件内容违规,下载失败'
77 | });
78 | }else{
79 | location.href = data;
80 | }
81 | }
82 | }
83 | }
84 | });
85 | }
86 | function redirectDown(fileId, shareId){
87 | $.ajax({
88 | method: 'GET',
89 | url: api,
90 | data: $.param({url: $("input[name=url]").val(), fileId: fileId, shareId: shareId, passCode: $("input[name=passCode]").val()}),
91 | success: function (data) {
92 | if (data == "400"){
93 | //文件内容违规,下载失败
94 | mdui.snackbar({
95 | message: '文件内容违规,下载失败'
96 | });
97 | }else{
98 | location.href = data;
99 | }
100 | }
101 | });
102 | }
103 | function isJSON(str) {
104 | if (typeof str == 'string') {
105 | try {
106 | JSON.parse(str);
107 | return true;
108 | } catch(e) {
109 | return false;
110 | }
111 | }
112 | }
113 | function formatFileSize(fileSize) {
114 | if(fileSize == 0){
115 | return "-";
116 | }
117 | if (fileSize < 1024) {
118 | return fileSize + 'B';
119 | } else if (fileSize < (1024*1024)) {
120 | var temp = fileSize / 1024;
121 | temp = temp.toFixed(2);
122 | return temp + 'KB';
123 | } else if (fileSize < (1024*1024*1024)) {
124 | var temp = fileSize / (1024*1024);
125 | temp = temp.toFixed(2);
126 | return temp + 'MB';
127 | } else {
128 | var temp = fileSize / (1024*1024*1024);
129 | temp = temp.toFixed(2);
130 | return temp + 'GB';
131 | }
132 | }
--------------------------------------------------------------------------------