Compare commits

...

132 Commits

Author SHA1 Message Date
qkqpttgf 400d531fab
Merge pull request #703 from qkqpttgf/ReplitImportFromGithub
Replit import from GitHub
2023-09-06 18:24:08 +08:00
qkqpttgf a9e113fbf9
Update readme_cn.md 2023-09-06 18:23:31 +08:00
qkqpttgf f51e791072
Update deploy to replit 2023-09-06 18:21:54 +08:00
qkqpttgf 6ff6ae997b
Update deploy to replit 2023-09-06 18:16:50 +08:00
qkqpttgf 1d84a49703
Merge pull request #702 from qkqpttgf/ReplitImportFromGithub
Replit: ImportFromGithub
2023-09-06 18:07:59 +08:00
qkqpttgf ccde6a7772
Update .replit 2023-09-06 17:41:01 +08:00
qkqpttgf e7fa472f74
Merge pull request #700 from qkqpttgf/fixCustomTheme
fix customTheme
2023-08-21 18:14:53 +08:00
qkqpttgf d595234a58
try fix customTheme 2023-08-21 10:40:28 +08:00
qkqpttgf 596955ffe0
Update Vercel-php to 0.6.0 2023-08-20 17:08:48 +08:00
qkqpttgf ef70b6bcb5
Merge pull request #691 from qkqpttgf/qkqpttgf-patch-1
fix bug!
2023-05-20 15:12:49 +00:00
qkqpttgf c44677ad5c
fix 2023-05-20 23:02:47 +08:00
qkqpttgf 6275911942
fix 2023-05-20 23:00:19 +08:00
qkqpttgf b17f9af07b
Merge pull request #690 from qkqpttgf/checkPlatform
check platform
2023-05-20 10:06:14 +00:00
root 37d2697096 check platform 2023-05-12 15:21:25 +00:00
qkqpttgf bb7c865cc3
Merge pull request #689 from qkqpttgf/FGtest
FG platform change server base
2023-05-10 21:18:25 +08:00
qkqpttgf cf6f59b745
Update HuaweiFG_file.php 2023-04-16 17:07:51 +08:00
qkqpttgf 3de4f2bfde
Update HuaweiFG_env.php 2023-04-16 17:07:29 +08:00
qkqpttgf 813663b744
Update common.php 2023-04-16 16:59:15 +08:00
qkqpttgf 3f7887dab5
Update index.php 2023-04-16 16:56:40 +08:00
qkqpttgf 4a9d8c72c8
modify custom client_secret 2023-04-09 14:57:18 +08:00
qkqpttgf 60ac0c2de8
fix nix error
#673 
#677 ,
2023-04-09 14:51:20 +08:00
qkqpttgf f7f5a79d08
Merge pull request #683 from kobe-koto/patch-1
fix: #570 更新 update.sh
2023-04-07 21:20:03 +08:00
kobe koto 5a6b3a2e1c
fix: #570
fix: #570
2023-03-29 18:48:05 +08:00
qkqpttgf 8fadfa5cf0
Merge pull request #679 from BingoKingo/patch-2
Update tfo.html, fix styles
2023-03-12 19:57:49 +08:00
BingoKingo 6ecfee98e6
Update tfo.html 2023-03-11 17:22:40 +08:00
qkqpttgf 57e2c63c03
parse index.htm 2023-03-03 15:02:48 +08:00
qkqpttgf e12169d2de
BaiduDisk for test 2023-03-03 14:17:42 +08:00
qkqpttgf d46cd7c962
fix: no url to download in aliyun 2023-03-03 14:15:21 +08:00
qkqpttgf f6f9687e53
Merge pull request #669 from msterzhang/patch-1
Update Aliyundrive.php
2023-02-16 14:55:18 +08:00
zhangxiang f43dc37630
Update Aliyundrive.php
修复 invalid X-Device-Id
2023-02-16 14:12:36 +08:00
qkqpttgf 26897fc181
Merge pull request #666 from HaoTian22/purecool_login_patch1
修复Purecool主题登录时间戳问题
2023-02-02 10:18:10 +08:00
qkqpttgf 1bc7b692c2
Merge pull request #665 from HaoTian22/nchyn_grey_login_patch1
修复nchyn_grey登录无法post时间戳
2023-02-02 10:17:30 +08:00
Hao_Tian22 f9ce32d899 引入sha1.js 2023-01-28 02:48:19 +08:00
Hao_Tian22 41d0245ac1 purecool Login-Fix 2023-01-28 02:38:57 +08:00
Hao_Tian22 370c0a1f29 修复nchyn_grey登录无法post时间戳 2023-01-28 02:17:03 +08:00
qkqpttgf 2590ca22f4
Merge pull request #653 from EXStevens/master
Change the CDN into the available ones
2022-12-21 13:18:19 +08:00
EXStevens fd6da1a67c Change the CDN into available one
Change the CDN for DPlayer into available CDNs in CN.

cdn.jsdelivr.com
->fastly.jsdelivr.com & cdnjs.cloudflare.com
2022-12-17 20:11:23 +08:00
qkqpttgf 0cc83ddced
Merge pull request #633 from liblaf/bump-vercel-php
build: bump `vercel-php` from 0.5.1 to 0.5.2
2022-10-18 09:04:45 +08:00
qkqpttgf 5eddb34e3a
Merge pull request #634 from BingoKingo/patch-1
tfo theme 20221017
2022-10-18 09:01:44 +08:00
BingoKingo 12d6565eb7
tfo theme 20221017 2022-10-17 23:15:57 +08:00
Qin Li bda5b7c1fc
build: bump `vercel-php` from 0.5.1 to 0.5.2
fix #632
2022-10-06 17:25:00 +08:00
qkqpttgf 0a83622087
fix: get wrong ext 2022-09-21 15:32:15 +08:00
qkqpttgf cc0fd539a1
fix: get wrong ext 2022-09-21 15:31:25 +08:00
qkqpttgf dbb2de5f50
fix: depl state ERROR, app ID not found 2022-08-27 16:22:16 +08:00
qkqpttgf 2e5ea1bc6f
fix: jsFilenot found 2022-08-27 15:55:06 +08:00
qkqpttgf 4c36e56714
Merge pull request #619 from qkqpttgf/testjs
load some js from local
2022-08-26 17:12:02 +08:00
qkqpttgf a9ccd374b8
SCF&heroku will no longer free 2022-08-26 09:13:41 +08:00
qkqpttgf 00973a6496
scf&heroku will no longer free 2022-08-26 09:11:40 +08:00
root 80aca441d0 load marked/md5 js from local 2022-08-19 02:24:16 +00:00
root bb83f493d1 load marked/md5 js from local 2022-08-19 02:23:34 +00:00
qkqpttgf 166f00c3a7
show switch setting as select 2022-07-27 18:14:29 +08:00
qkqpttgf 94f780963b
Merge pull request #594 from hmsjy2017/patch-2
Use Fastly CDN for renexmoe theme
2022-05-28 08:33:34 +08:00
Tony b7595eee71
Use Fastly CDN for renexmoe theme 2022-05-28 00:16:54 +08:00
qkqpttgf be07cced24
fix: if no php-curl, can show error message now 2022-05-15 16:04:04 +08:00
qkqpttgf 326e7ba0e5
show " in cmd 2022-05-15 14:39:05 +08:00
qkqpttgf ce0d34084d
vercel update version 2022-05-15 11:00:38 +08:00
qkqpttgf a81c94bad3
add diskDisplay
a disk display to guest or hide, or disable for guest, only admin can visit
2022-05-04 17:19:34 +08:00
qkqpttgf f276a60a1d
add smallfileupload, fix title in encrypted folder
#576 ,
2022-04-16 10:54:15 +08:00
qkqpttgf a4d0d8dfff
try, try nothing 2022-04-16 10:51:43 +08:00
qkqpttgf 9c8c739a9c
add smallfileupload 2022-04-16 10:49:52 +08:00
qkqpttgf 00dcccee9c
add smallfileupload 2022-04-16 10:49:08 +08:00
qkqpttgf 09c276f33a
add smallfileupload 2022-04-16 10:48:22 +08:00
qkqpttgf 134e9c29cf
add smallfileupload 2022-04-16 10:47:32 +08:00
qkqpttgf 6dc5d60649
add smallfileupload 2022-04-16 10:46:42 +08:00
qkqpttgf 38d64b2d00
add smallfileupload 2022-04-16 10:45:30 +08:00
qkqpttgf 27b7aa1619
add smallfileupload 2022-04-16 10:44:43 +08:00
qkqpttgf 179641a403
add smallfileupload 2022-04-16 10:43:39 +08:00
qkqpttgf c24a6fd37e
add smallfileupload 2022-04-16 10:42:42 +08:00
qkqpttgf 97d2bce570
add smallfileupload 2022-04-16 10:41:31 +08:00
qkqpttgf 0793caec0f
add smalfileupload 2022-04-16 10:38:01 +08:00
qkqpttgf e87b00a242
add rapid copy, add smallfileupload 2022-04-16 10:36:52 +08:00
qkqpttgf 54a997acbb
simplify code 2022-03-19 11:48:41 +08:00
qkqpttgf 3e3141be80
render pdf by page, not download all file 2022-03-18 21:21:30 +08:00
qkqpttgf 2b5a3e89d7
return md5 to browser to Calc bignumber 2022-03-16 22:40:49 +08:00
qkqpttgf 1b57164db5
Calc bignumber in browser 2022-03-16 22:25:44 +08:00
qkqpttgf 7c6daaddbb
fix: cant copy url in guestupload 2022-03-09 16:03:04 +08:00
qkqpttgf e16a7012ef
fix check bcmath, fix error proof when no bcmath 2022-03-09 15:11:08 +08:00
qkqpttgf ed631d958d
rapid upload (need bcmath) 2022-03-09 14:11:41 +08:00
qkqpttgf 64096211e2
rapid upload for aliyundrive (need bcmath) 2022-03-09 14:03:23 +08:00
qkqpttgf 5a0d6d990f
add bchexdec 2022-03-09 13:59:36 +08:00
qkqpttgf 6eb6a826cf
change sortablejs to unpkg 2022-02-22 10:38:40 +08:00
qkqpttgf cfdebf35b7
change sha1.js&ionicons.js from jsdelivr to unpkg 2022-02-22 10:26:57 +08:00
qkqpttgf a7acdaeb7c
change sha1.js from jsdelivr to unpkg 2022-02-22 10:25:45 +08:00
qkqpttgf c48ebba178
fix $$ bug 2022-02-19 13:41:00 +08:00
qkqpttgf 8d6864f145
fix: can read js in ../ 2022-02-18 18:24:13 +08:00
qkqpttgf 5433fe0522
add log in txt 2022-02-18 16:15:12 +08:00
qkqpttgf e209d98ad8
check txtfile charset 2022-02-18 16:13:38 +08:00
qkqpttgf eb1319119a
check txtfile charset 2022-02-18 16:11:23 +08:00
qkqpttgf 46fb778cb5
Create sha1.min.js 2022-02-17 18:14:04 +08:00
qkqpttgf 0271dc5b9f
load sha1.js from program when login 2022-02-17 18:08:37 +08:00
qkqpttgf 4a866c8aa2
load sha1.js from program 2022-02-17 18:05:13 +08:00
qkqpttgf 7329e51368
show md when no file listing 2022-02-17 16:05:10 +08:00
qkqpttgf a259f9e5ee
try fix: force https in azurewebsite 2022-02-17 16:00:41 +08:00
qkqpttgf e8b89d3296
show MD in preview 2022-02-10 11:10:57 +08:00
qkqpttgf d2a31efb43
MultiDiskArea add back 2022-02-10 10:37:38 +08:00
qkqpttgf 93569049ea
autoJumpFirstDisk function add back 2022-02-10 10:36:46 +08:00
qkqpttgf 816513cde7
fix: login page 2022-01-30 16:17:41 +08:00
qkqpttgf 3e8919b642
Update renexmoe.html 2022-01-30 16:16:51 +08:00
qkqpttgf 1ba3f28226
fix: login page 2022-01-30 16:16:06 +08:00
qkqpttgf 2570bad78b
fix: login page 2022-01-30 16:15:22 +08:00
qkqpttgf bb291b7ae8
fix: login page 2022-01-30 16:14:29 +08:00
qkqpttgf b9953586c8
fix: login page 2022-01-30 16:13:42 +08:00
qkqpttgf 2d192e5623
fix: login page 2022-01-30 16:12:48 +08:00
qkqpttgf 4073323d7c
fix: ?login can return loginpage 2022-01-30 15:55:54 +08:00
root 29840c8b26 rm disktag length limit 2022-01-29 14:02:04 +00:00
qkqpttgf 9fa89acb5b
log the install 2022-01-29 20:40:40 +08:00
qkqpttgf 3cf47c7c94
fix : can not sort disks 2022-01-29 20:24:53 +08:00
qkqpttgf c0fdfd341a
fix : getenv(null)
be58a17328
2022-01-27 22:06:26 +08:00
qkqpttgf c6f8c1cd5c
Merge pull request #525 from VBill/update-aliyun-fc-check
fix: check aliyun fc with official env var
2022-01-27 15:03:40 +08:00
Menu Yang 79c35daca0 fix: check aliyun fc with official env var
Check aliyun fc with official env var.
    see example code in: https://help.aliyun.com/document_detail/89032.html
    use of FC_SERVER_PATH with fixed path php7.2 may not compatible with higher php version
2022-01-27 15:00:30 +08:00
qkqpttgf 95c6657dc1
fix aliyun FC platform 2022-01-27 14:50:09 +08:00
qkqpttgf dc462d8e64
Update version 2022-01-27 12:36:39 +08:00
qkqpttgf e2df7c19c6
rm multiDiskArea, change login page 2022-01-27 12:00:19 +08:00
qkqpttgf 5274405e7a
get method 2022-01-27 11:57:30 +08:00
qkqpttgf 4d6cecd11c
Update TencentSCF_env.php 2022-01-27 11:56:39 +08:00
qkqpttgf a8ba8b3157
get method 2022-01-27 11:55:24 +08:00
qkqpttgf 38165fa25d
get method 2022-01-27 11:54:29 +08:00
qkqpttgf 1a8f1cb962
get method 2022-01-27 11:53:33 +08:00
qkqpttgf 011471289b
get method 2022-01-27 11:52:24 +08:00
qkqpttgf 51a85ae30e
set default timezone 2022-01-27 11:51:04 +08:00
qkqpttgf 083443a4b5
change login page, add global md config 2022-01-27 11:49:41 +08:00
qkqpttgf bc86e38c71
change login page, rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config
change login page, rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config
2022-01-27 11:48:01 +08:00
qkqpttgf be58a17328
try fix : getenv(null) 2022-01-20 22:08:04 +08:00
qkqpttgf c5e7cabe09
can not copy file by rapid_upload, so return 415 2022-01-18 13:08:48 +08:00
qkqpttgf 08c12518a7
show upload progress in table background 2022-01-18 13:04:46 +08:00
qkqpttgf 9572b68be9
fix bug: turn index when adding disk 2022-01-16 15:58:42 +08:00
qkqpttgf 38799d427e
fix bug: turn index when adding disk 2022-01-16 15:57:25 +08:00
qkqpttgf 1b8287062d
more smoothly in Adding Onedrive disk 2022-01-14 10:29:29 +08:00
qkqpttgf f2d53d45af
Allow Preview when enable downloadencrypt
#506 ,
2022-01-09 16:07:59 +08:00
qkqpttgf c8adcbbd7a
add / at last, via SCF default link. 2022-01-09 14:05:25 +08:00
qkqpttgf ac4defe663
add 'current folder' in 'refresh cache' 2022-01-06 09:31:03 +08:00
qkqpttgf 8cf8c11cde
fix bug: visit file in encrypted folder will add / at last 2022-01-01 11:45:23 +00:00
36 changed files with 6846 additions and 2346 deletions

View File

@ -1,3 +1,7 @@
language = "php74"
run = "php -S 0.0.0.0:8000 index.php" run = "php -S 0.0.0.0:8000 index.php"
entrypoint = "index.php" entrypoint = "index.php"
[nix]
channel = "stable-22_11"
[deployment]
run = ["sh", "-c", "php -S 0.0.0.0:8000 index.php"]
deploymentTarget = "cloudrun"

1508
common.php

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ global $constStr;
$exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp']; $exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp'];
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a']; $exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']; $exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf']; $exts['txt'] = ['txt', 'log', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb']; $exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar']; $exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
@ -88,8 +88,8 @@ $constStr = [
'EnvironmentsDescription' => [ 'EnvironmentsDescription' => [
'en-us' => [ 'en-us' => [
'admin' => 'The admin password, Login button will not show when empty', 'admin' => 'The admin password, Login button will not show when empty',
'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?admin\', it is \'?{this value}\'.', 'adminloginpage' => 'if set, the Login button will not display, and the login page no longer \'?login=admin\', it is \'?login={this value}\'.',
'autoJumpFirstDisk' => 'used in multy disks, if 1, auto jump to first disk', 'autoJumpFirstDisk' => 'a switch used in multy disks, if 1, auto jump to first disk',
'customScript' => '<script> in all pages, e.g. http turn to https', 'customScript' => '<script> in all pages, e.g. http turn to https',
'customCss' => '<style> in <head>', 'customCss' => '<style> in <head>',
'customTheme' => 'an url of html', 'customTheme' => 'an url of html',
@ -98,19 +98,23 @@ $constStr = [
'diskname' => 'The disk name you want show.', 'diskname' => 'The disk name you want show.',
'diskDescription' => ' Some tips of this disk, not used in code.', 'diskDescription' => ' Some tips of this disk, not used in code.',
'disktag' => 'A tag used in store config and url.', 'disktag' => 'A tag used in store config and url.',
'disableShowThumb' => 'if 1, the ShowThumbnail button will not display', 'disableShowThumb' => 'a switch, if 1, the ShowThumbnail button will not display',
'disableChangeTheme' => 'if 1, the Theme selection button will not display', 'disableChangeTheme' => 'a switch, if 1, the Theme selection button will not display',
'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password', 'downloadencrypt' => 'a switch, 0 or 1. if 1, the files in encrypt folder can be downloaded without password',
'useBasicAuth' => 'if 1, will popup user/pass windows in encrypted folder.', 'globalHeadOmfUrl' => 'get txt from url, show it as head.omf in every page.',
'globalHeadMdUrl' => 'get txt from url, show it as head.md in every page.',
'globalReadmeMdUrl' => 'get txt from url, show it as readme.md in every page.',
'globalFootOmfUrl' => 'get txt from url, show it as foot.omf in every page.',
'useBasicAuth' => 'a switch, if 1, will popup user/pass windows in encrypted folder.',
'background' => 'Set an url as background photo.', 'background' => 'Set an url as background photo.',
'backgroundm' => 'Set an url as background in mobile phone.', 'backgroundm' => 'Set an url as background in mobile phone.',
'forceHttps' => 'if 1, force to redirect to https when visit via http.', 'forceHttps' => 'a switch, if 1, force to redirect to https when visit via http.',
'fileConduitCacheTime' => 'Input number, unit is hour, if set this, little file<1M(or fileConduitSize) will through program and cache in explorer, otherwise, default 302 to Microsoft', 'fileConduitCacheTime' => 'Input number, unit is hour, if set this, little file<1M(or fileConduitSize) will through program and cache in explorer, otherwise, default 302 to Microsoft',
'fileConduitSize' => 'Input number, unit is M(suggest less than 4M), if set this, little file<this value will through program and cache in explorer, otherwise, default 302 to Microsoft', 'fileConduitSize' => 'Input number, unit is M(suggest less than 4M), if set this, little file<this value will through program and cache in explorer, otherwise, default 302 to Microsoft',
'theme' => 'Select theme for guest.', 'theme' => 'Select theme for guest.',
'timezone' => 'Set default timezone.', 'timezone' => 'Set default timezone.',
'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.', 'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md', 'hideFunctionalityFile' => 'a switch, 0 or 1. if 1, some file will not show in list to guest, like readme.md',
'passfile' => 'The password of folder(& its childrens) will save in this file.', 'passfile' => 'The password of folder(& its childrens) will save in this file.',
'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last', 'domainforproxy' => 'Will replace the https://xxxxx-my.sharepoint.com with this value.Add &Origindomain=xxxxx-my.sharepoint.com at last',
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.', 'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
@ -118,8 +122,8 @@ $constStr = [
], ],
'zh-cn' => [ 'zh-cn' => [
'admin' => '管理密码,不添加时不显示登录页面且无法登录。', 'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?admin\',而是\'?此设置的值\'。', 'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?login=admin\',而是\'?login=此设置的值\'。',
'autoJumpFirstDisk' => '用于多个磁盘如果为1则自动跳转到第一个磁盘', 'autoJumpFirstDisk' => '一个开关,用于多个磁盘如果为1则自动跳转到第一个磁盘',
'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https', 'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https',
'customCss' => '<style>,在<head>最后面', 'customCss' => '<style>,在<head>最后面',
'customTheme' => 'html格式的主题的url', 'customTheme' => 'html格式的主题的url',
@ -128,19 +132,23 @@ $constStr = [
'diskname' => '这个盘你想显示什么名称。', 'diskname' => '这个盘你想显示什么名称。',
'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。', 'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
'disktag' => '一个标签用于保存配置多盘时会显示在url中。', 'disktag' => '一个标签用于保存配置多盘时会显示在url中。',
'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。', 'disableShowThumb' => '一个开关,如果填 1, ‘显示缩略’按钮将被隐藏。',
'disableChangeTheme' => '如果为 1则不会显示主题选择按钮', 'disableChangeTheme' => '一个开关,如果为 1则不会显示主题选择按钮',
'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', 'downloadencrypt' => '一个开关0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
'useBasicAuth' => '如果为 1加密目录将弹出用户名密码窗口不会显示主题自带的输入密码页面。', 'globalHeadOmfUrl' => '从url获取文本当成head.omf显示在每一页。',
'globalHeadMdUrl' => '从url获取文本当成head.md显示在每一页。',
'globalReadmeMdUrl' => '从url获取文本当成readme.md显示在每一页。',
'globalFootOmfUrl' => '从url获取文本当成foot.omf显示在每一页。',
'useBasicAuth' => '一个开关,如果为 1加密目录将弹出用户名密码窗口不会显示主题自带的输入密码页面。',
'background' => '设置一个url作为背景。', 'background' => '设置一个url作为背景。',
'backgroundm' => '设置一个url作为手机端用的背景。', 'backgroundm' => '设置一个url作为手机端用的背景。',
'forceHttps' => '0或1。如果设置为1会强制跳https', 'forceHttps' => '一个开关,0或1。如果设置为1会强制跳https',
'fileConduitCacheTime' => '填数字单位是小时如果设置小于1M(或fileConduitSize)的小文件会从程序通过然后缓存在浏览器不然默认302跳微软', 'fileConduitCacheTime' => '填数字单位是小时如果设置小于1M(或fileConduitSize)的小文件会从程序通过然后缓存在浏览器不然默认302跳微软',
'fileConduitSize' => '填数字单位是M(建议4M以下)如果设置小于这个值的小文件会从程序通过然后缓存在浏览器不然默认302跳微软', 'fileConduitSize' => '填数字单位是M(建议4M以下)如果设置小于这个值的小文件会从程序通过然后缓存在浏览器不然默认302跳微软',
'theme' => '为游客选择一个主题。', 'theme' => '为游客选择一个主题。',
'timezone' => '设置默认时区。', 'timezone' => '设置默认时区。',
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。', 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看但它的功能正常比如readme.md', 'hideFunctionalityFile' => '一个开关0 或 1。如果 1, 功能文件不列表给游客看但它的功能正常比如readme.md',
'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;', 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值在目标需要自己设置反代。会加上&Origindomain=原域名', 'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值在目标需要自己设置反代。会加上&Origindomain=原域名',
'public_path' => '使用API长链接访问时显示网盘文件的路径不设置时默认为根目录。', 'public_path' => '使用API长链接访问时显示网盘文件的路径不设置时默认为根目录。',
@ -148,7 +156,7 @@ $constStr = [
], ],
'zh-tw' => [ 'zh-tw' => [
'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。', 'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?admin\',而是\'?此設置的值\'。', 'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?login=admin\',而是\'?login=此設置的值\'。',
'autoJumpFirstDisk' => '用於多盤如果設1將會自動跳到第一個盤。', 'autoJumpFirstDisk' => '用於多盤如果設1將會自動跳到第一個盤。',
'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https', 'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https',
'customCss' => '<style>,在<head>最後面', 'customCss' => '<style>,在<head>最後面',
@ -173,7 +181,7 @@ $constStr = [
], ],
'ja' => [ 'ja' => [
'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。', 'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?admin \'ではなく、\'?この設定の値\'。', 'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?login=admin \'ではなく、\'?login=この設定の値\'。',
'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。', 'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。',
'customScript' => 'scriptは、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。', 'customScript' => 'scriptは、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。',
'customCss' => 'styleは、headの一番後ろにあります。', 'customCss' => 'styleは、headの一番後ろにあります。',
@ -198,7 +206,7 @@ $constStr = [
], ],
'ko-kr' => [ 'ko-kr' => [
'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.', 'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?Admin\'이 아니라 \ ?이 설정의 값 \'입니다.', 'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?login=admin\'이 아니라 \ ?login=이 설정의 값 \'입니다.',
'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.', 'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.',
'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.', 'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.',
'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에', 'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
@ -223,7 +231,7 @@ $constStr = [
], ],
'fa' => [ 'fa' => [
'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمی‌آید', 'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمی‌آید',
'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?admin\ نیست بلکه \?{مقدار ورودی شما}\ است.', 'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?login=admin\ نیست بلکه \?login={مقدار ورودی شما}\ است.',
'referrer' => '', 'referrer' => '',
'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2', 'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2',
'diskname' => 'نام دیسک که می‌خواهید نشان دهید.', 'diskname' => 'نام دیسک که می‌خواهید نشان دهید.',
@ -1126,9 +1134,9 @@ $constStr = [
'ar-sa' => 'اختيار اللغة', 'ar-sa' => 'اختيار اللغة',
], ],
'RefreshCache' => [ 'RefreshCache' => [
'en-us' => 'RefreshCache', 'en-us' => 'Refresh Cache of Current Folder',
'zh-cn' => '刷新缓存', 'zh-cn' => '刷新当前目录的缓存',
'zh-tw' => '重新整理快取', 'zh-tw' => '重新整理当前資料夾快取',
'ja' => 'キャッシュを再構築', 'ja' => 'キャッシュを再構築',
'ko-kr' => '캐시 플러시', 'ko-kr' => '캐시 플러시',
'fa' => 'رفرش cache', 'fa' => 'رفرش cache',

View File

@ -9,7 +9,10 @@ class Aliyundrive {
//$this->auth_url = 'https://websv.aliyundrive.com/token/refresh'; //$this->auth_url = 'https://websv.aliyundrive.com/token/refresh';
$this->auth_url = 'https://auth.aliyundrive.com/v2/account/token'; $this->auth_url = 'https://auth.aliyundrive.com/v2/account/token';
$this->api_url = 'https://api.aliyundrive.com/v2'; $this->api_url = 'https://api.aliyundrive.com/v2';
$this->api_url_v3 = 'https://api.aliyundrive.com/adrive/v3';
$this->driveId = getConfig('driveId', $tag); $this->driveId = getConfig('driveId', $tag);
//$this->DownurlStrName = 'download_url';
$this->DownurlStrName = 'url';
$res = $this->get_access_token(getConfig('refresh_token', $tag)); $res = $this->get_access_token(getConfig('refresh_token', $tag));
} }
@ -50,7 +53,7 @@ class Aliyundrive {
$tmp['time'] = $files['updated_at']; $tmp['time'] = $files['updated_at'];
$tmp['size'] = $files['size']; $tmp['size'] = $files['size'];
$tmp['mime'] = $files['file']['mimeType']; $tmp['mime'] = $files['file']['mimeType'];
$tmp['url'] = $files['download_url']; $tmp['url'] = $files[$this->DownurlStrName];
$tmp['content'] = $files['content']; $tmp['content'] = $files['content'];
if (isset($files['exist'])) $tmp['exist'] = $files['exist']; if (isset($files['exist'])) $tmp['exist'] = $files['exist'];
if (isset($files['rapid_upload'])) $tmp['rapid_upload'] = $files['rapid_upload']; if (isset($files['rapid_upload'])) $tmp['rapid_upload'] = $files['rapid_upload'];
@ -66,7 +69,7 @@ class Aliyundrive {
$filename = strtolower($file['name']); $filename = strtolower($file['name']);
if ($file['type']=='file') { if ($file['type']=='file') {
$tmp['list'][$filename]['type'] = 'file'; $tmp['list'][$filename]['type'] = 'file';
$tmp['list'][$filename]['url'] = $file['download_url']; $tmp['list'][$filename]['url'] = $file[$this->DownurlStrName];
$tmp['list'][$filename]['mime'] = $file['file']['content_type']; $tmp['list'][$filename]['mime'] = $file['file']['content_type'];
} elseif ($file['type']=='folder') { } elseif ($file['type']=='folder') {
$tmp['list'][$filename]['type'] = 'folder'; $tmp['list'][$filename]['type'] = 'folder';
@ -93,9 +96,10 @@ class Aliyundrive {
if (!($files = getcache('path_' . $path, $this->disktag))) { if (!($files = getcache('path_' . $path, $this->disktag))) {
if ($path == '/' || $path == '') { if ($path == '/' || $path == '') {
$files = $this->fileList('root'); $files = $this->fileList('root');
//error_log1('root_id' . $files['id']); //error_log1('root_id' . $files['file_id']);
$files['file_id'] = 'root'; $files['file_id'] = 'root';
$files['type'] = 'folder'; $files['type'] = 'folder';
//error_log1(json_encode($files, JSON_PRETTY_PRINT));
} else { } else {
$tmp = splitlast($path, '/'); $tmp = splitlast($path, '/');
$parent_path = $tmp[0]; $parent_path = $tmp[0];
@ -121,7 +125,7 @@ class Aliyundrive {
if (!(isset($files['content'])&&$files['content']['stat']==200)) { if (!(isset($files['content'])&&$files['content']['stat']==200)) {
$header['Referer'] = 'https://www.aliyundrive.com/'; $header['Referer'] = 'https://www.aliyundrive.com/';
$header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'; $header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36';
$content1 = curl('GET', $files['download_url'], '', $header); $content1 = curl('GET', $files[$this->DownurlStrName], '', $header);
$tmp = null; $tmp = null;
$tmp = json_decode(json_encode($content1), true); $tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) { if ($tmp['body']===null) {
@ -181,7 +185,7 @@ class Aliyundrive {
} }
protected function fileList($parent_file_id) protected function fileList($parent_file_id)
{ {
$url = $this->api_url . '/file/list'; $url = $this->api_url_v3 . '/file/list';
$header["content-type"] = "application/json; charset=utf-8"; $header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token; $header['authorization'] = 'Bearer ' . $this->access_token;
@ -327,47 +331,60 @@ class Aliyundrive {
} else { } else {
$oldfile = $this->fileGet($file['id']); $oldfile = $this->fileGet($file['id']);
} }
if ($oldfile['type']=='folder') return output('Can not copy folder', 415);
$url = $this->api_url . '/file/create'; if (!function_exists('bcadd')) {
// no php-bcmath
if ($bcmathurl = getConfig('bcmathUrl', $this->disktag)) {
if (strpos($bcmathurl, '?')) {
$bcmathurl .= '&dividend=0x' . substr(md5($this->access_token), 0, 16) . '&divisor=' . $oldfile['size'];
} else {
$bcmathurl .= '?dividend=0x' . substr(md5($this->access_token), 0, 16) . '&divisor=' . $oldfile['size'];
}
$o = curl('GET', $bcmathurl)['body'];
} else {
return output('No bcmath module, can not copy', 415);
}
} else {
$r = bchexdec( substr(md5($this->access_token), 0, 16) );
$o = bcmod($r, $oldfile['size']);
}
$res = curl('GET', $oldfile[$this->DownurlStrName], '', [
'Referer' => ''
, 'Range' => 'bytes=' . $o . '-' . ($o+7)
]);
if ($res['stat']==206) {
$proof_code = base64_encode($res['body']);
$url = 'https://api.aliyundrive.com/adrive/v2/file/createWithFolders';
$header["content-type"] = "application/json; charset=utf-8"; $header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token; $header['authorization'] = 'Bearer ' . $this->access_token;
$data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse. $data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse.
$data['content_hash'] = $oldfile['content_hash']; $data['content_hash'] = $oldfile['content_hash'];
$data['content_hash_name'] = 'sha1'; $data['content_hash_name'] = 'sha1';
$data['content_type'] = $oldfile['content_type'];
$data['drive_id'] = $this->driveId; $data['drive_id'] = $this->driveId;
$data['ignoreError'] = false;
$data['name'] = $oldfile['name']; $data['name'] = $oldfile['name'];
$data['parent_file_id'] = $oldfile['parent_file_id']; $data['parent_file_id'] = $oldfile['parent_file_id'];
$data['part_info_list'][0]['part_number'] = 1; $data['part_info_list'][0]['part_number'] = 1;
$data['proof_code'] = $proof_code;
$data['proof_version'] = 'v1';
$data['size'] = $oldfile['size']; $data['size'] = $oldfile['size'];
$data['type'] = 'file'; $data['type'] = 'file';
$result = curl('POST', $url, json_encode($data), $header); $result = curl('POST', $url, json_encode($data), $header);
/*if ($result['stat']==201) {
if ($result['stat']==201) {
//error_log1('1,url:' . $url .' res:' . json_encode($result));
$res = json_decode($result['body'], true); $res = json_decode($result['body'], true);
if ($res['rapid_upload']) return output('rapid upload', 200);
$url = $res['part_info_list'][0]['upload_url']; $url = $res['part_info_list'][0]['upload_url'];
if (!$url) { // 无url应该算秒传 if (!$url) { // 无url应该算秒传
return output('no up url', 200); return output('no up url', 200);
} else { } else {
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']); return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
} }
/*$file_id = $res['file_id'];
$upload_id = $res['upload_id'];
$result = curl('PUT', $url, $content, [], 1);
if ($result['stat']==200) { // 块1传好
$etag = $result['returnhead']['ETag'];
$result = $this->fileComplete($file_id, $upload_id, [ $etag ]);
if ($result['stat']!=200) return output($result['body'], $result['stat']);
else return output('success', 0);
}*/ }*/
}
//error_log1('2,url:' . $url .' res:' . json_encode($result)); //error_log1('2,url:' . $url .' res:' . json_encode($result));
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']); return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
} else {
return output("Get proof error\n" . json_encode($res), 415);
}
} }
public function Edit($file, $content) { public function Edit($file, $content) {
$tmp = splitlast($file['path'], '/'); $tmp = splitlast($file['path'], '/');
@ -489,6 +506,31 @@ class Aliyundrive {
return curl('POST', $url, json_encode($data), $header); return curl('POST', $url, json_encode($data), $header);
} }
protected function fileCreate1($parentId, $fileName, $sha1, $proof_code, $size, $part_number) {
//$url = $this->api_url . '/file/create';
$url = 'https://api.aliyundrive.com/adrive/v2/file/createWithFolders';
$header["content-type"] = "application/json; charset=utf-8";
$header['authorization'] = 'Bearer ' . $this->access_token;
$data['check_name_mode'] = 'refuse'; // ignore, auto_rename, refuse.
$data['content_hash'] = $sha1;
$data['content_hash_name'] = 'sha1';
//$data['content_type'] = '';
$data['drive_id'] = $this->driveId;
//$data['ignoreError'] = false;
$data['name'] = $fileName;
$data['parent_file_id'] = $parentId;
for ($i=0;$i<$part_number;$i++) {
$data['part_info_list'][$i]['part_number'] = $i+1;
}
$data['proof_code'] = $proof_code;
$data['proof_version'] = 'v1';
$data['size'] = (int)$size;
$data['type'] = 'file';
return curl('POST', $url, json_encode($data), $header);
}
protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') { protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') {
$sha1 = sha1_file($tmpFilePath); $sha1 = sha1_file($tmpFilePath);
if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1]; if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1];
@ -537,6 +579,60 @@ class Aliyundrive {
$thumb_url = $res['thumbnail']; $thumb_url = $res['thumbnail'];
return $thumb_url; return $thumb_url;
} }
public function smallfileupload($path, $tmpfile) {
if (!$_SERVER['admin']) {
$tmp1 = splitlast($tmpfile['name'], '.');
if ($tmp1[0]==''||$tmp1[1]=='') $filename = sha1_file($tmpfile['tmp_name']);
else $filename = sha1_file($tmpfile['tmp_name']) . '.' . $tmp1[1];
} else {
$filename = $tmpfile['name'];
}
//$content = file_get_contents($tmpfile['tmp_name']);
$result = $this->tmpfileCreate($this->list_path($_SERVER['list_path'] . '/' . $path . '/')['file_id'], $tmpfile['tmp_name'], $filename);
//error_log1('1,url:' . $url .' res:' . json_encode($result));
if ($result['stat']==201) {
$res = json_decode($result['body'], true);
$url = $res['part_info_list'][0]['upload_url'];
if (!$url) { // 无url应该算秒传
//return output('no up url', 0);
$a = 1;
} else {
$file_id = $res['file_id'];
$upload_id = $res['upload_id'];
//$result = curl('PUT', $url, $content, [], 1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$fh_res = fopen($tmpfile['tmp_name'], 'r');
curl_setopt($ch, CURLOPT_INFILE, $fh_res);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($tmpfile['tmp_name']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$tmpres = splitlast(curl_exec($ch), "\r\n\r\n");
$result['body'] = $tmpres[1];
$returnhead = $tmpres[0];
foreach (explode("\r\n", $returnhead) as $head) {
$tmp = explode(': ', $head);
$heads[$tmp[0]] = $tmp[1];
}
$result['returnhead'] = $heads;
$result['stat'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
fclose($fh_res);
curl_close($ch);
//error_log1('2,url:' . $url .' res:' . json_encode($result));
if ($result['stat']==200) { // 块1传好
$result = $this->fileComplete($file_id, $upload_id, [ $result['returnhead']['ETag'] ]);
//error_log1('3, res:' . json_encode($result));
//if ($result['stat']!=200) return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
//else return output('success', 0);
}
}
$res = json_decode($result['body'], true);
//if (isset($res['url']))
$res[$this->DownurlStrName] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
}
return output(json_encode($this->files_format($res), JSON_UNESCAPED_SLASHES), $result['stat']);
}
public function bigfileupload($path) public function bigfileupload($path)
{ {
if (isset($_POST['uploadid'])) { if (isset($_POST['uploadid'])) {
@ -544,6 +640,20 @@ class Aliyundrive {
$result = $this->fileComplete($_POST['fileid'], $_POST['uploadid'], json_decode($_POST['etag'], true)); $result = $this->fileComplete($_POST['fileid'], $_POST['uploadid'], json_decode($_POST['etag'], true));
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']); return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
} else { } else {
if (isset($_POST['CalcProof'])) {
return output(substr(md5($this->access_token), 0, 16), 200);
// Calc proof code
/*if (!function_exists('bcadd')) {
// no php-bcmath
return output(0, 200);
} else {
$r = bchexdec( substr(md5($this->access_token), 0, 16) );
$i = $_POST['filesize'];
//$o = $i ? bcmod($r, $i) : 0;
$o = bcmod($r, $i);
return output($o, 200);
}*/
}
if ($_POST['upbigfilename']=='') return output('error: no file name', 400); if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400); if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400); if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400);
@ -573,7 +683,11 @@ class Aliyundrive {
//error_log1($res['body']); //error_log1($res['body']);
$parent_file_id = json_decode($res['body'], true)['file_id']; $parent_file_id = json_decode($res['body'], true)['file_id'];
} }
$response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize'])); //if (!function_exists('bcadd')) {
// $response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
//} else {
$response = $this->fileCreate1($parent_file_id, $filename, $_POST['filesha1'], $_POST['proof_code'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
//}
$res = json_decode($response['body'], true); $res = json_decode($response['body'], true);
if (isset($res['exist'])) { if (isset($res['exist'])) {
// 已经有 // 已经有
@ -799,7 +913,7 @@ class Aliyundrive {
alert("Do not input ' . $envs . '"); alert("Do not input ' . $envs . '");
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;

1256
disk/BaiduDisk.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -718,7 +718,7 @@ class Googledrive {
alert("Do not input ' . $envs . '"); alert("Do not input ' . $envs . '");
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;

View File

@ -56,10 +56,28 @@ class Onedrive {
if ($parentfiles = getcache('path_' . $parentpath, $this->disktag)) { if ($parentfiles = getcache('path_' . $parentpath, $this->disktag)) {
if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) { if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) {
if (in_array(splitlast($filename,'.')[1], $exts['txt'])) { if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
//$content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
//$parentfiles['children'][$filename]['content'] = $content1;
//savecache('path_' . $parentpath, $parentfiles, $this->disktag);
if ($parentfiles['children'][$filename]['size']<1024*1024) {
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) { if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
$content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]); $content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
$tmp = null;
$tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) {
$txtcode = chkTxtCode($content1['body']);
if ($txtcode!==false) $tmp['body'] = iconv($txtcode, 'UTF-8//TRANSLIT', $content1['body']);
$tmp = json_decode(json_encode($tmp), true);
if ($tmp['body']) $content1['body'] = $tmp['body'];
}
$parentfiles['children'][$filename]['content'] = $content1; $parentfiles['children'][$filename]['content'] = $content1;
savecache('path_' . $parentpath, $parentfiles, $this->disktag); savecache('path_' . $path, $parentfiles['children'][$filename], $this->disktag);
}
} else {
$parentfiles['children'][$filename]['content']['stat'] = 202;
$parentfiles['children'][$filename]['content']['body'] = 'File too large.';
}
} }
} }
return $this->files_format($parentfiles['children'][$filename]); return $this->files_format($parentfiles['children'][$filename]);
@ -107,9 +125,10 @@ class Onedrive {
$tmp = null; $tmp = null;
$tmp = json_decode(json_encode($content1), true); $tmp = json_decode(json_encode($content1), true);
if ($tmp['body']===null) { if ($tmp['body']===null) {
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']); $txtcode = chkTxtCode($content1['body']);
if ($txtcode!==false) $tmp['body'] = iconv($txtcode, 'UTF-8//TRANSLIT', $content1['body']);
$tmp = json_decode(json_encode($tmp), true); $tmp = json_decode(json_encode($tmp), true);
if ($tmp['body']!==null) $content1['body'] = $tmp['body']; if ($tmp['body']) $content1['body'] = $tmp['body'];
} }
$files['content'] = $content1; $files['content'] = $content1;
savecache('path_' . $path, $files, $this->disktag); savecache('path_' . $path, $files, $this->disktag);
@ -446,7 +465,7 @@ class Onedrive {
$envs = ''; $envs = '';
foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', '; foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
$url = path_format($_SERVER['PHP_SELF'] . '/'); $url = $_SERVER['PHP_SELF'];
//$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0'; //$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0';
if (isset($_GET['Finish'])) { if (isset($_GET['Finish'])) {
@ -478,8 +497,8 @@ class Onedrive {
} else { } else {
return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']); return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']);
}*/ }*/
if (get_class($this)=='Sharepoint') $tmp['Driver'] = 'Onedrive'; if ($tmp['Driver']=='Sharepoint') $tmp['Driver'] = 'Onedrive';
elseif (get_class($this)=='SharepointCN') $tmp['Driver'] = 'OnedriveCN'; elseif ($tmp['Driver']=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
$tmp['sharepointSite'] = ''; $tmp['sharepointSite'] = '';
$tmp['siteid'] = ''; $tmp['siteid'] = '';
} elseif ($_POST['DriveType']=='Custom') { } elseif ($_POST['DriveType']=='Custom') {
@ -492,14 +511,14 @@ class Onedrive {
//if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']); //if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']);
$tmp['siteid'] = $siteid; $tmp['siteid'] = $siteid;
$tmp['sharepointSite'] = $_POST['sharepointSite']; $tmp['sharepointSite'] = $_POST['sharepointSite'];
if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint'; if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
} else { } else {
// 直接是siteid // 直接是siteid
$tmp['siteid'] = $_POST['DriveType']; $tmp['siteid'] = $_POST['DriveType'];
$tmp['sharepointSite'] = $_POST['sharepointSiteUrl']; $tmp['sharepointSite'] = $_POST['sharepointSiteUrl'];
if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint'; if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN'; elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
} }
$response = setConfigResponse( setConfig($tmp, $this->disktag) ); $response = setConfigResponse( setConfig($tmp, $this->disktag) );
@ -520,11 +539,11 @@ class Onedrive {
console.log(i++); console.log(i++);
} else { } else {
clearInterval(uploadList); clearInterval(uploadList);
location.href = "' . $url . '"; location.href = "' . $url . '?setup&disktag=' . $_GET['disktag'] . '";
} }
}, 1000); }, 1000);
</script>'; </script>';
return message($html, getconstStr('WaitJumpIndex'), 201, 1); return message($html, getconstStr('Wait'), 201, 1);
} }
} }
@ -554,12 +573,13 @@ class Onedrive {
$title = 'Select Driver'; $title = 'Select Driver';
$html = ' $html = '
<div> <div>
<form action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);"> <form name="form1" action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
<label><input type="radio" name="DriveType" value="Onedrive" checked>' . 'Use Onedrive ' . getconstStr(' ') . '</label><br>'; <label><input type="radio" name="DriveType" value="Onedrive">' . 'Use Onedrive ' . getconstStr(' ') . '</label><br>';
if ($sites[0]!='') foreach ($sites as $k => $v) { if ($sites[0]!='') foreach ($sites as $k => $v) {
$html .= ' $html .= '
<label> <label>
<input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Sharepoint: <br><div style="width:100%;margin:0px 35px">webUrl: ' . $v['webUrl'] . '<br>siteid: ' . $v['id'] . '</div> <input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Sharepoint: <br><div style="width:100%;margin:0px 35px">webUrl: ' . $v['webUrl'] . '<br>siteid: ' . $v['id'] . '</div>
<input type="hidden" id="' . $v['id'] . '" name="' . $v['id'] . '" value="' . $v['webUrl'] . '">
</label>'; </label>';
} }
$html .= ' $html .= '
@ -576,6 +596,26 @@ class Onedrive {
</form> </form>
</div> </div>
<script> <script>
var driver = "' . $_GET['AddDisk'] . '";
if (driver=="Onedrive"||driver=="OnedriveCN") {
document.form1.DriveType[0].checked = true;
} else {
var siteid = "' . getConfig('siteid', $this->disktag) . '";
if (siteid==="") {
document.form1.DriveType[document.form1.DriveType.length-1].checked = true;
} else {
for (i=0; i<document.form1.DriveType.length; i++) {
if (document.form1.DriveType[i].value==siteid) {
document.form1.DriveType[i].checked = true;
document.getElementById(\'sharepointSiteUrl\').value = document.getElementById(siteid).value;
}
}
if (document.getElementById(\'sharepointSiteUrl\').value=="") {
document.form1.DriveType[document.form1.DriveType.length-1].checked = true;
document.getElementById(\'sharepointSite\').value = "' . getConfig('sharepointSite', $this->disktag) . '";
}
}
}
function notnull(t) function notnull(t)
{ {
if (t.DriveType.value==\'\') { if (t.DriveType.value==\'\') {
@ -590,8 +630,8 @@ class Onedrive {
} }
return true; return true;
} }
</script> </script>
'; ';
return message($html, $title, 201); return message($html, $title, 201);
} }
@ -611,7 +651,7 @@ class Onedrive {
texta[i].style.height = texta[i].scrollHeight + \'px\'; texta[i].style.height = texta[i].scrollHeight + \'px\';
} }
</script>'; </script>';
$tmptoken['Driver'] = get_class($this); $tmptoken['Driver'] = $_GET['AddDisk'];
$tmptoken['refresh_token'] = $refresh_token; $tmptoken['refresh_token'] = $refresh_token;
$tmptoken['token_expires'] = time()+7*24*60*60; $tmptoken['token_expires'] = time()+7*24*60*60;
$response = setConfigResponse( setConfig($tmptoken, $this->disktag) ); $response = setConfigResponse( setConfig($tmptoken, $this->disktag) );
@ -629,7 +669,7 @@ class Onedrive {
console.log(i++); console.log(i++);
} else { } else {
clearInterval(uploadList); clearInterval(uploadList);
location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive"; location.href = "' . $url . '?AddDisk=' . $_GET['AddDisk'] . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
} }
}, 1000); }, 1000);
</script>'; </script>';
@ -641,7 +681,7 @@ class Onedrive {
} }
if (isset($_GET['install1'])) { if (isset($_GET['install1'])) {
if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') { //if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') {
return message(' return message('
<a href="" id="a1">' . getconstStr('JumptoOffice') . '</a> <a href="" id="a1">' . getconstStr('JumptoOffice') . '</a>
<script> <script>
@ -652,9 +692,9 @@ class Onedrive {
location.href = url; location.href = url;
</script> </script>
', getconstStr('Wait') . ' 1s', 201); ', getconstStr('Wait') . ' 1s', 201);
} else { //} else {
return message('Something error, retry after a few seconds.', 'Retry', 201); // return message('Something error, retry after a few seconds.', 'Retry', 201);
} //}
} }
if (isset($_GET['install0'])) { if (isset($_GET['install0'])) {
@ -681,7 +721,8 @@ class Onedrive {
//$this->disktag = $_POST['disktag_add']; //$this->disktag = $_POST['disktag_add'];
$tmp['disktag_add'] = $_POST['disktag_add']; $tmp['disktag_add'] = $_POST['disktag_add'];
$tmp['diskname'] = $_POST['diskname']; $tmp['diskname'] = $_POST['diskname'];
$tmp['Driver'] = $_POST['Drive_ver']; //$tmp['Driver'] = $_POST['Drive_ver'];
$tmp['Driver'] = $_GET['AddDisk'];
if ($_POST['Drive_ver']=='Sharelink') { if ($_POST['Drive_ver']=='Sharelink') {
$tmp['shareurl'] = $_POST['shareurl']; $tmp['shareurl'] = $_POST['shareurl'];
} else { } else {
@ -701,7 +742,7 @@ class Onedrive {
} else { } else {
$title = getconstStr('MayinEnv'); $title = getconstStr('MayinEnv');
$html = getconstStr('Wait'); $html = getconstStr('Wait');
if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver']; if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_GET['AddDisk'];
$html .= '<script> $html .= '<script>
var i = 0; var i = 0;
var status = "' . $response['DplStatus'] . '"; var status = "' . $response['DplStatus'] . '";
@ -722,7 +763,7 @@ class Onedrive {
$html = ' $html = '
<div> <div>
<form id="form1" action="" method="post" onsubmit="return notnull(this);"> <form id="form1" name="form1" action="" method="post" onsubmit="return notnull(this);">
' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ') ' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ')
<input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br> <input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br>
' . getconstStr('DiskName') . ': ' . getconstStr('DiskName') . ':
@ -762,6 +803,21 @@ class Onedrive {
</form> </form>
</div> </div>
<script> <script>
var driver = "' . get_class($this) . '";
if (driver=="Onedrive" || driver=="Sharepoint") {
document.form1.Drive_ver[0].checked = true;
document.getElementById(\'NT_custom\').style.display=\'\';
//document.getElementById(\'CN_custom\').style.display=\'\';
//document.getElementById(\'inputshareurl\').style.display=\'none\';
}
if (driver=="OnedriveCN" || driver=="SharepointCN") {
document.form1.Drive_ver[1].checked = true;
document.getElementById(\'CN_custom\').style.display=\'\';
}
if (driver=="Sharelink") {
document.form1.Drive_ver[2].checked = true;
document.getElementById(\'inputshareurl\').style.display=\'\';
}
function notnull(t) function notnull(t)
{ {
if (t.disktag_add.value==\'\') { if (t.disktag_add.value==\'\') {
@ -770,10 +826,10 @@ class Onedrive {
} }
envs = [' . $envs . ']; envs = [' . $envs . '];
if (envs.indexOf(t.disktag_add.value)>-1) { if (envs.indexOf(t.disktag_add.value)>-1) {
alert("Do not input ' . $envs . '"); alert("Do not input \"" + t.disktag_add.value + "\" in ' . getconstStr('DiskTag') . '");
return false; return false;
} }
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/; var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
if (!reg.test(t.disktag_add.value)) { if (!reg.test(t.disktag_add.value)) {
alert(\'' . getconstStr('TagFormatAlert') . '\'); alert(\'' . getconstStr('TagFormatAlert') . '\');
return false; return false;
@ -787,25 +843,28 @@ class Onedrive {
alert(\'shareurl\'); alert(\'shareurl\');
return false; return false;
} }
driver = \'Sharelink\';
} else { } else {
if ((t.Drive_ver.value==\'Onedrive\') && t.NT_Drive_custom.checked==true) { if (t.Drive_ver.value==\'Onedrive\') {
if (t.NT_Drive_custom.checked==true) {
if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') { if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') {
alert(\'client_id & client_secret\'); alert(\'client_id & client_secret\');
return false; return false;
} }
} }
if ((t.Drive_ver.value==\'OnedriveCN\') && t.CN_Drive_custom.checked==true) { if (driver!="Onedrive" && driver!="Sharepoint") driver = "Onedrive";
}
if (t.Drive_ver.value==\'OnedriveCN\') {
if (t.CN_Drive_custom.checked==true) {
if (t.CN_client_secret.value==\'\'||t.CN_client_id.value==\'\') { if (t.CN_client_secret.value==\'\'||t.CN_client_id.value==\'\') {
alert(\'client_id & client_secret\'); alert(\'client_id & client_secret\');
return false; return false;
} }
} }
if (driver!="OnedriveCN" && driver!="SharepointCN") driver = "OnedriveCN";
} }
document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=" + t.Drive_ver.value; }
//var expd = new Date(); document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=" + driver;
//expd.setTime(expd.getTime()+(2*60*60*1000));
//var expires = "expires="+expd.toGMTString();
//document.cookie=\'disktag=\'+t.disktag_add.value+\'; path=/; \'+expires;
return true; return true;
} }
</script>'; </script>';
@ -914,6 +973,20 @@ class Onedrive {
return $thumb_url; return $thumb_url;
} }
public function smallfileupload($path, $tmpfile) {
if (!$_SERVER['admin']) {
$tmp1 = splitlast($tmpfile['name'], '.');
if ($tmp1[0]==''||$tmp1[1]=='') $filename = md5_file($tmpfile['tmp_name']);
else $filename = md5_file($tmpfile['tmp_name']) . '.' . $tmp1[1];
} else {
$filename = $tmpfile['name'];
}
$content = file_get_contents($tmpfile['tmp_name']);
$result = $this->MSAPI('PUT', path_format($_SERVER['list_path'] . '/' . $path . '/' . $filename), $content);
$res = $this->files_format(json_decode($result['body'], true));
if (isset($res['url'])) $res['url'] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
return output(json_encode($res, JSON_UNESCAPED_SLASHES), $result['stat']);
}
public function bigfileupload($path) public function bigfileupload($path)
{ {
if ($_POST['upbigfilename']=='') return output('error: no file name', 400); if ($_POST['upbigfilename']=='') return output('error: no file name', 400);

View File

@ -1,24 +1,54 @@
<?php <?php
//error_reporting(E_ALL & ~E_NOTICE); //error_reporting(E_ALL & ~E_NOTICE);
error_reporting(0); error_reporting(0);
include 'vendor/autoload.php'; include 'vendor/autoload.php';
include 'conststr.php'; include 'conststr.php';
include 'common.php'; include 'common.php';
date_default_timezone_set('UTC');
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
//echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>';
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { global $platform;
$platform = checkPlatform();
function checkPlatform() {
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud')
return 'SCF';
if (isset($_SERVER['FC_FUNC_CODE_PATH']))
return 'FC';
if (isset($_SERVER['RUNTIME_LOG_PATH']) && $_SERVER['RUNTIME_LOG_PATH']=='/home/snuser/log')
return 'FG';
if (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7')
return 'CFC';
if (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app')
return 'Heroku';
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user')
return 'Vercel';
if (isset($_SERVER['DOCUMENT_ROOT'])&&substr($_SERVER['DOCUMENT_ROOT'], 0, 13)==='/home/runner/')
return 'Replit';
return 'Normal';
}
function writebackPlatform($p) {
if ('SCF'==$p) $_SERVER['USER']='qcloud';
if ('FC'==$p) $_SERVER['FC_FUNC_CODE_PATH']=getenv('FC_FUNC_CODE_PATH');
if ('FG'==$p) $_SERVER['RUNTIME_LOG_PATH']='/home/snuser/log';
if ('CFC'==$p) $_SERVER['BCE_CFC_RUNTIME_NAME']='php7';
//if ('Heroku'==$p) $_SERVER['HEROKU_APP_DIR']='/app';
if ('Vercel'==$p) $_SERVER['DOCUMENT_ROOT']='/var/task/user';
//if ('Replit'==$p) $_SERVER['DOCUMENT_ROOT']='/home/runner/';
}
if ('SCF'==$platform) {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php'; if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php';
else include 'platform/TencentSCF_env.php'; else include 'platform/TencentSCF_env.php';
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { } elseif ('FC'==$platform) {
include 'platform/AliyunFC.php'; include 'platform/AliyunFC.php';
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') { } elseif ('FG'==$platform) {
//if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php'; //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php';
//else include 'platform/HuaweiFG_env.php'; //else include 'platform/HuaweiFG_env.php';
echo 'FG' . PHP_EOL; echo 'FG' . PHP_EOL;
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { } elseif ('CFC'==$platform) {
include 'platform/BaiduCFC.php'; include 'platform/BaiduCFC.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { } elseif ('Heroku'==$platform) {
include 'platform/Heroku.php'; include 'platform/Heroku.php';
$path = getpath(); $path = getpath();
//echo 'path:'. $path; //echo 'path:'. $path;
@ -32,9 +62,11 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
http_response_code($re['statusCode']); http_response_code($re['statusCode']);
if ($re['isBase64Encoded']) echo base64_decode($re['body']); if ($re['isBase64Encoded']) echo base64_decode($re['body']);
else echo $re['body']; else echo $re['body'];
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') { } elseif ('Vercel'==$platform) {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php'; if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php';
else include 'platform/Vercel.php'; else include 'platform/Vercel.php';
writebackPlatform('Vercel');
$path = getpath(); $path = getpath();
//echo 'path:'. $path; //echo 'path:'. $path;
$_GET = getGET(); $_GET = getGET();
@ -47,7 +79,7 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
http_response_code($re['statusCode']); http_response_code($re['statusCode']);
if ($re['isBase64Encoded']) echo base64_decode($re['body']); if ($re['isBase64Encoded']) echo base64_decode($re['body']);
else echo $re['body']; else echo $re['body'];
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&substr($_SERVER['DOCUMENT_ROOT'], 0, 13)==='/home/runner/') { } elseif ('Replit'==$platform) {
include 'platform/Replit.php'; include 'platform/Replit.php';
$path = getpath(); $path = getpath();
@ -66,7 +98,9 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
} else { } else {
include 'platform/Normal.php'; include 'platform/Normal.php';
if (!function_exists('curl_init')) { if (!function_exists('curl_init')) {
return message('<font color="red">Need curl</font>, please install php-curl.', 'Error', 500); http_response_code(500);
echo '<font color="red">Need curl</font>, please install php-curl.';
exit(1);
} }
$path = getpath(); $path = getpath();
//echo 'path:'. $path; //echo 'path:'. $path;
@ -88,10 +122,14 @@ function main_handler($event, $context)
$event = json_decode(json_encode($event), true); $event = json_decode(json_encode($event), true);
$context = json_decode(json_encode($context), true); $context = json_decode(json_encode($context), true);
printInput($event, $context); printInput($event, $context);
if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) {
if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']);
}
unset($_POST); unset($_POST);
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('SCF');
GetGlobalVariable($event); GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);
@ -102,7 +140,8 @@ function main_handler($event, $context)
// Aliyun FC & Huawei FG & Baidu CFC // Aliyun FC & Huawei FG & Baidu CFC
function handler($event, $context) function handler($event, $context)
{ {
if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { global $platform;
if ('FC'==$platform) {
// Aliyun FC // Aliyun FC
set_error_handler("myErrorHandler"); set_error_handler("myErrorHandler");
$tmp = array( $tmp = array(
@ -121,14 +160,15 @@ function handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('FC');
GetGlobalVariable($event); GetGlobalVariable($event);
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);
$re = main($path); $re = main($path);
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['isBase64Encoded']?base64_decode($re['body']):$re['body']); return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], ($re['isBase64Encoded']?base64_decode($re['body']):$re['body']));
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') { } elseif ('FG'==$platform) {
// Huawei FG // Huawei FG
global $contextUserData; global $contextUserData;
$contextUserData = $context; $contextUserData = $context;
@ -143,13 +183,14 @@ function handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('FG');
GetGlobalVariable($event); GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);
return main($path); return main($path);
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { } elseif ('CFC'==$platform) {
// Baidu CFC // Baidu CFC
//$html = '<pre>'. json_encode($event, JSON_PRETTY_PRINT).'</pre>'; //$html = '<pre>'. json_encode($event, JSON_PRETTY_PRINT).'</pre>';
//$html .= '<pre>'. json_encode($context, JSON_PRETTY_PRINT).'</pre>'; //$html .= '<pre>'. json_encode($context, JSON_PRETTY_PRINT).'</pre>';
@ -163,6 +204,7 @@ function handler($event, $context)
unset($_GET); unset($_GET);
unset($_COOKIE); unset($_COOKIE);
unset($_SERVER); unset($_SERVER);
writebackPlatform('CFC');
GetGlobalVariable($event); GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context); $path = GetPathSetting($event, $context);

1690
js/marked.js Executable file

File diff suppressed because it is too large Load Diff

8
js/sha1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/spark-md5.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -67,7 +67,7 @@ function GetPathSetting($event, $context)
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0]; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0];
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2'; $_SERVER['REQUEST_METHOD'] = $event['method'];
return $path; return $path;
//return spurlencode($path, '/'); //return spurlencode($path, '/');
} }
@ -545,3 +545,7 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
return output('Can not upload through FC.', 400);
}

View File

@ -51,6 +51,7 @@ function GetPathSetting($event, $context)
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'];
$_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7'; $_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
return $path; return $path;
} }
@ -484,3 +485,7 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
return output('Can not upload through CFC.', 400);
}

View File

@ -415,3 +415,9 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -6,7 +6,7 @@ global $contextUserData;
function printInput($event, $context) function printInput($event, $context)
{ {
$tmp['eventID'] = $context->geteventID(); $tmp['RequestID'] = $context->getRequestID();
$tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds(); $tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds();
$tmp['AccessKey'] = $context->getAccessKey(); $tmp['AccessKey'] = $context->getAccessKey();
$tmp['SecretKey'] = $context->getSecretKey(); $tmp['SecretKey'] = $context->getSecretKey();
@ -17,7 +17,7 @@ function printInput($event, $context)
$tmp['MemorySize'] = $context->getMemorySize(); $tmp['MemorySize'] = $context->getMemorySize();
$tmp['CPUNumber'] = $context->getCPUNumber(); $tmp['CPUNumber'] = $context->getCPUNumber();
$tmp['ProjectID'] = $context->getProjectID(); $tmp['ProjectID'] = $context->getProjectID();
$tmp['Package'] = $context->Package(); $tmp['Package'] = $context->getPackage();
$tmp['Token'] = $context->getToken(); $tmp['Token'] = $context->getToken();
$tmp['Logger'] = $context->getLogger(); $tmp['Logger'] = $context->getLogger();
@ -51,13 +51,13 @@ function GetPathSetting($event, $context)
$_SERVER['ProjectID'] = $context->getProjectID(); $_SERVER['ProjectID'] = $context->getProjectID();
$host_name = $event['headers']['host']; $host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name; $_SERVER['HTTP_HOST'] = $host_name;
$path = path_format($event['pathParameters'][''].'/'); $path = path_format('/' . $event['pathParameters']['']);
$path = str_replace('+', '%2B', $path); $path = str_replace('+', '%2B', $path);
$_SERVER['base_path'] = path_format($event['path'].'/'); $_SERVER['base_path'] = path_format($event['path']);
if ( $_SERVER['base_path'] == $path ) { if ( $_SERVER['base_path'] == $path ) {
$_SERVER['base_path'] = '/'; $_SERVER['base_path'] = '/';
} else { } else {
$_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, strlen($_SERVER['base_path'])-strlen($path));
if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
} }
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
@ -74,7 +74,7 @@ function GetPathSetting($event, $context)
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
return $path; return $path;
} }
@ -535,3 +535,7 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
return output('Can not upload through FG.', 400);
}

View File

@ -6,7 +6,7 @@ global $contextUserData;
function printInput($event, $context) function printInput($event, $context)
{ {
$tmp['eventID'] = $context->geteventID(); $tmp['RequestID'] = $context->getRequestID();
$tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds(); $tmp['RemainingTimeInMilliSeconds'] = $context->getRemainingTimeInMilliSeconds();
$tmp['AccessKey'] = $context->getAccessKey(); $tmp['AccessKey'] = $context->getAccessKey();
$tmp['SecretKey'] = $context->getSecretKey(); $tmp['SecretKey'] = $context->getSecretKey();
@ -17,7 +17,7 @@ function printInput($event, $context)
$tmp['MemorySize'] = $context->getMemorySize(); $tmp['MemorySize'] = $context->getMemorySize();
$tmp['CPUNumber'] = $context->getCPUNumber(); $tmp['CPUNumber'] = $context->getCPUNumber();
$tmp['ProjectID'] = $context->getProjectID(); $tmp['ProjectID'] = $context->getProjectID();
$tmp['Package'] = $context->Package(); $tmp['Package'] = $context->getPackage();
$tmp['Token'] = $context->getToken(); $tmp['Token'] = $context->getToken();
$tmp['Logger'] = $context->getLogger(); $tmp['Logger'] = $context->getLogger();
@ -51,13 +51,13 @@ function GetPathSetting($event, $context)
$_SERVER['ProjectID'] = $context->getProjectID(); $_SERVER['ProjectID'] = $context->getProjectID();
$host_name = $event['headers']['host']; $host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name; $_SERVER['HTTP_HOST'] = $host_name;
$path = path_format($event['pathParameters'][''].'/'); $path = path_format('/' . $event['pathParameters']['']);
$path = str_replace('+', '%2B', $path); $path = str_replace('+', '%2B', $path);
$_SERVER['base_path'] = path_format($event['path'].'/'); $_SERVER['base_path'] = path_format($event['path']);
if ( $_SERVER['base_path'] == $path ) { if ( $_SERVER['base_path'] == $path ) {
$_SERVER['base_path'] = '/'; $_SERVER['base_path'] = '/';
} else { } else {
$_SERVER['base_path'] = substr($_SERVER['base_path'], 0, -strlen($path)); $_SERVER['base_path'] = substr($_SERVER['base_path'], 0, strlen($_SERVER['base_path'])-strlen($path));
if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/'; if ($_SERVER['base_path']=='') $_SERVER['base_path'] = '/';
} }
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); //$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
@ -74,7 +74,7 @@ function GetPathSetting($event, $context)
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter'; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
return $path; return $path;
} }
@ -901,3 +901,7 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
return output('Can not upload through FG.', 400);
}

View File

@ -4,13 +4,14 @@ function getpath()
{ {
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]); $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP']; if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP']; // Glitch
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') { if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') { if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0]; $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp; if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
} }
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO']; if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
$_SERVER['REQUEST_SCHEME'] = 'http';
} }
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2]; $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
@ -22,8 +23,6 @@ function getpath()
else $path = $_SERVER['REQUEST_URI']; else $path = $_SERVER['REQUEST_URI'];
$path = path_format( substr($path, strlen($_SERVER['base_path'])) ); $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
return $path; return $path;
//return substr($path, 1);
//return spurlencode($path, '/');
} }
function getGET() function getGET()
@ -392,3 +391,9 @@ function WaitFunction() {
function changeAuthKey() { function changeAuthKey() {
return message("Not need.", 'Change platform Auth token or key', 404); return message("Not need.", 'Change platform Auth token or key', 404);
} }
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -355,3 +355,9 @@ function WaitFunction() {
function changeAuthKey() { function changeAuthKey() {
return message("Not need.", 'Change platform Auth token or key', 404); return message("Not need.", 'Change platform Auth token or key', 404);
} }
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -59,7 +59,7 @@ function GetPathSetting($event, $context)
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['USER'] = 'qcloud'; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
return $path; return $path;
} }
@ -661,3 +661,7 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
return output('Can not upload through SCF.', 400);
}

View File

@ -59,7 +59,7 @@ function GetPathSetting($event, $context)
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2]; $_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f' $_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since']; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
$_SERVER['USER'] = 'qcloud'; $_SERVER['REQUEST_METHOD'] = $event['httpMethod'];
return $path; return $path;
} }
@ -704,3 +704,7 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
return output('Can not upload through SCF.', 400);
}

View File

@ -1,32 +1,29 @@
<?php <?php
// https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment // https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment
function getpath() function getpath() {
{ $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';')[0], ',')[0]);
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP']; if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') { if ($_SERVER['REQUEST_SCHEME'] != 'http' && $_SERVER['REQUEST_SCHEME'] != 'https') {
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') { if ($_SERVER['HTTP_X_FORWARDED_PROTO'] != '') {
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0]; $tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp; if ($tmp == 'http' || $tmp == 'https') $_SERVER['REQUEST_SCHEME'] = $tmp;
} }
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO']; if ($_SERVER['HTTP_FLY_FORWARDED_PROTO'] != '') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
} }
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; $_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2]; $_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
$_SERVER['base_path'] = "/"; $_SERVER['base_path'] = "/";
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL']; if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
$p = strpos($_SERVER['REQUEST_URI'],'?'); $p = strpos($_SERVER['REQUEST_URI'], '?');
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p); if ($p > 0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
else $path = $_SERVER['REQUEST_URI']; else $path = $_SERVER['REQUEST_URI'];
$path = path_format( substr($path, strlen($_SERVER['base_path'])) ); $path = path_format(substr($path, strlen($_SERVER['base_path'])));
$_SERVER['DOCUMENT_ROOT'] = '/var/task/user';
return $path; return $path;
} }
function getGET() function getGET() {
{
if (!$_POST) { if (!$_POST) {
if (!!$HTTP_RAW_POST_DATA) { if (!!$HTTP_RAW_POST_DATA) {
$tmpdata = $HTTP_RAW_POST_DATA; $tmpdata = $HTTP_RAW_POST_DATA;
@ -36,16 +33,16 @@ function getGET()
if (!!$tmpdata) { if (!!$tmpdata) {
$postbody = explode("&", $tmpdata); $postbody = explode("&", $tmpdata);
foreach ($postbody as $postvalues) { foreach ($postbody as $postvalues) {
$pos = strpos($postvalues,"="); $pos = strpos($postvalues, "=");
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1)); $_POST[urldecode(substr($postvalues, 0, $pos))] = urldecode(substr($postvalues, $pos + 1));
} }
} }
} }
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL']; if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
$p = strpos($_SERVER['REQUEST_URI'],'?'); $p = strpos($_SERVER['REQUEST_URI'], '?');
if ($p>0) { if ($p > 0) {
$getstr = substr($_SERVER['REQUEST_URI'], $p+1); $getstr = substr($_SERVER['REQUEST_URI'], $p + 1);
$getstrarr = explode("&",$getstr); $getstrarr = explode("&", $getstr);
foreach ($getstrarr as $getvalues) { foreach ($getstrarr as $getvalues) {
if ($getvalues != '') { if ($getvalues != '') {
$pos = strpos($getvalues, "="); $pos = strpos($getvalues, "=");
@ -65,16 +62,15 @@ function getGET()
} }
} }
function getConfig($str, $disktag = '') function getConfig($str, $disktag = '') {
{
$projectPath = splitlast(__DIR__, '/')[0]; $projectPath = splitlast(__DIR__, '/')[0];
$configPath = $projectPath . '/.data/config.php'; $configPath = $projectPath . '/.data/config.php';
$s = file_get_contents($configPath); $s = file_get_contents($configPath);
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}'; $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
if ($configs!='') { if ($configs != '') {
$envs = json_decode($configs, true); $envs = json_decode($configs, true);
if (isInnerEnv($str)) { if (isInnerEnv($str)) {
if ($disktag=='') $disktag = $_SERVER['disktag']; if ($disktag == '') $disktag = $_SERVER['disktag'];
if (isset($envs[$disktag][$str])) { if (isset($envs[$disktag][$str])) {
if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]); if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
else return $envs[$disktag][$str]; else return $envs[$disktag][$str];
@ -89,15 +85,14 @@ function getConfig($str, $disktag = '')
return ''; return '';
} }
function setConfig($arr, $disktag = '') function setConfig($arr, $disktag = '') {
{ if ($disktag == '') $disktag = $_SERVER['disktag'];
if ($disktag=='') $disktag = $_SERVER['disktag'];
$projectPath = splitlast(__DIR__, '/')[0]; $projectPath = splitlast(__DIR__, '/')[0];
$configPath = $projectPath . '/.data/config.php'; $configPath = $projectPath . '/.data/config.php';
$s = file_get_contents($configPath); $s = file_get_contents($configPath);
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}'; $configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
if ($configs!='') $envs = json_decode($configs, true); if ($configs != '') $envs = json_decode($configs, true);
$disktags = explode("|",getConfig('disktag')); $disktags = explode("|", getConfig('disktag'));
$indisk = 0; $indisk = 0;
$operatedisk = 0; $operatedisk = 0;
foreach ($arr as $k => $v) { foreach ($arr as $k => $v) {
@ -108,20 +103,20 @@ function setConfig($arr, $disktag = '')
if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v); if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
else $envs[$disktag][$k] = $v; else $envs[$disktag][$k] = $v;
$indisk = 1; $indisk = 1;
} elseif ($k=='disktag_add') { } elseif ($k == 'disktag_add') {
array_push($disktags, $v); array_push($disktags, $v);
$operatedisk = 1; $operatedisk = 1;
} elseif ($k=='disktag_del') { } elseif ($k == 'disktag_del') {
$disktags = array_diff($disktags, [ $v ]); $disktags = array_diff($disktags, [$v]);
$envs[$v] = ''; $envs[$v] = '';
$operatedisk = 1; $operatedisk = 1;
} elseif ($k=='disktag_copy') { } elseif ($k == 'disktag_copy') {
$newtag = $v . '_' . date("Ymd_His"); $newtag = $v . '_' . date("Ymd_His");
$envs[$newtag] = $envs[$v]; $envs[$newtag] = $envs[$v];
array_push($disktags, $newtag); array_push($disktags, $newtag);
$operatedisk = 1; $operatedisk = 1;
} elseif ($k=='disktag_rename' || $k=='disktag_newname') { } elseif ($k == 'disktag_rename' || $k == 'disktag_newname') {
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1; if ($arr['disktag_rename'] != $arr['disktag_newname']) $operatedisk = 1;
} else { } else {
$envs[$k] = $v; $envs[$k] = $v;
} }
@ -133,10 +128,10 @@ function setConfig($arr, $disktag = '')
$envs[$disktag] = $diskconfig; $envs[$disktag] = $diskconfig;
} }
if ($operatedisk) { if ($operatedisk) {
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { if (isset($arr['disktag_newname']) && $arr['disktag_newname'] != '') {
$tags = []; $tags = [];
foreach ($disktags as $tag) { foreach ($disktags as $tag) {
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); if ($tag == $arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
else array_push($tags, $tag); else array_push($tags, $tag);
} }
$envs['disktag'] = implode('|', $tags); $envs['disktag'] = implode('|', $tags);
@ -144,8 +139,9 @@ function setConfig($arr, $disktag = '')
$envs[$arr['disktag_rename']] = ''; $envs[$arr['disktag_rename']] = '';
} else { } else {
$disktags = array_unique($disktags); $disktags = array_unique($disktags);
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|'; $disktag_s = "";
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1); foreach ($disktags as $disktag) if ($disktag != '') $disktag_s .= $disktag . '|';
if ($disktag_s != '') $envs['disktag'] = substr($disktag_s, 0, -1);
else $envs['disktag'] = ''; else $envs['disktag'] = '';
} }
} }
@ -157,11 +153,10 @@ function setConfig($arr, $disktag = '')
return setVercelConfig($envs, getConfig('HerokuappId'), getConfig('APIKey')); return setVercelConfig($envs, getConfig('HerokuappId'), getConfig('APIKey'));
} }
function install() function install() {
{
global $constStr; global $constStr;
if ($_GET['install1']) { if ($_GET['install1']) {
if ($_POST['admin']!='') { if ($_POST['admin'] != '') {
$tmp['admin'] = $_POST['admin']; $tmp['admin'] = $_POST['admin'];
//$tmp['language'] = $_POST['language']; //$tmp['language'] = $_POST['language'];
$tmp['timezone'] = $_COOKIE['timezone']; $tmp['timezone'] = $_COOKIE['timezone'];
@ -176,8 +171,14 @@ function install()
$header["Content-Type"] = "application/json"; $header["Content-Type"] = "application/json";
$aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true); $aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true);
$host = splitfirst($_SERVER["host"], "//")[1]; $host = splitfirst($_SERVER["host"], "//")[1];
$aliases1 = [];
foreach ($aliases["aliases"] as $key => $aliase) { foreach ($aliases["aliases"] as $key => $aliase) {
if ($host==$aliase["alias"]) $projectId = $aliase["projectId"]; $aliases1[] = $aliase["alias"];
if ($host == $aliase["alias"]) $projectId = $aliase["projectId"];
}
if (!$projectId) {
$html = 'Please visit from one of: ' . json_encode($aliases1, JSON_PRETTY_PRINT);
return message($html, 'Error', 400);
} }
$tmp['HerokuappId'] = $projectId; $tmp['HerokuappId'] = $projectId;
@ -204,17 +205,18 @@ function install()
} }
}, 1000); }, 1000);
</script>'; </script>';
$title = "Success";
return message($html, $title, 201, 1); return message($html, $title, 201, 1);
} }
} }
} }
if ($_GET['install0']) { if ($_GET['install0']) {
$html .= ' $html = '
<form action="?install1" method="post" onsubmit="return notnull(this);"> <form action="?install1" method="post" onsubmit="return notnull(this);">
language:<br>'; language:<br>';
foreach ($constStr['languages'] as $key1 => $value1) { foreach ($constStr['languages'] as $key1 => $value1) {
$html .= ' $html .= '
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>'; <label><input type="radio" name="language" value="' . $key1 . '" ' . ($key1 == $constStr['language'] ? 'checked' : '') . ' onclick="changelanguage(\'' . $key1 . '\')">' . $value1 . '</label><br>';
} }
$html .= '<br> $html .= '<br>
<a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br> <a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
@ -222,7 +224,7 @@ language:<br>';
$html .= '<br> $html .= '<br>
<label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>'; <label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
$html .= ' $html .= '
<input type="submit" value="'.getconstStr('Submit').'"> <input type="submit" value="' . getconstStr('Submit') . '">
</form> </form>
<div id="showerror"></div> <div id="showerror"></div>
<script> <script>
@ -258,29 +260,28 @@ language:<br>';
return message($html, $title, 201); return message($html, $title, 201);
} }
if (substr($_SERVER["host"], -10)=="vercel.app") { //if (substr($_SERVER["host"], -10)=="vercel.app") {
$html .= '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind'); $html = '<a href="?install0">' . getconstStr('ClickInstall') . '</a>, ' . getconstStr('LogintoBind');
$html .= "<br>Remember: you MUST wait 30-60s after each operate / do some change, that make sure Vercel has done the building<br>" ; $html .= "<br>Remember: you MUST wait 30-60s after each operate / do some change, that make sure Vercel has done the building<br>";
} else { //} else {
$html.= "Please visit form *.vercel.app"; // $html.= "Please visit form *.vercel.app";
} //}
$title = 'Install'; $title = 'Install';
return message($html, $title, 201); return message($html, $title, 201);
} }
function copyFolder($from, $to) function copyFolder($from, $to) {
{ if (substr($from, -1) == '/') $from = substr($from, 0, -1);
if (substr($from, -1)=='/') $from = substr($from, 0, -1); if (substr($to, -1) == '/') $to = substr($to, 0, -1);
if (substr($to, -1)=='/') $to = substr($to, 0, -1);
if (!file_exists($to)) mkdir($to, 0777, 1); if (!file_exists($to)) mkdir($to, 0777, 1);
$handler=opendir($from); $handler = opendir($from);
while($filename=readdir($handler)) { while ($filename = readdir($handler)) {
if($filename != '.' && $filename != '..'){ if ($filename != '.' && $filename != '..') {
$fromfile = $from.'/'.$filename; $fromfile = $from . '/' . $filename;
$tofile = $to.'/'.$filename; $tofile = $to . '/' . $filename;
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归 if (is_dir($fromfile)) { // 如果读取的某个对象是文件夹,则递归
copyFolder($fromfile, $tofile); copyFolder($fromfile, $tofile);
}else{ } else {
copy($fromfile, $tofile); copy($fromfile, $tofile);
} }
} }
@ -289,8 +290,7 @@ function copyFolder($from, $to)
return 1; return 1;
} }
function setVercelConfig($envs, $appId, $token) function setVercelConfig($envs, $appId, $token) {
{
sortConfig($envs); sortConfig($envs);
$outPath = '/tmp/code/'; $outPath = '/tmp/code/';
$outPath_Api = $outPath . 'api/'; $outPath_Api = $outPath . 'api/';
@ -305,8 +305,7 @@ function setVercelConfig($envs, $appId, $token)
return VercelUpdate($appId, $token, $outPath); return VercelUpdate($appId, $token, $outPath);
} }
function VercelUpdate($appId, $token, $sourcePath = "") function VercelUpdate($appId, $token, $sourcePath = "") {
{
if (checkBuilding($appId, $token)) return '{"error":{"message":"Another building is in progress."}}'; if (checkBuilding($appId, $token)) return '{"error":{"message":"Another building is in progress."}}';
$url = "https://api.vercel.com/v13/deployments"; $url = "https://api.vercel.com/v13/deployments";
$header["Authorization"] = "Bearer " . $token; $header["Authorization"] = "Bearer " . $token;
@ -316,8 +315,8 @@ function VercelUpdate($appId, $token, $sourcePath = "")
$data["target"] = "production"; $data["target"] = "production";
$data["routes"][0]["src"] = "/(.*)"; $data["routes"][0]["src"] = "/(.*)";
$data["routes"][0]["dest"] = "/api/index.php"; $data["routes"][0]["dest"] = "/api/index.php";
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.4.0"; $data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.6.0";
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0]; if ($sourcePath == "") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
//echo $sourcePath . "<br>"; //echo $sourcePath . "<br>";
getEachFiles($file, $sourcePath); getEachFiles($file, $sourcePath);
$data["files"] = $file; $data["files"] = $file;
@ -330,8 +329,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
return json_encode($result); return json_encode($result);
} }
function checkBuilding($projectId, $token) function checkBuilding($projectId, $token) {
{
$r = 0; $r = 0;
$url = "https://api.vercel.com/v6/deployments/?projectId=" . $projectId; $url = "https://api.vercel.com/v6/deployments/?projectId=" . $projectId;
$header["Authorization"] = "Bearer " . $token; $header["Authorization"] = "Bearer " . $token;
@ -339,27 +337,26 @@ function checkBuilding($projectId, $token)
$response = curl("GET", $url, '', $header); $response = curl("GET", $url, '', $header);
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>"; //echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true); $result = json_decode($response["body"], true);
foreach ( $result['deployments'] as $deployment ) { foreach ($result['deployments'] as $deployment) {
if ($deployment['state']!=="READY") $r++; if ($deployment['state'] !== "READY" && $deployment['state'] !== "ERROR") $r++;
} }
return $r; return $r;
//if ($r===0) return true; //if ($r===0) return true;
//else return false; //else return false;
} }
function getEachFiles(&$file, $base, $path = "") function getEachFiles(&$file, $base, $path = "") {
{
//if (substr($base, -1)=="/") $base = substr($base, 0, -1); //if (substr($base, -1)=="/") $base = substr($base, 0, -1);
//if (substr($path, -1)=="/") $path = substr($path, 0, -1); //if (substr($path, -1)=="/") $path = substr($path, 0, -1);
$handler=opendir(path_format($base . "/" . $path)); $handler = opendir(path_format($base . "/" . $path));
while($filename=readdir($handler)) { while ($filename = readdir($handler)) {
if($filename != '.' && $filename != '..' && $filename != '.git'){ if ($filename != '.' && $filename != '..' && $filename != '.git') {
$fromfile = path_format($base . "/" . $path . "/" . $filename); $fromfile = path_format($base . "/" . $path . "/" . $filename);
//echo $fromfile . "<br>"; //echo $fromfile . "<br>";
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归 if (is_dir($fromfile)) { // 如果读取的某个对象是文件夹,则递归
$response = getEachFiles($file, $base, path_format($path . "/" . $filename)); $response = getEachFiles($file, $base, path_format($path . "/" . $filename));
if (api_error(setConfigResponse($response))) return $response; if (api_error(setConfigResponse($response))) return $response;
}else{ } else {
$tmp['file'] = path_format($path . "/" . $filename); $tmp['file'] = path_format($path . "/" . $filename);
$tmp['data'] = file_get_contents($fromfile); $tmp['data'] = file_get_contents($fromfile);
$file[] = $tmp; $file[] = $tmp;
@ -368,47 +365,43 @@ function getEachFiles(&$file, $base, $path = "")
} }
closedir($handler); closedir($handler);
return json_encode( [ 'response' => 'success' ] ); return json_encode(['response' => 'success']);
} }
function api_error($response) function api_error($response) {
{
return isset($response['error']); return isset($response['error']);
} }
function api_error_msg($response) function api_error_msg($response) {
{
return $response['error']['code'] . '<br> return $response['error']['code'] . '<br>
' . $response['error']['message'] . '<br> ' . $response['error']['message'] . '<br>
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>'; <button onclick="location.href = location.href;">' . getconstStr('Refresh') . '</button>';
} }
function setConfigResponse($response) function setConfigResponse($response) {
{
return json_decode($response, true); return json_decode($response, true);
} }
function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master') function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master') {
{
$tmppath = '/tmp'; $tmppath = '/tmp';
if ($GitSource=='Github') { if ($GitSource == 'Github') {
// 从github下载对应tar.gz并解压 // 从github下载对应tar.gz并解压
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/'; $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
} elseif ($GitSource=='HITGitlab') { } elseif ($GitSource == 'HITGitlab') {
$url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz'; $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz';
} else return json_encode(['error'=>['code'=>'Git Source input Error!']]); } else return json_encode(['error' => ['code' => 'Git Source input Error!']]);
$tarfile = $tmppath . '/github.tar.gz'; $tarfile = $tmppath . '/github.tar.gz';
file_put_contents($tarfile, file_get_contents($url)); file_put_contents($tarfile, file_get_contents($url));
$phar = new PharData($tarfile); $phar = new PharData($tarfile);
$html = $phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖 $html = $phar->extractTo($tmppath, null, true); //路径 要解压的文件 是否覆盖
unlink($tarfile); unlink($tarfile);
// 获取解压出的目录名 // 获取解压出的目录名
$outPath = findIndexPath($tmppath); $outPath = findIndexPath($tmppath);
if ($outPath=='') return '{"error":{"message":"no outpath"}}'; if ($outPath == '') return '{"error":{"message":"no outpath"}}';
$name = $project . 'CODE'; $name = $project . 'CODE';
mkdir($tmppath . "/" . $name, 0777, 1); mkdir($tmppath . "/" . $name, 0777, 1);
rename($outPath, $tmppath . "/" . $name . '/api'); rename($outPath, $tmppath . "/" . $name . '/api');
@ -425,31 +418,36 @@ function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneM
} }
function WaitFunction($deployid = '') { function WaitFunction($deployid = '') {
if ($buildId=='1') { if ($deployid == '1') {
$tmp['stat'] = 400; $tmp['stat'] = 400;
$tmp['body'] = 'id must provided.'; $tmp['body'] = 'id must provided.';
return $tmp; return $tmp;
} }
$header["Authorization"] = "Bearer " . getConfig('APIKey'); $token = getConfig('APIKey');
if ($token != '') {
$header["Authorization"] = "Bearer " . $token;
$header["Content-Type"] = "application/json"; $header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/deployments/" . $deployid; $url = "https://api.vercel.com/v13/deployments/" . $deployid;
$response = curl("GET", $url, "", $header); $response = curl("GET", $url, "", $header);
if ($response['stat']==200) { if ($response['stat'] == 200) {
$result = json_decode($response['body'], true); $result = json_decode($response['body'], true);
if ($result['readyState']=="READY") return true; if ($result['readyState'] == "READY") return true;
if ($result['readyState']=="ERROR") return $response; if ($result['readyState'] == "ERROR") return $response;
return false; return false;
} else { } else {
$response['body'] .= $url; $response['body'] .= $url;
return $response; return $response;
} }
} else {
return false;
}
} }
function changeAuthKey() { function changeAuthKey() {
if ($_POST['APIKey']!='') { if ($_POST['APIKey'] != '') {
$APIKey = $_POST['APIKey']; $APIKey = $_POST['APIKey'];
$tmp['APIKey'] = $APIKey; $tmp['APIKey'] = $APIKey;
$response = setConfigResponse( setVercelConfig($tmp, getConfig('HerokuappId'), $APIKey) ); $response = setConfigResponse(setVercelConfig($tmp, getConfig('HerokuappId'), $APIKey));
if (api_error($response)) { if (api_error($response)) {
$html = api_error_msg($response); $html = api_error_msg($response);
$title = 'Error'; $title = 'Error';
@ -468,6 +466,7 @@ function changeAuthKey() {
} }
}, 1000); }, 1000);
</script>'; </script>';
$title = "Success";
return message($html, $title, 201, 1); return message($html, $title, 201, 1);
} }
} }
@ -489,3 +488,9 @@ function changeAuthKey() {
</script>'; </script>';
return message($html, 'Change platform Auth token or key', 200); return message($html, 'Change platform Auth token or key', 200);
} }
function smallfileupload($drive, $path) {
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
if ($_FILES['file1']['size'] > 4 * 1024 * 1024) return output('File too large', 400);
return $drive->smallfileupload($path, $_FILES['file1']);
}

View File

@ -21,7 +21,6 @@ function getpath()
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p); if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
else $path = $_SERVER['REQUEST_URI']; else $path = $_SERVER['REQUEST_URI'];
$path = path_format( substr($path, strlen($_SERVER['base_path'])) ); $path = path_format( substr($path, strlen($_SERVER['base_path'])) );
$_SERVER['DOCUMENT_ROOT'] = '/var/task/user';
return $path; return $path;
} }

View File

@ -41,19 +41,22 @@
https://onemanager.qkqpttgf.repl.co/ https://onemanager.qkqpttgf.repl.co/
### Notice
> `Import from Github` useing the `.replit` file in code files will cause an empty web page, may someone help me?
### How to Install ### How to Install
A:
> 1. Click the "+" or "Create Repl", click the `Import from Github`;
> 2. Input `https://github.com/qkqpttgf/OneManager-php` in "GitHub URL", then it will auto show "Language" - "PHP Web Server", Click the "Import from Github";
> 3. After done, click the green button "Run", it will show the web page on the right, you MUST open it in a new tab or window.
B:
> 1. Click the "+" or "Create Repl", find template "PHP Web Server" (via input "php"), input a name for your project in "Title" or left it default, Click the "+ Create Repl". > 1. Click the "+" or "Create Repl", find template "PHP Web Server" (via input "php"), input a name for your project in "Title" or left it default, Click the "+ Create Repl".
> 2. After done, input `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` to Console or Shell on the right, press "Enter" to run it. > 2. After done, input `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` to Console or Shell on the right, press "Enter" to run it.
> 3. Click the green button "Run", it will show the web page on the right, you can open it in a new tab or window. > 3. Click the green button "Run", it will show the web page on the right, you MUST open it in a new tab or window.
--- ---
# Deploy to Heroku # ~~Deploy to Heroku~~
## Dyno will no longer free
### Official ### Official
@ -87,7 +90,9 @@
--- ---
# Deploy to Tencent Serverless Cloud Function (SCF) # ~~Deploy to Tencent Serverless Cloud Function (SCF)~~
## SCF no longer free
### Official ### Official

View File

@ -43,19 +43,22 @@
https://onemanager.qkqpttgf.repl.co/ https://onemanager.qkqpttgf.repl.co/
### 注意
> 直接`Import from Github`通过`.replit`文件指定php时网页会空白有人帮忙解决吗
### 安装 ### 安装
A:
> 1. 点右上的 "+" 或左上的 "+ Create Repl",点击`Import from Github`
> 2. 在"GitHub URL"中输入`https://github.com/qkqpttgf/OneManager-php`,会自动弹出显示"Language"与"PHP Web Server",点下面的"Import from Github"。
> 3. 结束后,点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
B:
> 1. 点右上的 "+" 或左上的 "+ Create Repl"template中输入php点选"PHP Web Server",在"Title"里输入你想要的名称或者让它默认, 点下面的"+ Create Repl"。 > 1. 点右上的 "+" 或左上的 "+ Create Repl"template中输入php点选"PHP Web Server",在"Title"里输入你想要的名称或者让它默认, 点下面的"+ Create Repl"。
> 2. 结束后在右边的Console或Shell里输入 `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` 敲回车运行。 > 2. 结束后在右边的Console或Shell里输入 `git clone https://github.com/qkqpttgf/OneManager-php && mv -b OneManager-php/* ./ && mv -b OneManager-php/.[^.]* ./ && rm -rf *~ && rm -rf OneManager-php` 敲回车运行。
> 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。 > 3. 点上方的绿色 "Run" 按钮,右边会显示一个网页,你要在新窗口打开它来安装,不然不能登录。
--- ---
# 部署到 Heroku # ~~部署到 Heroku~~
## Dyno套餐不再免费
### 官网 ### 官网
@ -87,7 +90,9 @@
--- ---
# 部署到腾讯无服务器云函数 Serverless Cloud Function (SCF) # ~~部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)~~
## SCF要收套餐费用了
### 官网 ### 官网

View File

@ -386,7 +386,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post"> <form action="<!--IsPreview?-->login=admin" method="post">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
</form> </form>

View File

@ -42,7 +42,7 @@
.more-disk a:hover, .more-disk a[now]{ background-color: rgba(85,85,85,0.7); color: white; } .more-disk a:hover, .more-disk a[now]{ background-color: rgba(85,85,85,0.7); color: white; }
.list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0} .list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0}
.list-table tr{height:40px} .list-table tr{height:40px}
.list-table tr[data-to]:hover{background:rgba(85,85,85,0.7);color:white;} .list-table tr[data-to]:hover{background:rgba(85,85,85,0.7) !important;color:white;}
.list-table tr[data-to]:hover a{color:white} .list-table tr[data-to]:hover a{color:white}
.list-table tr:first-child{background:rgba(245,245,245,0)} .list-table tr:first-child{background:rgba(245,245,245,0)}
.list-table td,.list-table th{padding:0 10px;text-align:left} .list-table td,.list-table th{padding:0 10px;text-align:left}
@ -471,7 +471,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
@ -483,12 +483,13 @@
<div style="color: rgba(247,247,249,0);"><!--FootStr--></div> <div style="color: rgba(247,247,249,0);"><!--FootStr--></div>
</body> </body>
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd-->
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <!--AliyundriveUploadJsStart--><script src="https://unpkg.com/bignumber.js@9.0.2/bignumber.js"></script>
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd--> <script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--AliyundriveUploadJsStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -519,13 +520,53 @@
f.password1.value = sha1(timestamp + "" + f.password1.value); f.password1.value = sha1(timestamp + "" + f.password1.value);
return true; return true;
} catch { } catch {
alert("sha1.js not loaded."); //alert("sha1.js not loaded.");
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
return false; return false;
} }
} }
function loadjs(url) {
var xhr = new XMLHttpRequest;
xhr.open("GET", url);
xhr.onload = function(e) {
if (xhr.status==200) {
var script = document.createElement("script");
script.type = "text/javascript";
script.text = xhr.responseText;
document.body.appendChild(script);
} else {
console.log(xhr.response);
}
}
xhr.send(null);
}
<!--LoginEnd--> <!--LoginEnd-->
<!--WriteTimezoneStart-->
var nowtime= new Date();
var timezone = 0-nowtime.getTimezoneOffset()/60;
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie="timezone="+timezone+"; path=/; "+expires;
if (timezone!=<!--timezone-->) {
//alert('Your timezone is '+timezone+', reload local timezone.');
location.href=location.href;
}
<!--WriteTimezoneEnd-->
<!--HeadmdStart-->
var $head = document.getElementById('head');
if ($head) {
//document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
$head.innerHTML = marked(document.getElementById('head-md').innerText);
}
<!--HeadmdEnd-->
<!--ReadmemdStart-->
var $readme = document.getElementById('readme');
if ($readme) {
$readme.innerHTML = marked(document.getElementById('readme-md').innerText);
}
<!--ReadmemdEnd-->
<!--ListStart--> <!--ListStart-->
<!--IsFileStart--> <!--IsFileStart-->
var $url = document.getElementById('url'); var $url = document.getElementById('url');
if ($url) { if ($url) {
@ -614,26 +655,64 @@
addVideos(["<!--FileEncodeUrl-->"]); addVideos(["<!--FileEncodeUrl-->"]);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: "<!--FileDownUrl-->", url: "<!--FileDownUrl-->",
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/", cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
cMapPacked: true, cMapPacked: true,
disableStream: true,
disableAutoFetch: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
/*loadingTask.onProgress = (e) => {
//console.log(e);
var p = document.getElementById('p');
if (p==null) {
p = document.createElement('div');
p.id = 'p';
p.setAttribute('onclick', "this.style.display = 'none';");
p.style = 'left: 10px; top: 30%; position: fixed;';
document.body.appendChild(p);
}
p.innerHTML = 'Loaded: ' + ((e.loaded/e.total)*100).toFixed(2) + '%<br>(' + size_format(e.loaded) + ' / ' + size_format(e.total) + ')';
p.style.display = '';
if (e.loaded==e.total) p.style.display = 'none';
}*/
loadingTask.promise.then(function(pdf) { loadingTask.promise.then(function(pdf) {
var pagenum = pdf.numPages; var pagenum = pdf.numPages;
var pdfContainer = document.getElementById('pdf-d'); var pdfContainer = document.getElementById('pdf-d');
pdfContainer.innerHTML = ''; pdfContainer.innerHTML = '';
for (var i=1;i<=pagenum;i++) { var pagepos = 1;
var pdfnextpagebutton = document.createElement('button');
pdfnextpagebutton.id = 'pdfnextpagebutton';
pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
pdfnextpagebutton.setAttribute('onclick', "this.style.display = 'none';");
pdfnextpagebutton.style.display = 'none';
pdfContainer.appendChild(pdfnextpagebutton);
var pdfWaitNextPage = setInterval(function(){
//console.log(document.documentElement.scrollTop + ", " + document.body.scrollHeight);
if (pdfnextpagebutton.style.display=='none') {
for (var i=pagepos;i<=(pagepos+4<pagenum?pagepos+4:pagenum);i++) {
var canvasNew = document.createElement('canvas'); var canvasNew = document.createElement('canvas');
canvasNew.id = 'pdf-c'+i; canvasNew.id = 'pdf-c'+i;
pdfContainer.appendChild(canvasNew); pdfContainer.appendChild(canvasNew);
renderpage(pdf,i); renderpage(pdf,i);
} }
pagepos = i;
if (pagepos<pagenum) {
console.log("next page: " + pagepos + " / " + pagenum);
pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
pdfnextpagebutton.style.display ='';
pdfContainer.appendChild(pdfnextpagebutton);
} else {
console.log("end of pdf");
clearInterval(pdfWaitNextPage);
}
}
}, 1000);
}); });
function renderpage(pdf,i) function renderpage(pdf,i) {
{
pdf.getPage(i).then(function(page) { pdf.getPage(i).then(function(page) {
var scale = 1.5; var scale = 1.5;
var viewport = page.getViewport({ scale: scale, }); var viewport = page.getViewport({ scale: scale, });
@ -648,22 +727,27 @@
page.render(renderContext); page.render(renderContext);
}); });
} }
function size_format(num) {
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' B';
}
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' KB';
}
if (num>1024) {
num=num/1024;
} else {
return num.toFixed(2) + ' MB';
}
return num.toFixed(2) + ' GB';
}
<!--IspdfFileEnd--> <!--IspdfFileEnd-->
<!--IsFileEnd--> <!--IsFileEnd-->
<!--IsFolderStart--> <!--IsFolderStart-->
<!--HeadmdStart-->
var $head = document.getElementById('head');
if ($head) {
//document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
$head.innerHTML = marked(document.getElementById('head-md').innerText);
}
<!--HeadmdEnd-->
<!--ReadmemdStart-->
var $readme = document.getElementById('readme');
if ($readme) {
$readme.innerHTML = marked(document.getElementById('readme-md').innerText);
}
<!--ReadmemdEnd-->
<!--ShowThumbnailsStart--> <!--ShowThumbnailsStart-->
function showthumbnails(obj) { function showthumbnails(obj) {
images = [<!--ImgExts-->]; images = [<!--ImgExts-->];
@ -794,18 +878,6 @@
} }
<!--IsNotHiddenEnd--> <!--IsNotHiddenEnd-->
<!--IsFolderEnd--> <!--IsFolderEnd-->
<!--WriteTimezoneStart-->
var nowtime= new Date();
var timezone = 0-nowtime.getTimezoneOffset()/60;
var expd = new Date();
expd.setTime(expd.getTime()+(2*60*60*1000));
var expires = "expires="+expd.toGMTString();
document.cookie="timezone="+timezone+"; path=/; "+expires;
if (timezone!=<!--timezone-->) {
alert('Your timezone is '+timezone+', reload local timezone.');
location.href=location.href;
}
<!--WriteTimezoneEnd-->
function CopyAllDownloadUrl(str) { function CopyAllDownloadUrl(str) {
var tmptextarea=document.createElement('textarea'); var tmptextarea=document.createElement('textarea');
document.body.appendChild(tmptextarea); document.body.appendChild(tmptextarea);
@ -1057,7 +1129,9 @@
let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
lastCurrentSpeed = tmpspeed; lastCurrentSpeed = tmpspeed;
let remaintime = (totalsize-asize-e.loaded)/tmpspeed; let remaintime = (totalsize-asize-e.loaded)/tmpspeed;
label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1)); let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
label.innerHTML = StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
} }
} }
var C_starttime = new Date(); var C_starttime = new Date();
@ -1086,7 +1160,7 @@
while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/'); while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/');
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green'; label.parentNode.style.background = 'rgba(0,80,0,25%)';
// uploadbuttonshow(); // uploadbuttonshow();
<!--AdminStart--> <!--AdminStart-->
@ -1143,7 +1217,39 @@
}// else console.log(Object.keys(uploading).length); }// else console.log(Object.keys(uploading).length);
} else clearInterval(uploadList); } else clearInterval(uploadList);
}, 1000); }, 1000);
//getuplink(i); function CalcProof(file) {
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.open("POST", '?action=upbigfile');
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
xhr.onload = function(e){
var html;
if (xhr.status==200) {
//console.log(xhr.responseText);
var r = new BigNumber("0x".concat(xhr.responseText));
var i = new BigNumber(file.size);
var o = i ? r.mod(i) : 0;
var reader1 = new FileReader();
var start = o.toNumber();
var end = start + 8;
//if (file.size<end) end = file.size;
console.log(start + " ~ " + end);
//reader1.readAsBinaryString(file.slice(start,end));
reader1.readAsDataURL(file.slice(start,end));
reader1.onload = function(e) {
var proof = this.result;
proof = proof.substr(proof.indexOf('base64,')+7);
resolve(proof);
}
} else {
//console.log(xhr.status+'calc proof code\n'+xhr.responseText);
reject(xhr.status+"\ncalc proof code\n"+xhr.responseText);
}
}
xhr.send('CalcProof=1');
});
}
function getuplink(i, r=0) { function getuplink(i, r=0) {
var file=files[i]; var file=files[i];
var td1; var td1;
@ -1171,6 +1277,7 @@
uploadbuttonshow(); uploadbuttonshow();
return; return;
}*/ }*/
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name)); var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
uploading[upbigfilename] = [i]; uploading[upbigfilename] = [i];
var spark = sha1.create(); var spark = sha1.create();
@ -1182,7 +1289,14 @@
var blob = file.slice(start,end); var blob = file.slice(start,end);
reader.readAsArrayBuffer(blob); reader.readAsArrayBuffer(blob);
} }
var proof_code = '';
CalcProof(file).then(a => {
proof_code = a;
console.log('proof: ' + proof_code);
readblob(asize); readblob(asize);
}, e => {
td2.innerHTML = e;
});
reader.onload = function(e){ reader.onload = function(e){
td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%'; td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
@ -1250,7 +1364,7 @@
getuplink(i); getuplink(i);
}*/ }*/
} }
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin")); xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&proof_code=' + proof_code + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
} }
} }
} }
@ -1329,7 +1443,7 @@
} }
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green'; label.parentNode.style.background = 'rgba(0,80,0,25%)';
} else { } else {
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>'; label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
localStorage.removeItem(filesha1); localStorage.removeItem(filesha1);
@ -1349,7 +1463,9 @@
var tmptime = new Date(); var tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime()); var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
var remaintime = (totalsize-asize-e.loaded)/tmpspeed; var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1)); let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
label.innerHTML=StartStr+'<!--constStr@Upload--> ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% <!--constStr@AverageSpeed-->:'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s<br><!--constStr@CurrentSpeed--> '+size_format(tmpspeed)+'/s <!--constStr@Expect--> '+seconds2hour(remaintime.toFixed(1));
} }
} }
var C_starttime = new Date(); var C_starttime = new Date();
@ -1400,7 +1516,7 @@
} }
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>'; document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+filename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+filename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" <!--AdminStart--> style="display:none"<!--AdminEnd--> ><!--constStr@CopyUrl--></button></div>';
label.innerHTML=StartStr+MiddleStr; label.innerHTML=StartStr+MiddleStr;
label.style.color='green'; label.parentNode.style.background = 'rgba(0,80,0,25%)';
} else { } else {
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>'; label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
localStorage.removeItem(filesha1); localStorage.removeItem(filesha1);
@ -1646,7 +1762,7 @@
document.getElementById('password1').focus(); document.getElementById('password1').focus();
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://www.unpkg.com/ionicons@6.0.1/dist/ionicons.js"></script>
<!--LoginStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="?jsFile=sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -497,7 +497,7 @@
<div> <div>
<a onclick="operatediv_close('login')" class="operatediv_close">×</a> <a onclick="operatediv_close('login')" class="operatediv_close">×</a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
@ -510,11 +510,11 @@
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--AliyundriveUploadJsStart--><script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<style type="text/css"> <style type="text/css">
.markdown-body{font-size: 14px;} .markdown-body{font-size: 14px;}
@ -642,10 +642,10 @@
addVideos(['<!--FileEncodeUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/", cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1698,6 +1698,6 @@
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="?jsFile=sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -89,9 +89,10 @@
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<form action="?admin" method="post"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<div class="modal-body"> <div class="modal-body">
<input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<input class="btn btn-primary" type="submit" value="<!--constStr@Login-->"></button> <input class="btn btn-primary" type="submit" value="<!--constStr@Login-->"></button>
@ -668,7 +669,7 @@ return false;
<!--IsFolderEnd--> <!--IsFolderEnd-->
<!--AdminEnd--> <!--AdminEnd-->
<!--LoginStart--> <!--LoginStart-->
<script src="?jsFile=sha1.min.js"></script>
<!--LoginEnd--> <!--LoginEnd-->
<p class="text-center text-muted"><a href="https://github.com/qkqpttgf/OneManager-php" class="text-muted">OneManager</a> By 逸笙 Theme By Nchyn</p> <p class="text-center text-muted"><a href="https://github.com/qkqpttgf/OneManager-php" class="text-muted">OneManager</a> By 逸笙 Theme By Nchyn</p>
<p class="text-center" style="color: rgba(247,247,249,0);"><!--FootStr--></p> <p class="text-center" style="color: rgba(247,247,249,0);"><!--FootStr--></p>
@ -676,11 +677,11 @@ return false;
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="//cdn.bootcdn.net/ajax/libs/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--AliyundriveUploadJsStart--><script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -802,10 +803,10 @@ return false;
addVideos(['<!--FileEncodeUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/", cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1745,6 +1746,35 @@ return false;
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px'; document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
document.getElementById('login_input').focus(); document.getElementById('login_input').focus();
} }
function sha1loginpass(f) {
if (f.password1.value=="") return false;
try {
timestamp = new Date().getTime() + "";
timestamp = timestamp.substr(0, timestamp.length-3);
f.timestamp.value = timestamp;
f.password1.value = sha1(timestamp + "" + f.password1.value);
return true;
} catch {
//alert("sha1.js not loaded.");
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
return false;
}
}
function loadjs(url) {
var xhr = new XMLHttpRequest;
xhr.open("GET", url);
xhr.onload = function(e) {
if (xhr.status==200) {
var script = document.createElement("script");
script.type = "text/javascript";
script.text = xhr.responseText;
document.body.appendChild(script);
} else {
console.log(xhr.response);
}
}
xhr.send(null);
}
<!--LoginEnd--> <!--LoginEnd-->
<!--EncryptedStart--> <!--EncryptedStart-->
document.getElementById('password1').focus(); document.getElementById('password1').focus();

View File

@ -145,8 +145,8 @@
</div> </div>
<!--IsofficeFileEnd--> <!--IsofficeFileEnd-->
<!--IsvideoFileStart--> <!--IsvideoFileStart-->
<link class="dplayer-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css"> <link class="dplayer-css" rel="stylesheet" href="https://fastly.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/dplayer/1.27.0/DPlayer.min.js"></script>
<div class="nexmoe-item"> <div class="nexmoe-item">
<div class="mdui-center" id="dplayer"></div> <div class="mdui-center" id="dplayer"></div>
</div> </div>
@ -283,8 +283,8 @@
<!--ShowThumbnailsEnd--> <!--ShowThumbnailsEnd-->
<!--IsFolderEnd--> <!--IsFolderEnd-->
<!--ListEnd--> <!--ListEnd-->
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<script> <script>
<!--MorePageStart--> <!--MorePageStart-->
function nextpage(num) { function nextpage(num) {

View File

@ -374,8 +374,8 @@
<!--ListEnd--> <!--ListEnd-->
<script src="//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script> <script src="//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script> <script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<script> <script>
<!--MorePageStart--> <!--MorePageStart-->
function nextpage(num) { function nextpage(num) {

View File

@ -421,7 +421,7 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value=""> <input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
@ -434,11 +434,11 @@
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd--> <!--AliyundriveUploadJsStart--><script src="?jsFile=sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -564,10 +564,10 @@
addVideos(['<!--FileEncodeUrl-->']); addVideos(['<!--FileEncodeUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/", cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1590,6 +1590,6 @@
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--LoginStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--LoginEnd--> <!--LoginStart--><script src="?jsFile=sha1.min.js"></script><!--LoginEnd-->
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -457,8 +457,9 @@
<div style="margin:50px"> <div style="margin:50px">
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a> <a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
<center> <center>
<form action="<!--IsPreview?-->admin" method="post"> <form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->"> <input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
<input name="timestamp" type="hidden" value="">
<input type="submit" value="<!--constStr@Login-->"> <input type="submit" value="<!--constStr@Login-->">
</form> </form>
</center> </center>
@ -469,10 +470,10 @@
</body> </body>
<!--ListStart--> <!--ListStart-->
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css"> <!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd--> <script type="text/javascript" src="?jsFile=marked.js"></script><!--MdRequireEnd-->
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd--> <!--GuestUploadStart--><script type="text/javascript" src="?jsFile=spark-md5.min.js"></script><!--GuestUploadEnd-->
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd--> <!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
<!--ListEnd--> <!--ListEnd-->
<script type="text/javascript"> <script type="text/javascript">
function changelanguage(str) function changelanguage(str)
@ -594,10 +595,10 @@
addVideos(['<!--FileDownUrl-->']); addVideos(['<!--FileDownUrl-->']);
<!--IsvideoFileEnd--> <!--IsvideoFileEnd-->
<!--IspdfFileStart--> <!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({ var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->', url: '<!--FileDownUrl-->',
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/", cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
cMapPacked: true, cMapPacked: true,
rangeChunkSize: 65535 rangeChunkSize: 65535
}); });
@ -1246,11 +1247,43 @@
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px'; document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
document.getElementById('login_input').focus(); document.getElementById('login_input').focus();
} }
function sha1loginpass(f) {
if (f.password1.value == "") return false;
try {
timestamp = new Date().getTime() + "";
timestamp = timestamp.substr(0, timestamp.length - 3);
f.timestamp.value = timestamp;
f.password1.value = sha1(timestamp + "" + f.password1.value);
return true;
} catch {
//alert("sha1.js not loaded.");
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
return false;
}
}
function loadjs(url) {
var xhr = new XMLHttpRequest;
xhr.open("GET", url);
xhr.onload = function (e) {
if (xhr.status == 200) {
var script = document.createElement("script");
script.type = "text/javascript";
script.text = xhr.responseText;
document.body.appendChild(script);
} else {
console.log(xhr.response);
}
}
xhr.send(null);
}
<!--LoginEnd--> <!--LoginEnd-->
<!--EncryptedStart--> <!--EncryptedStart-->
document.getElementById('password1').focus(); document.getElementById('password1').focus();
<!--EncryptedEnd--> <!--EncryptedEnd-->
</script> </script>
<!--LoginStart-->
<script src="?jsFile=sha1.min.js"></script>
<!--LoginEnd-->
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> <script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!--customScript--> <!--customScript-->
</html> </html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<link rel="preconnect" href="https://cdn.jsdelivr.net" /> <link rel="preconnect" href="https://fastly.jsdelivr.net" />
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" />
<meta charset="utf-8" /> <meta charset="utf-8" />
@ -16,7 +16,7 @@
/> />
<title><!--Title--></title> <title><!--Title--></title>
<meta name="description" content="A Onemanager-PHP site with Theme-renexmoe" /> <meta name="description" content="A Onemanager-PHP site with Theme-renexmoe" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/css/app.css"><meta name="theme-color" content="#fff" /> <link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/css/app.css"><meta name="theme-color" content="#fff" />
<!--BackgroundStart--> <!--BackgroundStart-->
<style> <style>
body { body {
@ -98,9 +98,9 @@
<div class="mdui-drawer mdui-drawer-close" id="main-drawer"> <div class="mdui-drawer mdui-drawer-close" id="main-drawer">
<div class="mdui-list" mdui-collapse="{accordion: true}"> <div class="mdui-list" mdui-collapse="{accordion: true}">
<!--LoginStart--> <!--LoginStart-->
<li class="mdui-list-item mdui-ripple" href="?admin" > <li class="mdui-list-item mdui-ripple" href="?login=admin" >
<a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a> <a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a>
<a class="mdui-list-item-content" href="?admin">登录</a> <a class="mdui-list-item-content" href="?login=admin">登录</a>
</li> </li>
<!--LoginEnd--> <!--LoginEnd-->
<!--AdminStart--> <!--AdminStart-->
@ -511,5 +511,5 @@
{ "music":"audiotrack", "video":"ondemand_video", "img":"image", { "music":"audiotrack", "video":"ondemand_video", "img":"image",
"pdf":"picture_as_pdf", "default":"insert_drive_file"} "pdf":"picture_as_pdf", "default":"insert_drive_file"}
<!--IconValuesEnd--> <!--IconValuesEnd-->
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@1b381f3c.a4f2dc4618121eac37e2.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@28a13772.98a11cc0c1cf2495c3d8.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@34e3d95a.2f8dbf552095a86a7f1b.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@798ab416.9ed46bb752b71a3c13a4.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@9c50beac.30955a99f08c9574cd14.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@f0256996.956ea71aa357ba3fdc28.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/webpack-runtime.93708ab3e9cb84dcc01a.js"></script> <script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@1b381f3c.a4f2dc4618121eac37e2.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@28a13772.98a11cc0c1cf2495c3d8.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@34e3d95a.2f8dbf552095a86a7f1b.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@798ab416.9ed46bb752b71a3c13a4.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@9c50beac.30955a99f08c9574cd14.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@f0256996.956ea71aa357ba3fdc28.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/webpack-runtime.93708ab3e9cb84dcc01a.js"></script>
</html> </html>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
#!bash #!/bin/bash
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo " echo "

View File

@ -1,7 +1,10 @@
20220127-1234.43
<font color="red">change login page, default not '?admin' but '?login=admin' now! and if set adminloginpage, it will be '?login=[value]'.</font> rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config. Allow Preview when enable downloadencrypt. some change in adding Onedrive disk. show upload progress in table background. fix some bugs.
<font color="red">更改登录地址,默认不再是'?admin'而是'?login=admin'如果设置了adminloginpage那登录地址会是'?login=值'。</font>移除 JumpFirstDisk在root操作时返回403更改盘排序重做盘符排列添加全局md配置。在开启downloadencrypt后可以网页预览了。添加onedrive盘时稍做修改。上传时以背景做进度条。修复其它bug。
20211220-1100.42 20211220-1100.42
Add new platform Replit. Add a git source for update. sha1.js use jsdelivr cdn. fix some bugs. Add new platform Replit. Add a git source for update. sha1.js use jsdelivr cdn. fix some bugs.
新增Replit平台。新增国内git源以后国内可以选择从HIT源更新。sha1.js换成jsdelivr CDN。修复bug。 新增Replit平台。新增国内git源以后国内可以选择从HIT源更新。sha1.js换成jsdelivr CDN。修复bug。
20211201-1602.41 20211201-1602.41
add a latent function, you can edit platform token(or API key) via '?setup=auth' when the token invalid, not need edit it in Environment(or Config Var) manually, (even in Vercel, config saved in file, and can't modiy it manually). add a latent function, you can edit platform token(or API key) via '?setup=auth' when the token invalid, not need edit it in Environment(or Config Var) manually, (even in Vercel, config saved in file, and can't modiy it manually).
新增隐藏功能在平台操作代码的token或API key失效时可以在 '?setup=auth' 修改它不用去环境变量修改了特别地Vercel保存在代码中时都改不到 新增隐藏功能在平台操作代码的token或API key失效时可以在 '?setup=auth' 修改它不用去环境变量修改了特别地Vercel保存在代码中时都改不到