Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d67d57ded | ||
|
|
7e5fc7c502 | ||
|
|
f2ee21b683 | ||
|
|
729e1e1176 | ||
|
|
12494b62ed | ||
|
|
54e38b5f67 | ||
|
|
b079891a1e | ||
|
|
ee33e30cbf | ||
|
|
c862409072 | ||
|
|
0a20505798 | ||
|
|
29e9fea562 | ||
|
|
80d93cb852 | ||
|
|
b2b5703977 | ||
|
|
21d7d5d007 | ||
|
|
e06065a95c | ||
|
|
e58502f0be | ||
|
|
9ff6e6bfe4 | ||
|
|
52de7975c4 | ||
|
|
638d8b09e3 | ||
|
|
244fbf747c | ||
|
|
47bf9705bb | ||
|
|
23bf6fa38f | ||
|
|
e2494ff385 | ||
|
|
353222fc47 | ||
|
|
ba6aa0e9a1 | ||
|
|
00422380d4 | ||
|
|
82f4d1b247 | ||
|
|
21d96bb838 | ||
|
|
31b64cf4ba | ||
|
|
fc5cdab36b | ||
|
|
c0d3afcaa4 | ||
|
|
1a5a6ee0e8 | ||
|
|
bc4a300cf7 | ||
|
|
8732de4047 | ||
|
|
3249934f36 | ||
|
|
c6e93168af | ||
|
|
74bb87ef15 | ||
|
|
86ba05b5be | ||
|
|
7e4bf448e3 | ||
|
|
1737477aed | ||
|
|
33e464f991 | ||
|
|
dec313c0c7 | ||
|
|
0adcec4cf4 | ||
|
|
4de09d0a15 | ||
|
|
5d7b4deeb7 | ||
|
|
3498d8862e | ||
|
|
e9c3125194 | ||
|
|
6030c320c5 | ||
|
|
dd1250b0f0 | ||
|
|
d03423bb5f | ||
|
|
77d8147405 | ||
|
|
52d765a27f | ||
|
|
41d37f6bb4 | ||
|
|
57fc272939 | ||
|
|
fa7b27a878 | ||
|
|
279055b3bb | ||
|
|
741044e5ea | ||
|
|
13b70a4252 | ||
|
|
57f5a1cdd2 | ||
|
|
3b084f9544 | ||
|
|
72e08c886a | ||
|
|
e131588680 | ||
|
|
d33578ad57 | ||
|
|
388f08a9b0 | ||
|
|
398fa02063 | ||
|
|
a630f9cbe7 | ||
|
|
04908da5a4 | ||
|
|
1da82abb95 | ||
|
|
b545056787 | ||
|
|
f33564258d | ||
|
|
a4fe802689 | ||
|
|
98d5b4d63f | ||
|
|
bd682db3b9 | ||
|
|
f993264e91 | ||
|
|
a8e3d2ad15 | ||
|
|
ef1748ba15 | ||
|
|
e116b1224e | ||
|
|
55c9805cc0 | ||
|
|
99d3d4c2ee | ||
|
|
ea278dc2b3 | ||
|
|
ca4ec6f497 | ||
|
|
671481c284 | ||
|
|
449ead425a | ||
|
|
c0852bc979 | ||
|
|
8a5d22f699 | ||
|
|
ff74c9b50c | ||
|
|
d9d34d32c9 | ||
|
|
d591812c7f | ||
|
|
599b937f99 | ||
|
|
7ea726c9c7 | ||
|
|
1295ad92ef | ||
|
|
32649ccc62 | ||
|
|
e83648a332 | ||
|
|
ec6e9d50ce | ||
|
|
58482e88c5 | ||
|
|
d377410b19 | ||
|
|
75710ec7e9 | ||
|
|
43b1046aba | ||
|
|
0f5c7587d5 | ||
|
|
d5c456bc0b | ||
|
|
7b51e773f3 | ||
|
|
82e8d5d0e7 | ||
|
|
06db4a70f6 | ||
|
|
3118222734 | ||
|
|
2850db0699 | ||
|
|
273f41d90b | ||
|
|
fab8a996e3 | ||
|
|
5543c0314e | ||
|
|
19549e0612 | ||
|
|
6f2a4c4a40 | ||
|
|
9717e32254 | ||
|
|
377a9f8aaa | ||
|
|
119ac5280d | ||
|
|
6230773e52 | ||
|
|
bc66f43bea | ||
|
|
0649f19e21 | ||
|
|
8ef5e3d4a6 | ||
|
|
4c0daaca80 | ||
|
|
ab49796661 | ||
|
|
5c29afd5fe | ||
|
|
4cecf6f5af | ||
|
|
6e66ec05d8 | ||
|
|
6949fae7eb | ||
|
|
928d028d7f | ||
|
|
55e7a840d2 | ||
|
|
dd4dde83f3 | ||
|
|
2aec731ab1 | ||
|
|
d42547bdfb | ||
|
|
07edb1aadf | ||
|
|
cee88dba69 | ||
|
|
c06b8c0992 | ||
|
|
77198ddf8b | ||
|
|
4e008e0b2f | ||
|
|
1af93af86f | ||
|
|
6f9235bc33 | ||
|
|
8c5c61508c | ||
|
|
dad086da6b | ||
|
|
86ddf9e388 | ||
|
|
e07e036fb6 | ||
|
|
ae14fd6ca8 | ||
|
|
cba994cf41 | ||
|
|
36048cd773 | ||
|
|
cb69900c32 | ||
|
|
61811b60ac | ||
|
|
fb6306c316 | ||
|
|
5d524529b4 | ||
|
|
e9ed4dc7f1 | ||
|
|
c234dd62d1 | ||
|
|
3aaa18ee59 | ||
|
|
366a477ae2 | ||
|
|
a05ba3ed44 | ||
|
|
46b9fb9296 | ||
|
|
7c23cdfba1 | ||
|
|
c610eb6a85 | ||
|
|
8254f279ef | ||
|
|
a9be0e3fbf | ||
|
|
57e6c481d3 | ||
|
|
d613780312 | ||
|
|
cce6e32b61 | ||
|
|
2b5bb6d3b5 | ||
|
|
c09453080c | ||
|
|
71675b58b7 | ||
|
|
f8e3db2e37 | ||
|
|
ba471ab650 | ||
|
|
c186cee4d3 | ||
|
|
bb9b76a427 | ||
|
|
9987651af9 | ||
|
|
38bd4e4041 | ||
|
|
558d34c9e3 | ||
|
|
79b7357b70 | ||
|
|
12ff9da6f4 | ||
|
|
0b6adc077c | ||
|
|
bdedf7a4b0 | ||
|
|
bde862ffb5 | ||
|
|
0521bc08c0 | ||
|
|
89de647c2f | ||
|
|
ee6f9c9761 | ||
|
|
fbfc683c1b | ||
|
|
2d18450872 | ||
|
|
6b08d8edf2 | ||
|
|
1251195b8f | ||
|
|
71d57052da | ||
|
|
11e87f9ea8 | ||
|
|
85cdc6b211 | ||
|
|
8e3a165d60 | ||
|
|
562cd246c4 | ||
|
|
d8c1cd619b | ||
|
|
1b8d29354d | ||
|
|
c4fcd55669 | ||
|
|
ff85f901f8 | ||
|
|
4ea8cb5bef | ||
|
|
ec9ba6c20e | ||
|
|
0617d258d5 | ||
|
|
ecb2aad3bb | ||
|
|
49e602e7e6 | ||
|
|
96ce1a91d3 | ||
|
|
fe876dd87c | ||
|
|
c36621b400 | ||
|
|
1367dd72fb | ||
|
|
34599a6e71 | ||
|
|
5e49a44ec1 | ||
|
|
01e094d95d | ||
|
|
66238a6d54 | ||
|
|
be96d3aa8b | ||
|
|
b44f15f141 | ||
|
|
15a7ea192a | ||
|
|
0535fcc709 | ||
|
|
4d83358ee1 | ||
|
|
27ec89e172 | ||
|
|
0b0f80c135 | ||
|
|
d5120aa390 | ||
|
|
1102d4234f | ||
|
|
894121d0c6 | ||
|
|
399fb38fd4 | ||
|
|
661a6f89fe | ||
|
|
0169c5bb9a | ||
|
|
3f63374740 | ||
|
|
404ee22905 | ||
|
|
4c836880a1 | ||
|
|
e8f1fd7175 | ||
|
|
372a42bc05 | ||
|
|
b8c4cc1312 | ||
|
|
4e434ede6b | ||
|
|
086ac6d3e0 | ||
|
|
26b49c7a69 | ||
|
|
10a071df64 | ||
|
|
352a078829 | ||
|
|
de5ccd74cb | ||
|
|
218e7e5230 | ||
|
|
40eca60aba | ||
|
|
67da665f11 | ||
|
|
6b5c26b897 | ||
|
|
4d48228d8a | ||
|
|
20d210945e | ||
|
|
95a62a9d81 | ||
|
|
6ed09dde72 | ||
|
|
bc38d419e0 |
@@ -9,6 +9,11 @@ RewriteRule ^(.*) index.php?/$1 [L]
|
||||
### nginx
|
||||
# rewrite ^/(?!.well-known)(.*)$ /index.php?/$1 last;
|
||||
#
|
||||
### nginx Subdirectory 在子目录中使用
|
||||
# location /OneManager2/ {
|
||||
# rewrite ^/(.*)$ /OneManager2/index.php?/$1 last;
|
||||
# }
|
||||
#
|
||||
### caddy
|
||||
# rewrite {
|
||||
# to index.php?/$1
|
||||
|
||||
+1126
-1267
File diff suppressed because it is too large
Load Diff
+277
-66
@@ -13,11 +13,12 @@ $exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
|
||||
$constStr = [
|
||||
'languages' => [
|
||||
'en-us' => 'English',
|
||||
'zh-cn' => '简体中文',
|
||||
'zh-tw' => '繁體中文',
|
||||
'zh-cn' => '简体中文',
|
||||
'ja' => '日本語',
|
||||
'ko-kr' => '한국어',
|
||||
'fa' => 'فارسی',
|
||||
'ar-sa' => 'السعودية',
|
||||
],
|
||||
'Week' => [
|
||||
'en-us' => [
|
||||
@@ -74,6 +75,15 @@ $constStr = [
|
||||
5 => 'جمعه',
|
||||
6 => 'شنبه',
|
||||
],
|
||||
'ar-sa' => [
|
||||
6 => 'بيوم الأحد',
|
||||
0 => 'الإثنين',
|
||||
1 => 'الثلاثاء',
|
||||
2 => 'الأربعاء',
|
||||
3 => 'الخميس',
|
||||
4 => 'يوم الجمعة',
|
||||
5 => 'في. يوم السبت',
|
||||
],
|
||||
],
|
||||
'EnvironmentsDescription' => [
|
||||
'en-us' => [
|
||||
@@ -83,57 +93,64 @@ $constStr = [
|
||||
'customScript' => '<script> in all pages, e.g. http turn to https',
|
||||
'customCss' => '<style> in <head>',
|
||||
'customTheme' => 'an url of html',
|
||||
'referrer' => 'only these domains can refer resourse in this site, format is a1.com|b2.com',
|
||||
'domain_path' => 'more custom domain, format is a1.com:/dirto/path1|b2.com:/path2',
|
||||
'diskname' => 'The disk name you want show.',
|
||||
'diskDescription' => ' Some tips of this disk, not used in code.',
|
||||
'disktag' => 'A tag used in store config and url.',
|
||||
'disableShowThumb' => 'if 1, the ShowThumbnail button will not display',
|
||||
'disableChangeTheme' => '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',
|
||||
'useBasicAuth' => 'if 1, will popup user/pass windows in encrypted folder.',
|
||||
'background' => 'Set an url as background photo.',
|
||||
'backgroundm' => 'Set an url as background in mobile phone.',
|
||||
'theme' => 'Select theme.',
|
||||
'forceHttps' => 'if 1, force to redirect to https when visit via http.',
|
||||
'theme' => 'Select theme for guest.',
|
||||
'timezone' => 'Set default timezone.',
|
||||
'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',
|
||||
'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',
|
||||
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway; public show files less than private.',
|
||||
'public_path' => 'Show this Onedrive dir when through the long url of API Gateway.',
|
||||
'sitename' => 'sitename',
|
||||
'Onedrive_ver' => 'Onedrive version',
|
||||
],
|
||||
'zh-cn' => [
|
||||
'admin' => '管理密码,不添加时不显示登录页面且无法登录。',
|
||||
'adminloginpage' => '如果设置,登录按钮及页面隐藏。管理登录的页面不再是\'?admin\',而是\'?此设置的值\'。',
|
||||
'autoJumpFirstDisk' => '用于多盘,如果设1,将会自动跳到第一个盘。',
|
||||
'autoJumpFirstDisk' => '用于多个磁盘,如果为1,则自动跳转到第一个磁盘',
|
||||
'customScript' => '<script>,在所有页都会存在,例如放一个http跳转https',
|
||||
'customCss' => '<style>,在<head>最后面',
|
||||
'customTheme' => 'html格式的主题的url',
|
||||
'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2,比private_path优先。',
|
||||
'referrer' => '只有这些域名能引用本站资源。格式为a1.com|b1.com',
|
||||
'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2。',
|
||||
'diskname' => '这个盘你想显示什么名称。',
|
||||
'diskDescription' => '对这个盘的一些描述,随便写,代码不引用这个。',
|
||||
'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。',
|
||||
'disableShowThumb' => '如果填 1, ‘显示缩略’按钮将被隐藏。',
|
||||
'disableChangeTheme' => '如果填 1, 主题选择切换将被隐藏',
|
||||
'disableChangeTheme' => '如果为 1,则不会显示主题选择按钮',
|
||||
'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。',
|
||||
'useBasicAuth' => '如果为 1,加密目录将弹出用户名密码窗口,不会显示主题自带的输入密码页面。',
|
||||
'background' => '设置一个url作为背景。',
|
||||
'backgroundm' => '设置一个url作为手机用的背景。',
|
||||
'theme' => '选择一个主题。',
|
||||
'backgroundm' => '设置一个url作为手机端用的背景。',
|
||||
'forceHttps' => '0或1。如果设置为1,会强制跳https',
|
||||
'theme' => '为游客选择一个主题。',
|
||||
'timezone' => '设置默认时区。',
|
||||
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
|
||||
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md',
|
||||
'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;',
|
||||
'domainforproxy' => '会将https://xxxxx-my.sharepoint.com替换成这个值,在目标需要自己设置反代。会加上&Origindomain=原域名',
|
||||
'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录;不能是private_path的上级(public看到的不能比private多,要么看到的就不一样)。',
|
||||
'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录。',
|
||||
'sitename' => '网站的名称',
|
||||
'Onedrive_ver' => 'Onedrive版本',
|
||||
],
|
||||
'zh-tw' => [
|
||||
'admin' => '管理密碼,不添加時不顯示登入頁面且無法登入。',
|
||||
'admin' => '管理密碼,不設定密碼將不顯示登入頁面且無法登入。',
|
||||
'adminloginpage' => '如果設定,登入按鈕及頁面隱藏。管理登入的頁面不再是\'?admin\',而是\'?此設置的值\'。',
|
||||
'autoJumpFirstDisk' => '用於多盤,如果設1,將會自動跳到第一個盤。',
|
||||
'customScript' => '<script>,在所有頁都會存在,例如放一個http跳轉https',
|
||||
'customCss' => '<style>,在<head>最後面',
|
||||
'customTheme' => 'html格式的主題的url',
|
||||
'domain_path' => '使用多個自訂域名時,指定每個域名看到的目錄。格式為a1.com:/dirto/path1|b1.com:/path2,比private_path優先。',
|
||||
'referrer' => '',
|
||||
'domain_path' => '使用多個自訂域名時,指定每個域名看到的目錄。格式為a1.com:/dirto/path1|b1.com:/path2。',
|
||||
'diskname' => '這個盤你想顯示什麼名稱。',
|
||||
'disktag' => '一個標籤,用於儲存配置,多盤時會顯示在url中。',
|
||||
'disableShowThumb' => '如果填 1, ‘顯示縮略’按鈕將被隱藏。',
|
||||
@@ -141,47 +158,69 @@ $constStr = [
|
||||
'downloadencrypt' => '0 或 1。如果 1, 那加密目錄內的文件可以不需要密碼就能下載。',
|
||||
'background' => '設定一個url作為背景。',
|
||||
'backgroundm' => '設定一個url作為手機用的背景。',
|
||||
'theme' => '選擇一個主題。',
|
||||
'theme' => '为遊客選擇一個主題。',
|
||||
'timezone' => '設定預設時區。',
|
||||
'guestup_path' => '設定遊客上傳路徑(圖床路徑),不設定這個值時該目錄內容會正常列文件出來,設定後只有上傳介面,不顯示其中文件(登入後顯示)。',
|
||||
'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表給遊客看,但它的功能正常,比如readme.md',
|
||||
'passfile' => '自訂密碼文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目錄時不會顯示,只有知道密碼才能查看或下載此文件。密碼是這個文件的內容,可以空格、可以中文;',
|
||||
'domainforproxy' => '會將https://xxxxx-my.sharepoint.com取代成這個值,在目標需要自己設定反代。會加上&Origindomain=原域名',
|
||||
'public_path' => '使用API長連結訪問時,顯示網路硬碟檔案的路徑,不設定時預設為根目錄;不能是private_path的上級(public看到的不能比private多,要麼看到的就不一樣)。',
|
||||
'public_path' => '使用API長連結訪問時,顯示網路硬碟檔案的路徑,不設定時預設為根目錄。',
|
||||
'sitename' => '網站的名稱',
|
||||
'Onedrive_ver' => 'Onedrive版本',
|
||||
],
|
||||
'ja' => [
|
||||
'admin' => 'パスワードを管理する、追加しない場合、ログインページは表示されず、ログインできません。',
|
||||
'adminloginpage' => '設定すると、ログインボタンとページが非表示になります。ログインを管理するためのページは\'?admin \'ではなく、\'?この設定の値\'。',
|
||||
'domain_path' => '複数のカスタムドメイン名を使用する場合、各ドメイン名に表示されるディレクトリを指定します。形式はa1.com:/dirto/path1|b1.com:/path2で、private_pathよりも優先されます。',
|
||||
'diskname' => '',
|
||||
'disktag' => '',
|
||||
'downloadencrypt' => '',
|
||||
'background' => '',
|
||||
'autoJumpFirstDisk' => '複数のディスクを使って、1を設定すると、自動的に最初のディスクにジャンプします。',
|
||||
'customScript' => '<script>は、すべてのページに存在します。例えば、httpを置いてhttpsをジャンプします。',
|
||||
'customCss' => '<style>は、<head>の一番後ろにあります。',
|
||||
'customTheme' => 'htmlフォーマットのテーマのurl',
|
||||
'referrer' => '',
|
||||
'domain_path' => '複数のドメイン名を使用する場合、ドメイン名ごとに見られるディレクトリを指定します。フォーマットはa1.com:/dirto/path1|b1.com:/path2。',
|
||||
'diskname' => 'このディスクの名前を表示したいですか?',
|
||||
'disktag' => '一つのラベルは保存配置に使い、複数のディスクはurlに表示されます。',
|
||||
'disableShowThumb' => '1を記入すると、「表示サムネイル」ボタンが隠れます。',
|
||||
'disableChangeTheme' => '1を記入すると、テーマ選択の切り替えが隠れます。',
|
||||
'downloadencrypt' => '0または1です。もし1なら、暗号化されたディレクトリ内のファイルはパスワードなしでダウンロードできます。',
|
||||
'background' => '背景にurlを設定します。',
|
||||
'backgroundm' => '携帯電話用の背景としてurlを設定します。',
|
||||
'theme' => 'テーマを選択します。',
|
||||
'timezone' => 'プリセットタイムゾーンを設定します。',
|
||||
'guestup_path' => 'マップベッドのパスを設定します。この値が設定されていない場合、ディレクトリの内容は通常ファイルにリストされ、設定後はアップロードインターフェイスのみが表示されます。',
|
||||
'hideFunctionalityFile' => '0または1です。もし1ならば、いくつかの書類はリストで観光客に見せませんが、その機能は正常です。readme.md',
|
||||
'passfile' => 'カスタムパスワードファイルの名前は、\'pppppp \'、\'aaaa.txt \'などの場合があります。ディレクトリをリストするときには表示されません。パスワードを知っている場合にのみ、このファイルを表示またはダウンロードできます。 パスワードはこのファイルの内容であり、スペースまたは漢字を使用できます。',
|
||||
'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり、private_pathの上位にはなりません(publicはprivate以上のものを見ることができません。それ以外は異なります。)。',
|
||||
'domainforproxy' => '会将https://xxxy-my.sharepoint.comこの値に代えて、目標には自分で反世代を設定する必要があります。に加えて&Originndomain=元のドメイン名',
|
||||
'public_path' => 'APIのロングリンクアクセスを使用する場合、ネットワークディスクファイルのパスが表示されますが、設定されていない場合はデフォルトでルートディレクトリになり。',
|
||||
'sitename' => 'ウェブサイト名',
|
||||
'Onedrive_ver' => 'Onedriveバージョン',
|
||||
],
|
||||
'ko-kr' => [
|
||||
'admin' => '비밀번호를 관리하고 로그인 페이지를 표시하지 않으며 추가하지 않으면 로그인 할 수 없습니다.',
|
||||
'adminloginpage' => '설정하면 로그인 버튼과 페이지가 숨겨집니다. 로그인 관리 페이지는 더 이상 \ ?Admin\'이 아니라 \ ?이 설정의 값 \'입니다.',
|
||||
'domain_path' => '여러 개의 사용자 정의 도메인 이름을 사용하는 경우 각 도메인 이름에 표시되는 디렉토리를 지정하십시오. 형식은 a1.com:/dirto/path1|b1.com:/path2이며 private_path보다 우선합니다.',
|
||||
'diskname' => '이 디스크에 어떤 이름을 표시 하시겠습니까?',
|
||||
'disktag' => '레이블은 구성을 저장하는 데 사용되며 디스크가 여러 개인 경우 URL에 표시됩니다.',
|
||||
'downloadencrypt' => '',
|
||||
'background' => 'URL을 배경으로 설정하거나 표시하는.',
|
||||
'guestup_path' => '방문자의 업로드 경로 (맵 베드 경로)를 설정합니다.이 값을 설정하지 않으면 디렉토리의 내용이 파일로 표시되고 설정 후에는 업로드 인터페이스 만 표시되고 파일은 표시되지 않습니다 (로그인 후 표시).',
|
||||
'passfile' => '사용자 정의 비밀번호 파일의 이름은 \'pppppp\' \'aaaa.txt \'등이 될 수 있으며 디렉토리가 나열되어 있으면 표시되지 않으며 비밀번호를 알고있는 경우에만이 파일을 보거나 다운로드 할 수 있습니다. 암호는이 파일의 내용이며 공백이거나 한국어 일 수 있습니다.',
|
||||
'autoJumpFirstDisk' => '여러 개의 디스크 에 사용 되 며, 1 이 되면 첫 번 째 디스크 로 자동 으로 이동 합 니 다.',
|
||||
'customScript' => '< script > 은 모든 페이지 에 존재 합 니 다. 예 를 들 어 http 을 하나 넣 고 https 로 이동 합 니 다.',
|
||||
'customCss' => '< 스타일 >, < 헤드 > 맨 뒤에',
|
||||
'customTheme' => 'html 형식의 테마 url',
|
||||
'referrer' => '',
|
||||
'domain_path' => '도 메 인 이름 을 여러 개 사용자 정의 할 때 도 메 인 이름 마다 보 이 는 디 렉 터 리 를 지정 합 니 다.형식 은 a1.com:/dirto/path1|b1.com:/path2.',
|
||||
'diskname' => '이 접시 에 당신 은 어떤 명칭 을 표시 하고 싶 습 니까?',
|
||||
'disktag' => '디스크가 여러 개인 경우 구성을 저장하는 데 사용되는 레이블이 url에 표시됩니다.',
|
||||
'disableShowThumb' => '1을 입력하면 “썸네일 표시”버튼이 숨겨집니다.',
|
||||
'disableChangeTheme' => '1이면 테마 선택 버튼이 표시되지 않습니다.',
|
||||
'downloadencrypt' => '0 또는 1 1이면 암호화 된 디렉토리의 파일을 암호없이 다운로드 할 수 있습니다.',
|
||||
'background' => 'URL을 배경으로 설정하십시오.',
|
||||
'backgroundm' => 'URL을 휴대폰의 배경으로 설정합니다.',
|
||||
'theme' => '주제를 선택하십시오.',
|
||||
'timezone' => '기본 시간대를 설정합니다.',
|
||||
'guestup_path' => '게스트 업로드 경로 (사진 침대 경로)를 설정합니다.이 값을 설정하지 않으면 디렉토리의 내용이 파일로 나열됩니다. 설정 후 업로드 인터페이스 만 표시되지 않습니다 (로그인 후 표시됨).',
|
||||
'hideFunctionalityFile' => '0 또는 1 1 인 경우 일부 파일이 관광객 용으로 나열되지 않지만 readme.md와 같은 기능은 정상입니다.',
|
||||
'passfile' => '사용자 지정 암호 파일의 이름은 \ “pppppp \”또는 \ “aaaa.txt \”등이 될 수 있습니다. 디렉터리가 나열 될 때 표시되지 않으며 암호를 알고있는 경우에만 파일을 보거나 다운로드 할 수 있습니다. 암호는이 파일의 내용이며 공백이거나 중국어 일 수 있습니다.',
|
||||
'domainforproxy' => 'https://xxxxx-my.sharepoint.com을이 값으로 바꾸고 대상에서 안티 생성을 설정해야합니다. & Origindomain = Original domain name 을 추가합니다.',
|
||||
'public_path' => 'API 긴 링크 액세스를 사용하는 경우 네트워크 디스크 파일의 경로가 표시됩니다. 설정되지 않은 경우 기본적으로 루트 디렉토리로 설정됩니다.',
|
||||
'sitename' => '웹 사이트 이름',
|
||||
'Onedrive_ver' => 'Onedrive 버전',
|
||||
],
|
||||
'fa' => [
|
||||
'admin' => 'رمز عبور ادمین، در صورت خالی بودن دکمه لاگین به نمایش در نمیآید',
|
||||
'adminloginpage' => 'در صورت تنظیم ، دکمه ورود نمایش داده نمی شود و صفحه ورود دیگر \?admin\ نیست بلکه \?{مقدار ورودی شما}\ است.',
|
||||
'referrer' => '',
|
||||
'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2',
|
||||
'diskname' => 'نام دیسک که میخواهید نشان دهید.',
|
||||
'disktag' => 'تگی که در ذخیره پیکربندی و نشانی اینترنتی استفاده میشود.',
|
||||
@@ -191,7 +230,31 @@ $constStr = [
|
||||
'passfile' => 'رمز عبور dir در این فایل ذخیره می شود.',
|
||||
'public_path' => 'این مسیر Onedrive را هنگامی که از طریق آدرس طولانی API Gateway استفاده می کنید ، نشان دهید. فایل های نمایش عمومی کمتر از خصوصی.',
|
||||
'sitename' => 'نام سایت',
|
||||
'Onedrive_ver' => 'ورژن Onedrive',
|
||||
],
|
||||
'ar-sa' => [
|
||||
'admin' => ' إدارة كلمة السر ، لا يمكنك عرض صفحة تسجيل الدخول دون إضافة',
|
||||
'adminloginpage' => 'إذا كان الإعداد ، زر تسجيل الدخول و الصفحة المخفية إدارة صفحة تسجيل الدخول لم تعد قيمة هذا الإعداد ؟',
|
||||
'autoJumpFirstDisk' => 'على أقراص متعددة ، إذا كان واحد ، ثم الانتقال تلقائيا إلى القرص الأول',
|
||||
'customScript' => 'في جميع الصفحات ، على سبيل المثال ، وضع النص المتشعب القفز HTTPS',
|
||||
'customCss' => '<style>,في الجزء الخلفي من',
|
||||
'customTheme' => 'أتش تي أم أل شكل عنوان الموضوع',
|
||||
'referrer' => '',
|
||||
'domain_path' => 'عند استخدام العديد من أسماء النطاقات المخصصة ، حدد الدليل الذي يرى كل اسم النطاق هذا هو القانون ؛ بات اولا',
|
||||
'diskname' => 'ما اسم هذا القرص الذي تريد أن تظهر ؟',
|
||||
'disktag' => 'العلامة التي تستخدم لحفظ التكوين ، يتم عرضها في عناوين المواقع عند تعدد الأقراص',
|
||||
'disableShowThumb' => 'إذا كنت ملء ، زر عرض الاختصارات سوف تكون مخفية',
|
||||
'disableChangeTheme' => 'إذا كان واحد ، لا يتم عرض زر اختيار الموضوع',
|
||||
'downloadencrypt' => 'أو واحد إذا كان واحد ، ثم تشفير الملفات في الدليل يمكن تحميلها بدون كلمة السر',
|
||||
'background' => 'وضع رابط كخلفية',
|
||||
'backgroundm' => 'وضع رابط كخلفية على الهاتف',
|
||||
'theme' => 'اختر موضوع واحد',
|
||||
'timezone' => 'تعيين المنطقة الزمنية الافتراضية',
|
||||
'guestup_path' => 'إذا كنت لا تضع هذه القيمة ، محتويات الدليل سوف تظهر بشكل صحيح ، فقط واجهة تحميل بعد الإعداد ، لا تظهر الملفات بعد تسجيل الدخول.',
|
||||
'hideFunctionalityFile' => 'أو واحد إذا كان واحد ، بعض الملفات لا تظهر في قائمة الزوار ، ولكن وظيفتها هي طبيعية ، مثل قراءة',
|
||||
'passfile' => 'يمكنك تحديد اسم ملف كلمة السر الخاصة بك ؟ النص انتظر ، لا تظهر في الكتالوج إلا إذا كنت تعرف كلمة السر ، يمكنك عرض أو تحميل هذا الملف كلمة السر هي محتوى هذه الوثيقة ، يمكنك الفضاء ، يمكنك الصينية ؛',
|
||||
'domainforproxy' => 'سوف لا شيء استبدال هذه القيمة ، تحتاج إلى تعيين جيل معاكس في الهدف الخاص بك إضافة اسم النطاق الأصلي',
|
||||
'public_path' => 'عند استخدام API وصلة طويلة للوصول إلى عرض مسار الملف على القرص ، إذا لم يتم تعيين الافتراضي هو الجذر ، لا يمكن أن يكون private ش لا يمكن أن نرى أكثر من private publics ، أو لا',
|
||||
'sitename' => 'اسم الموقع',
|
||||
],
|
||||
],
|
||||
'SetSecretsFirst' => [
|
||||
@@ -201,6 +264,7 @@ $constStr = [
|
||||
'ja' => '最初に環境変数にAPIを設定してください!',
|
||||
'ko-kr' => '먼저 환경 변수에서 API를 설정하십시오! 또는 다시 설치하십시오.',
|
||||
'fa' => 'ابتدا API را در پیکربندی تنظیم کنید! یا دوباره نصب کنید.',
|
||||
'ar-sa' => 'وضع المعهد في بيئة متغيرة أو أعد التحميل',
|
||||
],
|
||||
'RefreshtoLogin' => [
|
||||
'en-us' => '<font color="red">Refresh</font> and login.',
|
||||
@@ -209,6 +273,7 @@ $constStr = [
|
||||
'ja' => 'ページを<font color = "red">更新</font>して、再度ログインしてください',
|
||||
'ko-kr' => '페이지를 <font color = "red"> 새로 고침 </ font> 하시고 다시 로그인하십시오',
|
||||
'fa' => '<font color="red">رفرش</font> و لاگین.',
|
||||
'ar-sa' => 'الرجاء إعادة تسجيل الدخول بعد تحديث الصفحة',
|
||||
],
|
||||
'AdminLogin' => [
|
||||
'en-us' => 'Admin Login',
|
||||
@@ -217,6 +282,7 @@ $constStr = [
|
||||
'ja' => 'ログインを管理する',
|
||||
'ko-kr' => '로그인 관리',
|
||||
'fa' => 'ورود ادمین',
|
||||
'ar-sa' => 'إدارة تسجيل الدخول',
|
||||
],
|
||||
'LoginSuccess' => [
|
||||
'en-us' => 'Login Success!',
|
||||
@@ -225,6 +291,7 @@ $constStr = [
|
||||
'ja' => 'ログイン成功、ジャンプ',
|
||||
'ko-kr' => '로그인 성공, 점프',
|
||||
'fa' => 'ورود با موفقیت انجام شد!',
|
||||
'ar-sa' => 'تسجيل الدخول بنجاح ، القفز',
|
||||
],
|
||||
'InputPassword' => [
|
||||
'en-us' => 'Input Password',
|
||||
@@ -233,6 +300,7 @@ $constStr = [
|
||||
'ja' => 'パスワードを入力してください',
|
||||
'ko-kr' => '비밀번호 입력',
|
||||
'fa' => 'رمز عبور را وارد کنید',
|
||||
'ar-sa' => 'أدخل كلمة المرور',
|
||||
],
|
||||
'Login' => [
|
||||
'en-us' => 'Login',
|
||||
@@ -241,6 +309,7 @@ $constStr = [
|
||||
'ja' => 'サインイン',
|
||||
'ko-kr' => '로그인',
|
||||
'fa' => 'ورود',
|
||||
'ar-sa' => 'تسجيل الدخول',
|
||||
],
|
||||
'Encrypt' => [
|
||||
'en-us' => 'Encrypt',
|
||||
@@ -249,14 +318,16 @@ $constStr = [
|
||||
'ja' => '暗号化',
|
||||
'ko-kr' => '암호화',
|
||||
'fa' => 'رمزگذاری',
|
||||
'ar-sa' => 'مشفر',
|
||||
],
|
||||
'SetpassfileBfEncrypt' => [
|
||||
'en-us' => 'Set \'passfile\' in Environments before encrypt',
|
||||
'zh-cn' => '先在环境变量设置passfile才能加密',
|
||||
'zh-tw' => '先在環境變數設定passfile才能加密',
|
||||
'ja' => '最初に暗号化する環境変数にパスファイルを設定します',
|
||||
'zh-cn' => '先设置passfile才能加密',
|
||||
'zh-tw' => '先設定passfile才能加密',
|
||||
'ja' => '最初に暗号化する変数にパスファイルを設定します',
|
||||
'ko-kr' => '암호화하기 전에 환경 변수에 패스 파일을 설정하십시오',
|
||||
'fa' => 'قبل از رمزگذاری \"passfile \" را در محیط تنظیم کنید',
|
||||
'ar-sa' => 'أولا تعيين متغير البيئة passfile لتشفير',
|
||||
],
|
||||
'updateProgram' => [
|
||||
'en-us' => 'Update Program',
|
||||
@@ -265,6 +336,7 @@ $constStr = [
|
||||
'ja' => 'ワンクリック更新',
|
||||
'ko-kr' => '원 클릭 업데이트',
|
||||
'fa' => 'برنامه را به روز کنید',
|
||||
'ar-sa' => 'تحديث',
|
||||
],
|
||||
'UpdateSuccess' => [
|
||||
'en-us' => 'Program update Success!',
|
||||
@@ -273,6 +345,7 @@ $constStr = [
|
||||
'ja' => 'プログラムのアップグレードに成功しました!',
|
||||
'ko-kr' => '프로그램 업그레이드 성공!',
|
||||
'fa' => 'موفقیت به روز رسانی برنامه!',
|
||||
'ar-sa' => 'ترقية البرنامج بنجاح',
|
||||
],
|
||||
'Setup' => [
|
||||
'en-us' => 'Setup',
|
||||
@@ -281,6 +354,7 @@ $constStr = [
|
||||
'ja' => '設定する',
|
||||
'ko-kr' => '설정',
|
||||
'fa' => 'نصب',
|
||||
'ar-sa' => 'إعداد',
|
||||
],
|
||||
'Back' => [
|
||||
'en-us' => 'Back',
|
||||
@@ -289,11 +363,16 @@ $constStr = [
|
||||
'ja' => 'back',
|
||||
'ko-kr' => '돌아 가기',
|
||||
'fa' => 'بازگشت',
|
||||
'ar-sa' => 'رجع',
|
||||
],
|
||||
'Theme' => [
|
||||
'en-us' => 'Theme',
|
||||
'zh-cn' => '主题',
|
||||
'zh-tw' => '主題',
|
||||
'ja' => 'テーマ',
|
||||
'ko-kr' => '주제.',
|
||||
'fa' => 'عنوان',
|
||||
'ar-sa' => 'الثيمات',
|
||||
],
|
||||
'NotNeedUpdate' => [
|
||||
'en-us' => 'Not Need Update',
|
||||
@@ -302,6 +381,7 @@ $constStr = [
|
||||
'ja' => '更新不要',
|
||||
'ko-kr' => '업데이트가 필요하지 않습니다',
|
||||
'fa' => 'آپدیت لازم نیست',
|
||||
'ar-sa' => 'لا تحتاج إلى تحديث',
|
||||
],
|
||||
'PlatformConfig' => [
|
||||
'en-us' => 'Platform Config',
|
||||
@@ -310,6 +390,17 @@ $constStr = [
|
||||
'ja' => 'プラットフォーム変数',
|
||||
'ko-kr' => '플랫폼 변수',
|
||||
'fa' => 'پیکربندی پلتفرم',
|
||||
'ar-sa' => 'منصة متغير',
|
||||
],
|
||||
'DragSort' => [
|
||||
'en-us' => 'Drag to Sort Disk',
|
||||
'zh-cn' => '拖拽改变顺序',
|
||||
'zh-tw' => '拖曳改變順序',
|
||||
],
|
||||
'SubmitSortdisks' => [
|
||||
'en-us' => 'Submit Sort',
|
||||
'zh-cn' => '确认排序',
|
||||
'zh-tw' => '確認排序',
|
||||
],
|
||||
'DelDisk' => [
|
||||
'en-us' => 'Del This Disk',
|
||||
@@ -318,14 +409,30 @@ $constStr = [
|
||||
'ja' => 'このディスクを削除',
|
||||
'ko-kr' => '이 디스크를 삭제',
|
||||
'fa' => 'پاک کردن این دیسک',
|
||||
'ar-sa' => 'حذف هذا القرص',
|
||||
],
|
||||
'CopyDisk' => [
|
||||
'en-us' => 'Copy this Disk',
|
||||
'zh-cn' => '复制此盘',
|
||||
],
|
||||
'RenameDisk' => [
|
||||
'en-us' => 'Rename Disk Tag',
|
||||
'zh-cn' => '改变标签',
|
||||
'zh-tw' => '修改標籤',
|
||||
'ar-sa' => 'تغيير التسمية',
|
||||
],
|
||||
'ChangeDrivetype' => [
|
||||
'en-us' => 'Change',
|
||||
'zh-cn' => '切换',
|
||||
],
|
||||
'AddDisk' => [
|
||||
'en-us' => 'Add Onedrive Disk',
|
||||
'zh-cn' => '添加Onedrive盘',
|
||||
'zh-tw' => '添加Onedrive盤',
|
||||
'ja' => 'Onedriveを追加',
|
||||
'ko-kr' => 'Onedrive 추가',
|
||||
'fa' => 'اضافه کردن دیسک Onedrive',
|
||||
'en-us' => 'Add Disk',
|
||||
'zh-cn' => '添加盘',
|
||||
'zh-tw' => '新增盤',
|
||||
'ja' => 'を追加',
|
||||
'ko-kr' => '추가',
|
||||
'fa' => 'اضافه کردن دیسک ',
|
||||
'ar-sa' => 'إضافة قرص',
|
||||
],
|
||||
'Home' => [
|
||||
'en-us' => 'Home',
|
||||
@@ -334,16 +441,25 @@ $constStr = [
|
||||
'ja' => 'ホーム',
|
||||
'ko-kr' => '홈',
|
||||
'fa' => 'خانه',
|
||||
'ar-sa' => 'فرونت بيج',
|
||||
],
|
||||
'Preview' => [
|
||||
'en-us' => 'Preview',
|
||||
'zh-cn' => '预览',
|
||||
'zh-tw' => '預覽',
|
||||
'ja' => 'プレビュー',
|
||||
'ko-kr' => '미리보기',
|
||||
'fa' => 'پیشنمایش',
|
||||
'ar-sa' => 'معاينة',
|
||||
],
|
||||
'List' => [
|
||||
'en-us' => 'List',
|
||||
'zh-cn' => '列表',
|
||||
'zh-tw' => '列表',
|
||||
'ja' => 'リスト',
|
||||
'ko-kr' => '리스트',
|
||||
'fa' => 'فهرست',
|
||||
'ar-sa' => 'الليست',
|
||||
],
|
||||
'NeedUpdate' => [
|
||||
'en-us' => 'Program can update<br>Click setup in Operate at top.',
|
||||
@@ -352,6 +468,7 @@ $constStr = [
|
||||
'ja' => 'プログラムをアップグレードできます<br>上記の管理メニューで<br>アップグレードする設定ページに入ります',
|
||||
'ko-kr' => '프로그램을 업그레이드 할 수 있습니다. <br> 위의 관리 메뉴에서 <br> 업그레이드 할 설정 페이지를 입력하십시오.',
|
||||
'fa' => 'برنامه می تواند آپدیت شود<br>روی گزینه نصب در بالای صفحه کلیک کنید.',
|
||||
'ar-sa' => 'يمكن ترقية البرنامج في القائمة أعلاه إدارة',
|
||||
],
|
||||
'Operate' => [
|
||||
'en-us' => 'Operate',
|
||||
@@ -360,14 +477,16 @@ $constStr = [
|
||||
'ja' => '管理',
|
||||
'ko-kr' => '관리',
|
||||
'fa' => 'مدیریت',
|
||||
'ar-sa' => 'الإدارة',
|
||||
],
|
||||
'Logout' => [
|
||||
'en-us' => 'Logout',
|
||||
'zh-cn' => '登出',
|
||||
'zh-cn' => '退出',
|
||||
'zh-tw' => '登出',
|
||||
'ja' => 'ログアウトする',
|
||||
'ko-kr' => '로그 아웃',
|
||||
'fa' => 'خروج',
|
||||
'ar-sa' => 'انسحب',
|
||||
],
|
||||
'Create' => [
|
||||
'en-us' => 'Create',
|
||||
@@ -376,6 +495,7 @@ $constStr = [
|
||||
'ja' => '新しい',
|
||||
'ko-kr' => '새로운',
|
||||
'fa' => 'ایجاد کردن',
|
||||
'ar-sa' => 'بنيت حديثا',
|
||||
],
|
||||
'Download' => [
|
||||
'en-us' => 'download',
|
||||
@@ -384,6 +504,7 @@ $constStr = [
|
||||
'ja' => 'ダウンロードする',
|
||||
'ko-kr' => '다운로드',
|
||||
'fa' => 'دانلود',
|
||||
'ar-sa' => 'داون لود',
|
||||
],
|
||||
'ClicktoEdit' => [
|
||||
'en-us' => 'Click to edit',
|
||||
@@ -392,6 +513,7 @@ $constStr = [
|
||||
'ja' => 'クリック後に編集',
|
||||
'ko-kr' => '클릭 후 편집',
|
||||
'fa' => 'برای ویرایش کلیک کنید',
|
||||
'ar-sa' => 'انقر فوق تحرير',
|
||||
],
|
||||
'Save' => [
|
||||
'en-us' => 'Save',
|
||||
@@ -400,6 +522,7 @@ $constStr = [
|
||||
'ja' => '保存する',
|
||||
'ko-kr' => '저장',
|
||||
'fa' => 'ذخیره',
|
||||
'ar-sa' => 'حفظ',
|
||||
],
|
||||
'FileNotSupport' => [
|
||||
'en-us' => 'File not support preview.',
|
||||
@@ -408,6 +531,7 @@ $constStr = [
|
||||
'ja' => 'ファイル形式はプレビューをサポートしていません',
|
||||
'ko-kr' => '파일 형식은 미리보기를 지원하지 않습니다',
|
||||
'fa' => 'پیش نمایش برای این فایل پشتیبانی نمی شود.',
|
||||
'ar-sa' => 'معاينة الملف غير معتمد',
|
||||
],
|
||||
'File' => [
|
||||
'en-us' => 'File',
|
||||
@@ -416,6 +540,7 @@ $constStr = [
|
||||
'ja' => 'ファイル',
|
||||
'ko-kr' => '파일',
|
||||
'fa' => 'فایل',
|
||||
'ar-sa' => 'فايل',
|
||||
],
|
||||
'ShowThumbnails' => [
|
||||
'en-us' => 'Thumbnails',
|
||||
@@ -424,11 +549,16 @@ $constStr = [
|
||||
'ja' => '画像のサムネイル',
|
||||
'ko-kr' => '사진 섬네일',
|
||||
'fa' => 'تصویر بندانگشتی',
|
||||
'ar-sa' => 'تجاهل الصورة',
|
||||
],
|
||||
'OriginalPic' => [
|
||||
'en-us' => 'OriginalPic',
|
||||
'zh-cn' => '原图',
|
||||
'zh-tw' => '原圖',
|
||||
'ja' => '原図',
|
||||
'ko-kr' => '원 도',
|
||||
'fa' => 'تصویر اصلی',
|
||||
'ar-sa' => 'الصورة الأصلية',
|
||||
],
|
||||
'CopyAllDownloadUrl' => [
|
||||
'en-us' => 'CopyAllDownloadUrl',
|
||||
@@ -437,11 +567,16 @@ $constStr = [
|
||||
'ja' => 'すべてのダウンロードリンクをコピー',
|
||||
'ko-kr' => '모든 다운로드 링크 복사',
|
||||
'fa' => 'کپی از تمام لینک ها',
|
||||
'ar-sa' => 'نسخ جميع روابط التحميل',
|
||||
],
|
||||
'Search' => [
|
||||
'en-us' => 'Search',
|
||||
'zh-cn' => '搜索',
|
||||
'zh-tw' => '搜尋',
|
||||
'ja' => '検索',
|
||||
'ko-kr' => '수색 하 다.',
|
||||
'fa' => 'جستجو',
|
||||
'ar-sa' => 'بحث',
|
||||
],
|
||||
'EditTime' => [
|
||||
'en-us' => 'EditTime',
|
||||
@@ -450,6 +585,7 @@ $constStr = [
|
||||
'ja' => '変更時間',
|
||||
'ko-kr' => '수정 시간',
|
||||
'fa' => 'زمان ویرایش',
|
||||
'ar-sa' => 'تعديل الوقت',
|
||||
],
|
||||
'Size' => [
|
||||
'en-us' => 'Size',
|
||||
@@ -458,6 +594,7 @@ $constStr = [
|
||||
'ja' => 'サイズ ',
|
||||
'ko-kr' => '사이즈',
|
||||
'fa' => 'سایز',
|
||||
'ar-sa' => 'مقاس',
|
||||
],
|
||||
'Rename' => [
|
||||
'en-us' => 'Rename',
|
||||
@@ -466,6 +603,7 @@ $constStr = [
|
||||
'ja' => '名前を変更',
|
||||
'ko-kr' => '이름 바꾸기',
|
||||
'fa' => 'تغییر نام',
|
||||
'ar-sa' => 'إعادة تسمية',
|
||||
],
|
||||
'Move' => [
|
||||
'en-us' => 'Move',
|
||||
@@ -474,6 +612,7 @@ $constStr = [
|
||||
'ja' => '移動する',
|
||||
'ko-kr' => '이동',
|
||||
'fa' => 'انتقال',
|
||||
'ar-sa' => 'تحرك',
|
||||
],
|
||||
'Copy' => [
|
||||
'en-us' => 'Copy',
|
||||
@@ -482,6 +621,7 @@ $constStr = [
|
||||
'ja' => 'コピー',
|
||||
'ko-kr' => '복사',
|
||||
'fa' => 'کپی',
|
||||
'ar-sa' => 'نسخ',
|
||||
],
|
||||
'CannotMove' => [
|
||||
'en-us' => 'Can not Move!',
|
||||
@@ -490,6 +630,7 @@ $constStr = [
|
||||
'ja' => '動かない!',
|
||||
'ko-kr' => '움직일 수 없어!',
|
||||
'fa' => 'نمیتواند منتقل شود!',
|
||||
'ar-sa' => 'لا تتحرك',
|
||||
],
|
||||
'Delete' => [
|
||||
'en-us' => 'Delete',
|
||||
@@ -498,6 +639,7 @@ $constStr = [
|
||||
'ja' => '削除する',
|
||||
'ko-kr' => '삭제',
|
||||
'fa' => 'حذف کردن',
|
||||
'ar-sa' => 'حذف',
|
||||
],
|
||||
'PrePage' => [
|
||||
'en-us' => 'PrePage',
|
||||
@@ -506,6 +648,7 @@ $constStr = [
|
||||
'ja' => '前へ',
|
||||
'ko-kr' => '이전',
|
||||
'fa' => 'صفحه قبل',
|
||||
'ar-sa' => 'الصفحة السابقة',
|
||||
],
|
||||
'NextPage' => [
|
||||
'en-us' => 'NextPage',
|
||||
@@ -514,6 +657,7 @@ $constStr = [
|
||||
'ja' => '次のページ',
|
||||
'ko-kr' => '다음 페이지',
|
||||
'fa' => 'صفحه بعد',
|
||||
'ar-sa' => 'الصفحة التالية',
|
||||
],
|
||||
'Upload' => [
|
||||
'en-us' => 'Upload',
|
||||
@@ -522,16 +666,25 @@ $constStr = [
|
||||
'ja' => 'アップロードする',
|
||||
'ko-kr' => '업로드',
|
||||
'fa' => 'آپلود',
|
||||
'ar-sa' => 'ابلود',
|
||||
],
|
||||
'UploadFile' => [
|
||||
'en-us' => 'Upload File(s)',
|
||||
'zh-cn' => '上传文件',
|
||||
'zh-tw' => '上傳文件',
|
||||
'ja' => 'ファイルをアップロード',
|
||||
'ko-kr' => '문건 을 업로드 하 다',
|
||||
'fa' => 'بارگذاری پرونده',
|
||||
'ar-sa' => 'تحميل الملف',
|
||||
],
|
||||
'UploadFolder' => [
|
||||
'en-us' => 'Upload Folder',
|
||||
'zh-cn' => '上传文件夹',
|
||||
'zh-tw' => '上傳資料夾',
|
||||
'ja' => 'フォルダをアップロード',
|
||||
'ko-kr' => '폴 더 업로드',
|
||||
'fa' => 'بارگذاری پوشه',
|
||||
'ar-sa' => 'تحميل ملف',
|
||||
],
|
||||
'FileSelected' => [
|
||||
'en-us' => 'Select File',
|
||||
@@ -540,6 +693,7 @@ $constStr = [
|
||||
'ja' => 'ファイルを選択',
|
||||
'ko-kr' => '파일 선택',
|
||||
'fa' => 'انتخاب فایل',
|
||||
'ar-sa' => 'اختر ملف',
|
||||
],
|
||||
'NoFileSelected' => [
|
||||
'en-us' => 'Not Select File',
|
||||
@@ -548,6 +702,7 @@ $constStr = [
|
||||
'ja' => 'ファイルが選択されていません',
|
||||
'ko-kr' => '선택된 파일이 없습니다',
|
||||
'fa' => 'فایل را انتخاب نکنید',
|
||||
'ar-sa' => 'لا يوجد ملف محدد',
|
||||
],
|
||||
'Submit' => [
|
||||
'en-us' => 'Submit',
|
||||
@@ -556,6 +711,7 @@ $constStr = [
|
||||
'ja' => '確認する',
|
||||
'ko-kr' => '확인',
|
||||
'fa' => 'ارسال',
|
||||
'ar-sa' => 'أكد',
|
||||
],
|
||||
'Close' => [
|
||||
'en-us' => 'Close',
|
||||
@@ -564,6 +720,7 @@ $constStr = [
|
||||
'ja' => '閉じる',
|
||||
'ko-kr' => '닫기',
|
||||
'fa' => 'بستن',
|
||||
'ar-sa' => 'مغلق',
|
||||
],
|
||||
'InputPasswordUWant' => [
|
||||
'en-us' => 'Input Password you Want',
|
||||
@@ -572,6 +729,7 @@ $constStr = [
|
||||
'ja' => '設定するパスワードを入力してください',
|
||||
'ko-kr' => '설정하려는 비밀번호를 입력하십시오',
|
||||
'fa' => 'پسورد خود را وارد کنید',
|
||||
'ar-sa' => 'أدخل كلمة السر التي تريد تعيين',
|
||||
],
|
||||
'ParentDir' => [
|
||||
'en-us' => 'Parent Dir',
|
||||
@@ -580,6 +738,7 @@ $constStr = [
|
||||
'ja' => '親ディレクトリ',
|
||||
'ko-kr' => '부모 디렉토리',
|
||||
'fa' => 'مسیر',
|
||||
'ar-sa' => 'الدليل السابق',
|
||||
],
|
||||
'Folder' => [
|
||||
'en-us' => 'Folder',
|
||||
@@ -588,6 +747,7 @@ $constStr = [
|
||||
'ja' => 'フォルダー',
|
||||
'ko-kr' => '폴더',
|
||||
'fa' => 'پوشه',
|
||||
'ar-sa' => 'فولدر',
|
||||
],
|
||||
'Name' => [
|
||||
'en-us' => 'Name',
|
||||
@@ -596,6 +756,7 @@ $constStr = [
|
||||
'ja' => '名前',
|
||||
'ko-kr' => '이름',
|
||||
'fa' => 'نام',
|
||||
'ar-sa' => 'إسم',
|
||||
],
|
||||
'Content' => [
|
||||
'en-us' => 'Content',
|
||||
@@ -604,6 +765,7 @@ $constStr = [
|
||||
'ja' => '内容',
|
||||
'ko-kr' => '내용',
|
||||
'fa' => 'محتوا',
|
||||
'ar-sa' => 'المحتويات',
|
||||
],
|
||||
'CancelEdit' => [
|
||||
'en-us' => 'Cancel Edit',
|
||||
@@ -612,6 +774,7 @@ $constStr = [
|
||||
'ja' => '編集をキャンセル',
|
||||
'ko-kr' => '편집 취소',
|
||||
'fa' => 'لغو ویرایش',
|
||||
'ar-sa' => 'إلغاء تحرير',
|
||||
],
|
||||
'GetFileNameFail' => [
|
||||
'en-us' => 'Fail to Get File Name!',
|
||||
@@ -620,6 +783,7 @@ $constStr = [
|
||||
'ja' => 'ファイル名を取得できませんでした!',
|
||||
'ko-kr' => '파일 이름을 가져 오지 못했습니다!',
|
||||
'fa' => 'نام فایل به دست نیامد!',
|
||||
'ar-sa' => 'فشل الحصول على اسم الملف',
|
||||
],
|
||||
'GetUploadLink' => [
|
||||
'en-us' => 'Get Upload Link',
|
||||
@@ -628,11 +792,16 @@ $constStr = [
|
||||
'ja' => 'アップロードリンクを取得',
|
||||
'ko-kr' => '업로드 링크 받기',
|
||||
'fa' => 'دریافت لینک آپلود',
|
||||
'ar-sa' => 'الحصول على رابط التحميل',
|
||||
],
|
||||
'Calculate' => [
|
||||
'en-us' => 'Calculate',
|
||||
'zh-cn' => '计算',
|
||||
'zh-tw' => '計算',
|
||||
'ja' => '計算する',
|
||||
'ko-kr' => '계산 하 다.',
|
||||
'fa' => 'محاسبه',
|
||||
'ar-sa' => 'محسوب',
|
||||
],
|
||||
'UpFileTooLarge' => [
|
||||
'en-us' => 'The File is too Large!',
|
||||
@@ -641,6 +810,7 @@ $constStr = [
|
||||
'ja' => '超えると、アップロードは終了します。',
|
||||
'ko-kr' => '파일이 너무 커서 업로드가 종료되었습니다.',
|
||||
'fa' => 'فایل خیلی بزرگ است!',
|
||||
'ar-sa' => 'الملف كبير جدا ، إنهاء التحميل',
|
||||
],
|
||||
'UploadStart' => [
|
||||
'en-us' => 'Upload Start',
|
||||
@@ -649,6 +819,7 @@ $constStr = [
|
||||
'ja' => 'アップロードを開始',
|
||||
'ko-kr' => '업로드 시작',
|
||||
'fa' => 'شروع آپلود',
|
||||
'ar-sa' => 'بدء التحميل',
|
||||
],
|
||||
'UploadStartAt' => [
|
||||
'en-us' => 'Start At',
|
||||
@@ -657,6 +828,7 @@ $constStr = [
|
||||
'ja' => 'で開始',
|
||||
'ko-kr' => '에서 시작',
|
||||
'fa' => 'شروع از',
|
||||
'ar-sa' => 'تبدأ في',
|
||||
],
|
||||
'ThisTime' => [
|
||||
'en-us' => 'This Time',
|
||||
@@ -665,6 +837,7 @@ $constStr = [
|
||||
'ja' => '今回は',
|
||||
'ko-kr' => '이번에는',
|
||||
'fa' => 'این زمان',
|
||||
'ar-sa' => 'هذه المرة',
|
||||
],
|
||||
'LastUpload' => [
|
||||
'en-us' => 'Last time Upload',
|
||||
@@ -673,6 +846,7 @@ $constStr = [
|
||||
'ja' => '上回は',
|
||||
'ko-kr' => '마지막 업로드',
|
||||
'fa' => 'آخرین زمان آپلود',
|
||||
'ar-sa' => 'آخر تحميل',
|
||||
],
|
||||
'AverageSpeed' => [
|
||||
'en-us' => 'AverageSpeed',
|
||||
@@ -681,6 +855,7 @@ $constStr = [
|
||||
'ja' => '平均速度',
|
||||
'ko-kr' => '평균 속도',
|
||||
'fa' => 'میانگین سرعت',
|
||||
'ar-sa' => 'متوسط السرعة',
|
||||
],
|
||||
'CurrentSpeed' => [
|
||||
'en-us' => 'CurrentSpeed',
|
||||
@@ -689,6 +864,7 @@ $constStr = [
|
||||
'ja' => 'インスタントスピード',
|
||||
'ko-kr' => '즉각적인 속도',
|
||||
'fa' => 'سرعت فعلی',
|
||||
'ar-sa' => 'سرعة فورية',
|
||||
],
|
||||
'Expect' => [
|
||||
'en-us' => 'Expect',
|
||||
@@ -697,6 +873,7 @@ $constStr = [
|
||||
'ja' => '期待される',
|
||||
'ko-kr' => '예상',
|
||||
'fa' => 'انتظار',
|
||||
'ar-sa' => 'ومن المتوقع أيضا',
|
||||
],
|
||||
'EndAt' => [
|
||||
'en-us' => 'End At',
|
||||
@@ -705,6 +882,7 @@ $constStr = [
|
||||
'ja' => 'で終了',
|
||||
'ko-kr' => '에 끝남',
|
||||
'fa' => 'پایان از',
|
||||
'ar-sa' => 'نهاية',
|
||||
],
|
||||
'UploadErrorUpAgain' => [
|
||||
'en-us' => 'Maybe error, do upload again.',
|
||||
@@ -713,6 +891,7 @@ $constStr = [
|
||||
'ja' => '間違っている可能性があります。もう一度アップロードしてください。',
|
||||
'ko-kr' => '잘못되었을 수 있습니다. 다시 업로드하십시오.',
|
||||
'fa' => 'خطا، دوباره آپلود کنید',
|
||||
'ar-sa' => 'قد تكون خاطئة ، إعادة تحميل',
|
||||
],
|
||||
'UploadComplete' => [
|
||||
'en-us' => 'Upload Complete',
|
||||
@@ -721,6 +900,7 @@ $constStr = [
|
||||
'ja' => 'アップロード完了',
|
||||
'ko-kr' => '업로드 완료',
|
||||
'fa' => 'آپلود با موفقیت انجام شد',
|
||||
'ar-sa' => 'تحميل كامل',
|
||||
],
|
||||
'UploadFail23' => [
|
||||
'en-us' => 'Upload Fail, contain #.',
|
||||
@@ -729,6 +909,7 @@ $constStr = [
|
||||
'ja' => 'ディレクトリまたはファイル名に#が含まれています。アップロードに失敗しました。',
|
||||
'ko-kr' => '디렉토리 또는 파일 이름에 #이 포함되어 있습니다. 업로드하지 못했습니다.',
|
||||
'fa' => 'بارگذاری ناموفق، حاوی #.',
|
||||
'ar-sa' => 'دليل أو اسم الملف يحتوي على تحميل فشلت',
|
||||
],
|
||||
'defaultSitename' => [
|
||||
'en-us' => 'OneManager',
|
||||
@@ -740,6 +921,7 @@ $constStr = [
|
||||
'ja' => 'refresh_tokenを保存しています!',
|
||||
'ko-kr' => 'refresh_token 저장 중!',
|
||||
'fa' => 'در حال ذخیره refresh_token!',
|
||||
'ar-sa' => 'حفظ refresh ش توكن',
|
||||
],
|
||||
'MayinEnv' => [
|
||||
'en-us' => 'The \'Drive_ver\' may in Config',
|
||||
@@ -748,6 +930,7 @@ $constStr = [
|
||||
'ja' => 'Drive_verは環境変数に書き込まれている必要があります',
|
||||
'ko-kr' => 'Drive_verが書き込まれている必要があります',
|
||||
'fa' => 'The \'Drive_ver\' may in Config',
|
||||
'ar-sa' => 'درايو يجب أن يكون مكتوب على',
|
||||
],
|
||||
'Wait' => [
|
||||
'en-us' => 'Wait',
|
||||
@@ -756,6 +939,7 @@ $constStr = [
|
||||
'ja' => 'ちょっと待って',
|
||||
'ko-kr' => '잠깐만',
|
||||
'fa' => 'منتظر بمانید',
|
||||
'ar-sa' => 'انتظر لحظة',
|
||||
],
|
||||
'WaitJumpIndex' => [
|
||||
'en-us' => 'Wait 5s jump to Home page',
|
||||
@@ -764,6 +948,7 @@ $constStr = [
|
||||
'ja' => '5秒待ってホームページにジャンプします',
|
||||
'ko-kr' => '5 초 동안 홈페이지로 이동',
|
||||
'fa' => '۵ دقیقه صبر کنید تا به صفحه نخست برگردید',
|
||||
'ar-sa' => 'انتظر 5S القفز إلى الصفحة الرئيسية',
|
||||
],
|
||||
'JumptoOffice' => [
|
||||
'en-us' => 'Login Office and Get a refresh_token',
|
||||
@@ -772,27 +957,34 @@ $constStr = [
|
||||
'ja' => 'Officeにジャンプしてログインし、refresh_tokenを取得します',
|
||||
'ko-kr' => '사무실로 이동하여 로그인하여 refresh_token을 받으십시오.',
|
||||
'fa' => 'وارد Office شوید و یک refresh_token دریافت کنید',
|
||||
'ar-sa' => 'Login Office and Get a refresh_token',
|
||||
],
|
||||
'OnedriveDiskTag' => [
|
||||
'en-us' => 'Onedrive Disk Tag',
|
||||
'zh-cn' => 'Onedrive 标签',
|
||||
'zh-tw' => 'Onedrive 標籤',
|
||||
'ja' => 'Onedriveタグ',
|
||||
'ko-kr' => 'Onedrive 태그',
|
||||
'fa' => 'برچسب دیسک Onedrive',
|
||||
'DiskTag' => [
|
||||
'en-us' => 'Disk Tag',
|
||||
'zh-cn' => '标签',
|
||||
'zh-tw' => '標籤',
|
||||
'ja' => 'タグ',
|
||||
'ko-kr' => '태그',
|
||||
'fa' => 'برچسب دیسک ',
|
||||
'ar-sa' => 'تاغ',
|
||||
],
|
||||
'OnedriveDiskName' => [
|
||||
'en-us' => 'Onedrive Showed Name',
|
||||
'zh-cn' => 'Onedrive 显示名称',
|
||||
'zh-tw' => 'Onedrive 顯示名稱',
|
||||
'ja' => 'Onedrive表示名',
|
||||
'ko-kr' => 'Onedrive 표시 이름',
|
||||
'fa' => 'نام نشان داده شده Onedrive',
|
||||
'DiskName' => [
|
||||
'en-us' => 'Showed Name',
|
||||
'zh-cn' => '显示名称',
|
||||
'zh-tw' => '顯示名稱',
|
||||
'ja' => '表示名',
|
||||
'ko-kr' => '표시 이름',
|
||||
'fa' => 'نام نشان داده شده ',
|
||||
'ar-sa' => 'عرض الاسم',
|
||||
],
|
||||
'DriveVerMS' => [
|
||||
'en-us' => 'Onedrive, Onedrive for business',
|
||||
'zh-cn' => '国际版(商业版与个人版)',
|
||||
'zh-tw' => '國際版(商業版與個人版)',
|
||||
'ja' => '国際版(商業版と個人版)',
|
||||
'ko-kr' => '국제 판 (상업 판 과 개인 판)',
|
||||
'fa' => 'International Edition (Business Edition and Personal Edition)',
|
||||
'ar-sa' => 'الأعمال التجارية الدولية الطبعة الطبعة الشخصية',
|
||||
],
|
||||
'DriveVerCN' => [
|
||||
'en-us' => 'Onedrive in China',
|
||||
@@ -801,6 +993,7 @@ $constStr = [
|
||||
'ja' => '中国のOnedrive',
|
||||
'ko-kr' => '중국 Onedrive',
|
||||
'fa' => 'Onedrive در چین',
|
||||
'ar-sa' => 'Onedrive النسخة الصينية',
|
||||
],
|
||||
'DriveVerShareurl' => [
|
||||
'en-us' => 'A share link of a folder',
|
||||
@@ -809,16 +1002,17 @@ $constStr = [
|
||||
],
|
||||
'UseShareLink' => [
|
||||
'en-us' => 'Share a folder in Onedrive (enable EDIT for everyone), input the link url below.',
|
||||
'zh-cn' => '对一个Onedrive文件夹共享,允许所有人编辑,然后将共享链接填在下方',
|
||||
'zh-cn' => '<font color="red">只有国际版能用,</font>对一个Onedrive文件夹共享,允许所有人编辑,然后将共享链接填在下方',
|
||||
'zh-tw' => '對一個Onedrive資料夾共享,允許所有人編輯,然後將共享連結填在下方',
|
||||
],
|
||||
'CustomIdSecret' => [
|
||||
'en-us' => 'Use custom client id & secret instead of OneManager default',
|
||||
'zh-cn' => '自己申请应用ID与机密,不用OneManager默认的',
|
||||
'zh-tw' => '自己申請應用ID與機密,不用OneManager預設的',
|
||||
'zh-cn' => '用自己申请的应用ID与机密,不用OneManager默认的',
|
||||
'zh-tw' => '用自己申請的應用ID與機密,不用OneManager預設的',
|
||||
'ja' => 'アプリケーションIDとシークレットを自分で申請する',
|
||||
'ko-kr' => '응용 프로그램 ID 및 비밀 신청',
|
||||
'fa' => 'به طور پیش فرض اما از شناسه برنامه و سکرت استفاده کنید',
|
||||
'ar-sa' => 'استخدام التطبيق الخاص بك معرف وسرية ، لا أحد مدير الافتراضية',
|
||||
],
|
||||
'GetSecretIDandKEY' => [
|
||||
'en-us' => 'Get custom client id & secret',
|
||||
@@ -826,6 +1020,7 @@ $constStr = [
|
||||
'zh-tw' => '申請應用ID與機密',
|
||||
'ja' => 'アプリケーションIDとシークレット',
|
||||
'fa' => 'دریافت شناسه برنامه و سکرت',
|
||||
'ar-sa' => 'تطبيق الهوية والسرية',
|
||||
],
|
||||
'UseSharepointInstead' => [
|
||||
'en-us' => 'Use space in Sharepoint website instead of Onedrive',
|
||||
@@ -847,6 +1042,7 @@ $constStr = [
|
||||
'ja' => 'タグは、文字で始まり、文字または数字で終わる必要があります。少なくとも2つ',
|
||||
'ko-kr' => '태그는 문자로 시작하고 문자 또는 숫자로 끝나야합니다 (2 이상).',
|
||||
'fa' => 'برچسب باید با یک حرف شروع شود، با یک حرف یا رقم پایان یابد و تنها میتواند حاوی حروف کوچک، ارقام و خط فاصله، حداقل ۲ حرف باشد!',
|
||||
'ar-sa' => 'التسمية يمكن أن تبدأ فقط مع الحروف ، وتنتهي مع الحروف أو الأرقام ، على الأقل',
|
||||
],
|
||||
'ClickInstall' => [
|
||||
'en-us' => 'Click to install the project',
|
||||
@@ -855,6 +1051,7 @@ $constStr = [
|
||||
'ja' => 'クリックしてインストールプロセスを開始します',
|
||||
'ko-kr' => '설치 과정을 시작하려면 클릭',
|
||||
'fa' => 'برای نصب پروژه کلیک کنید',
|
||||
'ar-sa' => 'انقر فوق بدء الإعداد',
|
||||
],
|
||||
'LogintoBind' => [
|
||||
'en-us' => 'then login and bind your onedrive in setup',
|
||||
@@ -863,6 +1060,7 @@ $constStr = [
|
||||
'ja' => '次に、ログインして、設定でonedriveをバインドします。',
|
||||
'ko-kr' => '그런 다음 로그인하여 onedrive를 설정에 바인딩하십시오.',
|
||||
'fa' => 'پس از آن وارد سیستم شوید و تنظیمات خود را در onedrive متصل کنید',
|
||||
'ar-sa' => 'ثم قم بتسجيل الدخول بعد ربط أحد السائقين في الإعدادات',
|
||||
],
|
||||
'MakesuerWriteable' => [
|
||||
'en-us' => 'Plase make sure the config.php is writeable. run writeable.sh.',
|
||||
@@ -871,24 +1069,34 @@ $constStr = [
|
||||
'ja' => 'config.phpが書き込み可能であることを確認してください。',
|
||||
'ko-kr' => 'config.php가 쓰기 가능한지 확인하십시오.',
|
||||
'fa' => 'اطمینان حاصل کنید که config.php قابل نوشتن است. writeable.sh را اجرا کنید.',
|
||||
'ar-sa' => 'أكد بي إتش بي قابل للكتابة',
|
||||
],
|
||||
'MakesuerRewriteOn' => [
|
||||
'en-us' => 'Plase make sure the RewriteEngine is On.',
|
||||
'zh-cn' => '确认重写(伪静态)功能启用。',
|
||||
'zh-tw' => '確認重寫(偽靜態)功能啟用。',
|
||||
'ja' => '書き換え(擬似静的)機能が有効になっていることを確認します。',
|
||||
'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오.',
|
||||
'en-us' => 'Plase make sure the RewriteEngine is On',
|
||||
'zh-cn' => '确认重写(伪静态)功能启用',
|
||||
'zh-tw' => '確認重寫(偽靜態)功能啟用',
|
||||
'ja' => '書き換え(擬似静的)機能が有効になっていることを確認します',
|
||||
'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오',
|
||||
'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.',
|
||||
'ar-sa' => 'يؤكد أن الكتابة يمكن أن تكون وظيفة شبه استاتي',
|
||||
],
|
||||
'CopyUrl' => [
|
||||
'en-us' => 'Copy URL',
|
||||
'zh-cn' => '复制链接',
|
||||
'zh-tw' => '複製連結',
|
||||
'ja' => 'リンクをコピー',
|
||||
'ko-kr' => '링크 복사',
|
||||
'fa' => 'کپی ارتباط',
|
||||
'ar-sa' => 'نسخ الرابط',
|
||||
],
|
||||
'Success' => [
|
||||
'en-us' => 'Success',
|
||||
'zh-cn' => '成功',
|
||||
'zh-tw' => '成功',
|
||||
'ja' => '成功',
|
||||
'ko-kr' => '성공 하 다.',
|
||||
'fa' => 'موفقیت',
|
||||
'ar-sa' => 'نجح',
|
||||
],
|
||||
'SetAdminPassword' => [
|
||||
'en-us' => 'Set Admin Password',
|
||||
@@ -902,6 +1110,7 @@ $constStr = [
|
||||
'ja' => 'リフレッシュ',
|
||||
'ko-kr' => '새로 고침',
|
||||
'fa' => 'رفرش',
|
||||
'ar-sa' => 'منعش',
|
||||
],
|
||||
'SelectLanguage' => [
|
||||
'en-us' => 'Select Language',
|
||||
@@ -910,6 +1119,7 @@ $constStr = [
|
||||
'ja' => '言語を選択してください',
|
||||
'ko-kr' => '언어를 선택하십시오',
|
||||
'fa' => 'زبان را انتخاب کنید',
|
||||
'ar-sa' => 'اختيار اللغة',
|
||||
],
|
||||
'RefreshCache' => [
|
||||
'en-us' => 'RefreshCache',
|
||||
@@ -918,6 +1128,7 @@ $constStr = [
|
||||
'ja' => 'キャッシュを再構築',
|
||||
'ko-kr' => '캐시 플러시',
|
||||
'fa' => 'رفرش cache',
|
||||
'ar-sa' => 'تحديث الكاش',
|
||||
],
|
||||
'CannotOneKeyUpate' => [
|
||||
'en-us' => 'Can not update by a click! run update.sh',
|
||||
@@ -935,8 +1146,8 @@ $constStr = [
|
||||
'zh-tw' => '配置儲存在環境變數',
|
||||
],
|
||||
'ONEMANAGER_CONFIG_SAVE_FILE' => [
|
||||
'en-us' => 'Config save in code file, may cause fee',
|
||||
'zh-cn' => '配置保存在代码文件中,可能产生费用',
|
||||
'en-us' => 'Config save in code file, may cause fee, please reinstall later',
|
||||
'zh-cn' => '配置保存在代码文件中,可能产生费用,切换后,请从头再安装一次。',
|
||||
'zh-tw' => '配置儲存在程式碼文件中,可能產生費用',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,869 @@
|
||||
<?php
|
||||
|
||||
class Aliyundrive {
|
||||
protected $access_token;
|
||||
protected $disktag;
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
//$this->auth_url = 'https://websv.aliyundrive.com/token/refresh';
|
||||
$this->auth_url = 'https://auth.aliyundrive.com/v2/account/token';
|
||||
$this->api_url = 'https://api.aliyundrive.com/v2';
|
||||
$this->driveId = getConfig('driveId', $tag);
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
}
|
||||
|
||||
public function isfine()
|
||||
{
|
||||
if (!$this->access_token) return false;
|
||||
else return true;
|
||||
}
|
||||
public function show_base_class()
|
||||
{
|
||||
return get_class();
|
||||
//$tmp[0] = get_class();
|
||||
//$tmp[1] = get_class($this);
|
||||
//return $tmp;
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return ['driveId'];
|
||||
}
|
||||
|
||||
public function list_files($path = '/')
|
||||
{
|
||||
|
||||
$files = $this->list_path($path);
|
||||
|
||||
return $this->files_format($files);
|
||||
}
|
||||
|
||||
protected function files_format($files)
|
||||
{
|
||||
//return $files;
|
||||
if ($files['type']=='file') {
|
||||
$tmp['type'] = 'file';
|
||||
$tmp['id'] = $files['file_id'];
|
||||
if (isset($files['name'])) $tmp['name'] = $files['name'];
|
||||
elseif (isset($files['file_name'])) $tmp['name'] = $files['file_name'];
|
||||
$tmp['time'] = $files['updated_at'];
|
||||
$tmp['size'] = $files['size'];
|
||||
$tmp['mime'] = $files['file']['mimeType'];
|
||||
$tmp['url'] = $files['download_url'];
|
||||
$tmp['content'] = $files['content'];
|
||||
if (isset($files['exist'])) $tmp['exist'] = $files['exist'];
|
||||
if (isset($files['rapid_upload'])) $tmp['rapid_upload'] = $files['rapid_upload'];
|
||||
} elseif ($files['type']=='folder'||isset($files['items'])) {
|
||||
$tmp['type'] = 'folder';
|
||||
$tmp['id'] = $files['file_id'];
|
||||
if (isset($files['name'])) $tmp['name'] = $files['name'];
|
||||
elseif (isset($files['file_name'])) $tmp['name'] = $files['file_name'];
|
||||
$tmp['time'] = $files['updated_at'];
|
||||
$tmp['size'] = $files['size'];
|
||||
//$tmp['page'] = $files['folder']['page'];
|
||||
foreach ($files['items'] as $file) {
|
||||
$filename = strtolower($file['name']);
|
||||
if ($file['type']=='file') {
|
||||
$tmp['list'][$filename]['type'] = 'file';
|
||||
$tmp['list'][$filename]['url'] = $file['download_url'];
|
||||
$tmp['list'][$filename]['mime'] = $file['file']['content_type'];
|
||||
} elseif ($file['type']=='folder') {
|
||||
$tmp['list'][$filename]['type'] = 'folder';
|
||||
}
|
||||
//$tmp['id'] = $file['parent_file_id'];
|
||||
$tmp['list'][$filename]['id'] = $file['file_id'];
|
||||
$tmp['list'][$filename]['name'] = $file['name'];
|
||||
$tmp['list'][$filename]['time'] = $file['updated_at'];
|
||||
$tmp['list'][$filename]['size'] = $file['size'];
|
||||
//$tmp['childcount']++;
|
||||
}
|
||||
} elseif (isset($files['code'])||isset($files['error'])) {
|
||||
return $files;
|
||||
}
|
||||
//error_log1(json_encode($tmp));
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
protected function list_path($path = '/')
|
||||
{
|
||||
global $exts;
|
||||
while (substr($path, -1)=='/') $path = substr($path, 0, -1);
|
||||
if ($path == '') $path = '/';
|
||||
if (!($files = getcache('path_' . $path, $this->disktag))) {
|
||||
if ($path == '/' || $path == '') {
|
||||
$files = $this->fileList('root');
|
||||
//error_log1('root_id' . $files['id']);
|
||||
$files['file_id'] = 'root';
|
||||
$files['type'] = 'folder';
|
||||
} else {
|
||||
$tmp = splitlast($path, '/');
|
||||
$parent_path = $tmp[0];
|
||||
$filename = urldecode($tmp[1]);
|
||||
$parent_folder = $this->list_path($parent_path);
|
||||
foreach ($parent_folder['items'] as $item) {
|
||||
if ($item['name']==$filename) {
|
||||
if ($item['type']=='folder') {
|
||||
$files = $this->fileList($item['file_id']);
|
||||
$files['type'] = 'folder';
|
||||
$files['file_id'] = $item['file_id'];
|
||||
$files['name'] = $item['name'];
|
||||
$files['time'] = $item['updated_at'];
|
||||
$files['size'] = $item['size'];
|
||||
} else $files = $item;
|
||||
}
|
||||
}
|
||||
//echo $files['name'];
|
||||
}
|
||||
if ($files['type']=='file') {
|
||||
if (in_array(strtolower(splitlast($files['name'],'.')[1]), $exts['txt'])) {
|
||||
if ($files['size']<1024*1024) {
|
||||
if (!(isset($files['content'])&&$files['content']['stat']==200)) {
|
||||
$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';
|
||||
$content1 = curl('GET', $files['download_url'], '', $header);
|
||||
$tmp = null;
|
||||
$tmp = json_decode(json_encode($content1), true);
|
||||
if ($tmp['body']===null) {
|
||||
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
|
||||
$tmp = json_decode(json_encode($tmp), true);
|
||||
if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
|
||||
}
|
||||
//error_log1('body : ' . $content1['body'] . PHP_EOL);
|
||||
$files['content'] = $content1;
|
||||
savecache('path_' . $path, $files, $this->disktag);
|
||||
}
|
||||
} else {
|
||||
$files['content']['stat'] = 202;
|
||||
$files['content']['body'] = 'File too large.';
|
||||
}
|
||||
//error_log1($files['name'] . ' : ' . json_encode($files['content']) . PHP_EOL);
|
||||
}
|
||||
}
|
||||
if (!$files) {
|
||||
$files['error']['code'] = 'Not Found';
|
||||
$files['error']['message'] = $path . ' Not Found';
|
||||
$files['error']['stat'] = 404;
|
||||
} elseif (isset($files['stat'])) {
|
||||
$files['error']['stat'] = $files['stat'];
|
||||
$files['error']['code'] = 'Error';
|
||||
$files['error']['message'] = $files['body'];
|
||||
unset($files['file_id']);
|
||||
unset($files['type']);
|
||||
} elseif (isset($files['code'])) {
|
||||
$files['error']['stat'] = 500;
|
||||
$files['error']['code'] = $files['code'];
|
||||
$files['error']['message'] = $files['message'];
|
||||
unset($files['file_id']);
|
||||
unset($files['type']);
|
||||
} else {
|
||||
savecache('path_' . $path, $files, $this->disktag, 600);
|
||||
}
|
||||
}
|
||||
//error_log1('path:' . $path . ', files:' . substr(json_encode($files), 0, 150));
|
||||
//error_log1('path:' . $path . ', files:' . json_encode($files));
|
||||
return $files;
|
||||
}
|
||||
|
||||
protected function fileGet($file_id)
|
||||
{
|
||||
$url = $this->api_url . '/file/get';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['file_id'] = $file_id;
|
||||
|
||||
$res = curl('POST', $url, json_encode($data), $header);
|
||||
if ($res['stat']==200) return json_decode($res['body'], true);
|
||||
else return $res;
|
||||
}
|
||||
protected function fileList($parent_file_id)
|
||||
{
|
||||
$url = $this->api_url . '/file/list';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['limit'] = 200;
|
||||
$data['marker'] = null;
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['parent_file_id'] = $parent_file_id;
|
||||
$data['image_thumbnail_process'] = 'image/resize,w_160/format,jpeg';
|
||||
$data['image_url_process'] = 'image/resize,w_1920/format,jpeg';
|
||||
$data['video_thumbnail_process'] = 'video/snapshot,t_0,f_jpg,w_300';
|
||||
$data['fields'] = '*';
|
||||
$data['order_by'] = 'updated_at';
|
||||
$data['order_direction'] = 'DESC';
|
||||
|
||||
$res = curl('POST', $url, json_encode($data), $header);
|
||||
//error_log1($res['stat'] . $res['body']);
|
||||
if ($res['stat']==200) {
|
||||
$body = json_decode($res['body'], true);
|
||||
$body1 = $body;
|
||||
while ($body1['next_marker']!='') {
|
||||
$data['marker'] = $body1['next_marker'];
|
||||
$res1 = null;
|
||||
$res1 = curl('POST', $url, json_encode($data), $header);
|
||||
$body1 = json_decode($res1['body'], true);
|
||||
$body['items'] = array_merge($body['items'], $body1['items']);
|
||||
}
|
||||
return $body;
|
||||
//return json_decode($res['body'], true);
|
||||
}
|
||||
else return $res;
|
||||
}
|
||||
|
||||
public function Rename($file, $newname) {
|
||||
$url = $this->api_url . '/file/update';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['check_name_mode'] = 'refuse';
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['file_id'] = $file['id'];
|
||||
$data['name'] = $newname;
|
||||
//$data['parent_file_id'] = 'root';
|
||||
|
||||
$result = curl('POST', $url, json_encode($data), $header);
|
||||
//savecache('path_' . $file['path'], json_decode('{}',true), $this->disktag, 1);
|
||||
//error_log1('decode:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
//return output($result['body'], $result['stat']);
|
||||
}
|
||||
public function Delete($file) {
|
||||
$url = $this->api_url . '/batch';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['resource'] = 'file';
|
||||
$data['requests'][0]['url'] = '/file/delete';
|
||||
$data['requests'][0]['method'] = 'DELETE';
|
||||
$data['requests'][0]['id'] = $file['id'];
|
||||
$data['requests'][0]['headers']['Content-Type'] = 'application/json';
|
||||
$data['requests'][0]['body']['drive_id'] = $this->driveId;
|
||||
$data['requests'][0]['body']['file_id'] = $file['id'];
|
||||
|
||||
$result = curl('POST', $url, json_encode($data), $header);
|
||||
//savecache('path_' . $file['path'], json_decode('{}',true), $this->disktag, 1);
|
||||
//error_log1('result:' . json_encode($result));
|
||||
//return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
$res = json_decode($result['body'], true)['responses'][0];
|
||||
if (isset($res['status'])) return output($res['id'], $res['status']);
|
||||
else return output($result['body'], $result['stat']);
|
||||
}
|
||||
public function Encrypt($folder, $passfilename, $pass) {
|
||||
$existfile = $this->list_path($folder['path'] . '/' . $passfilename);
|
||||
if (isset($existfile['type'])) { // 删掉原文件
|
||||
$this->Delete(['id'=>$existfile['file_id']]);
|
||||
}
|
||||
if ($pass==='') {
|
||||
// 如果为空,上面已经删除了
|
||||
return output('Success', 200);
|
||||
}
|
||||
if (!$folder['id']) {
|
||||
$res = $this->list_path($folder['path']);
|
||||
//error_log1('res:' . json_encode($res));
|
||||
$folder['id'] = $res['file_id'];
|
||||
}
|
||||
$tmp = '/tmp/' . $passfilename;
|
||||
file_put_contents($tmp, $pass);
|
||||
|
||||
$result = $this->tmpfileCreate($folder['id'], $tmp, $passfilename);
|
||||
|
||||
if ($result['stat']==201) {
|
||||
//error_log1('1,url:' . $url .' res:' . json_encode($result));
|
||||
$res = json_decode($result['body'], true);
|
||||
$url = $res['part_info_list'][0]['upload_url'];
|
||||
if (!$url) { // 无url,应该算秒传
|
||||
return output('no up url', 200);
|
||||
}
|
||||
$file_id = $res['file_id'];
|
||||
$upload_id = $res['upload_id'];
|
||||
$result = curl('PUT', $url, $pass, [], 1);
|
||||
if ($result['stat']==200) { // 块1传好
|
||||
$result = $this->fileComplete($file_id, $upload_id, [ $result['returnhead']['ETag'] ]);
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
}
|
||||
//error_log1('2,url:' . $url .' res:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Move($file, $folder) {
|
||||
if (!$folder['id']) {
|
||||
$res = $this->list_path($folder['path']);
|
||||
//error_log1('res:' . json_encode($res));
|
||||
$folder['id'] = $res['file_id'];
|
||||
}
|
||||
|
||||
$url = $this->api_url . '/batch';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['resource'] = 'file';
|
||||
$data['requests'][0]['url'] = '/file/move';
|
||||
$data['requests'][0]['method'] = 'POST';
|
||||
$data['requests'][0]['id'] = $file['id'];
|
||||
$data['requests'][0]['headers']['Content-Type'] = 'application/json';
|
||||
$data['requests'][0]['body']['drive_id'] = $this->driveId;
|
||||
$data['requests'][0]['body']['file_id'] = $file['id'];
|
||||
$data['requests'][0]['body']['auto_rename'] = true;
|
||||
$data['requests'][0]['body']['to_parent_file_id'] = $folder['id'];
|
||||
|
||||
$result = curl('POST', $url, json_encode($data), $header);
|
||||
//savecache('path_' . $file['path'], json_decode('{}',true), $this->disktag, 1);
|
||||
//error_log1('result:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Copy($file) {
|
||||
if (!$file['id']) {
|
||||
$oldfile = $this->list_path($file['path'] . '/' . $file['name']);
|
||||
//error_log1('res:' . json_encode($res));
|
||||
//$file['id'] = $res['file_id'];
|
||||
} else {
|
||||
$oldfile = $this->fileGet($file['id']);
|
||||
}
|
||||
|
||||
$url = $this->api_url . '/file/create';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse.
|
||||
$data['content_hash'] = $oldfile['content_hash'];
|
||||
$data['content_hash_name'] = 'sha1';
|
||||
$data['content_type'] = $oldfile['content_type'];
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['ignoreError'] = false;
|
||||
$data['name'] = $oldfile['name'];
|
||||
$data['parent_file_id'] = $oldfile['parent_file_id'];
|
||||
$data['part_info_list'][0]['part_number'] = 1;
|
||||
$data['size'] = $oldfile['size'];
|
||||
$data['type'] = 'file';
|
||||
|
||||
$result = curl('POST', $url, json_encode($data), $header);
|
||||
|
||||
if ($result['stat']==201) {
|
||||
//error_log1('1,url:' . $url .' res:' . json_encode($result));
|
||||
$res = json_decode($result['body'], true);
|
||||
$url = $res['part_info_list'][0]['upload_url'];
|
||||
if (!$url) { // 无url,应该算秒传
|
||||
return output('no up url', 200);
|
||||
} else {
|
||||
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));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Edit($file, $content) {
|
||||
$tmp = splitlast($file['path'], '/');
|
||||
$folderpath = $tmp[0];
|
||||
$filename = $tmp[1];
|
||||
$existfile = $this->list_path($file['path']);
|
||||
if (isset($existfile['type'])) { // 删掉原文件
|
||||
$this->Delete(['id'=>$existfile['file_id']]);
|
||||
}
|
||||
$tmp1 = '/tmp/' . $filename;
|
||||
file_put_contents($tmp1, $content);
|
||||
|
||||
$result = $this->tmpfileCreate($this->list_path($folderpath)['file_id'], $tmp1, $filename);
|
||||
|
||||
if ($result['stat']==201) {
|
||||
//error_log1('1,url:' . $url .' res:' . json_encode($result));
|
||||
$res = json_decode($result['body'], true);
|
||||
$url = $res['part_info_list'][0]['upload_url'];
|
||||
if (!$url) { // 无url,应该算秒传
|
||||
return output('no up url', 0);
|
||||
}
|
||||
$file_id = $res['file_id'];
|
||||
$upload_id = $res['upload_id'];
|
||||
$result = curl('PUT', $url, $content, [], 1);
|
||||
if ($result['stat']==200) { // 块1传好
|
||||
$result = $this->fileComplete($file_id, $upload_id, [ $result['returnhead']['ETag'] ]);
|
||||
if ($result['stat']!=200) return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
else return output('success', 0);
|
||||
}
|
||||
}
|
||||
//error_log1('2,url:' . $url .' res:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Create($folder, $type, $name, $content = '') {
|
||||
if (!$folder['id']) {
|
||||
$res = $this->list_path($folder['path']);
|
||||
//error_log1('res:' . json_encode($res));
|
||||
$folder['id'] = $res['file_id'];
|
||||
}
|
||||
if ($type=='folder') {
|
||||
$result = $this->folderCreate($folder['id'], $name);
|
||||
//error_log1('res:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
if ($type=='file') {
|
||||
$tmp = '/tmp/' . $name;
|
||||
file_put_contents($tmp, $content);
|
||||
|
||||
$result = $this->tmpfileCreate($folder['id'], $tmp, $name);
|
||||
|
||||
if ($result['stat']==201) {
|
||||
//error_log1('1,url:' . $url .' res:' . json_encode($result));
|
||||
$res = json_decode($result['body'], true);
|
||||
if (isset($res['exist'])&&$res['exist']!=false) {
|
||||
// 已经有
|
||||
//error_log1('exist:' . json_encode($res));
|
||||
return output('{"type":"file","name":"' . $name . '", "exist":true}', 200);
|
||||
}
|
||||
if (isset($res['rapid_upload'])&&$res['rapid_upload']!=false) {
|
||||
// 秒传
|
||||
//error_log1('rapid up:' . json_encode($res));
|
||||
return output('{"type":"file","name":"' . $name . '", "rapid_upload":true}', 200);
|
||||
}
|
||||
$url = $res['part_info_list'][0]['upload_url'];
|
||||
$file_id = $res['file_id'];
|
||||
$upload_id = $res['upload_id'];
|
||||
$result = curl('PUT', $url, $content, [], 1);
|
||||
//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,url:' . $url .' res:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
}
|
||||
//error_log1('4,url:' . $url .' res:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
return output('Type not folder or file.', 500);
|
||||
}
|
||||
|
||||
protected function folderCreate($parentId, $folderName) {
|
||||
if (strrpos($folderName, '/')) {
|
||||
$tmp = splitlast($folderName, '/');
|
||||
$parentId = json_decode($this->folderCreate($parentId, $tmp[0])['body'], true)['file_id'];
|
||||
$folderName = $tmp[1];
|
||||
}
|
||||
$url = $this->api_url . '/file/create';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['check_name_mode'] = 'refuse'; // ignore, auto_rename, refuse.
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['name'] = $folderName;
|
||||
$data['parent_file_id'] = $parentId;
|
||||
$data['type'] = 'folder';
|
||||
|
||||
return curl('POST', $url, json_encode($data), $header);
|
||||
}
|
||||
protected function fileCreate($parentId, $fileName, $sha1, $size, $part_number) {
|
||||
$url = $this->api_url . '/file/create';
|
||||
|
||||
$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['size'] = (int)$size;
|
||||
$data['type'] = 'file';
|
||||
|
||||
return curl('POST', $url, json_encode($data), $header);
|
||||
}
|
||||
protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') {
|
||||
$sha1 = sha1_file($tmpFilePath);
|
||||
if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1];
|
||||
$url = $this->api_url . '/file/create';
|
||||
|
||||
$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'] = 'text/plain'; // now only txt
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['ignoreError'] = false;
|
||||
$data['name'] = $tofileName;
|
||||
$data['parent_file_id'] = $parentId;
|
||||
$data['part_info_list'][0]['part_number'] = 1; // now only txt
|
||||
$data['size'] = filesize($tmpFilePath);
|
||||
$data['type'] = 'file';
|
||||
|
||||
return curl('POST', $url, json_encode($data), $header);
|
||||
}
|
||||
protected function fileComplete($file_id, $upload_id, $etags) {
|
||||
$url = $this->api_url . '/file/complete';
|
||||
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$data['drive_id'] = $this->driveId;
|
||||
$data['file_id'] = $file_id;
|
||||
$data['ignoreError'] = false;
|
||||
$i = 0;
|
||||
foreach ($etags as $etag) {
|
||||
$data['part_info_list'][$i]['part_number'] = $i + 1;
|
||||
$data['part_info_list'][$i]['etag'] = $etag;
|
||||
$i++;
|
||||
}
|
||||
$data['upload_id'] = $upload_id;
|
||||
|
||||
return curl('POST', $url, json_encode($data), $header);
|
||||
}
|
||||
|
||||
public function get_thumbnails_url($path = '/')
|
||||
{
|
||||
$res = $this->list_path($path);
|
||||
$thumb_url = $res['thumbnail'];
|
||||
return $thumb_url;
|
||||
}
|
||||
public function bigfileupload($path)
|
||||
{
|
||||
if (isset($_POST['uploadid'])) {
|
||||
// Complete
|
||||
$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']);
|
||||
} else {
|
||||
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
|
||||
if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
|
||||
if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400);
|
||||
|
||||
$tmp = splitlast($_POST['upbigfilename'], '/');
|
||||
if ($tmp[1]!='') {
|
||||
$fileinfo['name'] = $tmp[1];
|
||||
if ($_SERVER['admin']) $fileinfo['path'] = $tmp[0];
|
||||
} else {
|
||||
$fileinfo['name'] = $_POST['upbigfilename'];
|
||||
}
|
||||
$fileinfo['size'] = $_POST['filesize'];
|
||||
$fileinfo['filelastModified'] = $_POST['filelastModified'];
|
||||
if ($_SERVER['admin']) {
|
||||
$filename = $fileinfo['name'];
|
||||
} else {
|
||||
$tmp1 = splitlast($fileinfo['name'], '.');
|
||||
if ($tmp1[0]==''||$tmp1[1]=='') $filename = $_POST['filesha1'];
|
||||
else $filename = $_POST['filesha1'] . '.' . $tmp1[1];
|
||||
}
|
||||
|
||||
$parent = $this->list_path($path . '/' . $fileinfo['path']);
|
||||
if (isset($parent['file_id'])) {
|
||||
$parent_file_id = $parent['file_id'];
|
||||
} else {
|
||||
$res = $this->folderCreate($this->list_path($path)['file_id'], $fileinfo['path']);
|
||||
//error_log1($res['body']);
|
||||
$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']));
|
||||
$res = json_decode($response['body'], true);
|
||||
if (isset($res['exist'])) {
|
||||
// 已经有
|
||||
//error_log1('exist:' . json_encode($res));
|
||||
return output(json_encode($this->files_format(json_decode($response['body'], true))), $response['stat']);
|
||||
//return output('{"type":"file","name":"' . $_POST['upbigfilename'] . '", "exist":true}', 200);
|
||||
}
|
||||
if (isset($res['rapid_upload'])&&$res['rapid_upload']!=false) {
|
||||
// 秒传
|
||||
//error_log1('rapid up:' . json_encode($res));
|
||||
return output(json_encode($this->files_format(json_decode($response['body'], true))), $response['stat']);
|
||||
//return output('{"type":"file","name":"' . $_POST['upbigfilename'] . '", "rapid upload":true}', 200);
|
||||
}
|
||||
//if ($response['stat']<500) {
|
||||
// $responsearry = json_decode($response['body'], true);
|
||||
// if (isset($responsearry['error'])) return output($response['body'], $response['stat']);
|
||||
// $fileinfo['uploadUrl'] = $responsearry['uploadUrl'];
|
||||
// if ($fileinfo['size']>10*1024*1024) $this->MSAPI('PUT', path_format($path . '/' . $cachefilename), json_encode($fileinfo, JSON_PRETTY_PRINT), $this->access_token);
|
||||
//}
|
||||
return output($response['body'], $response['stat']);
|
||||
}
|
||||
}
|
||||
|
||||
public function AddDisk() {
|
||||
global $constStr;
|
||||
global $EnvConfigs;
|
||||
|
||||
$envs = '';
|
||||
foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
|
||||
$url = path_format($_SERVER['PHP_SELF'] . '/');
|
||||
|
||||
if (isset($_GET['Finish'])) {
|
||||
if ($this->access_token == '') {
|
||||
$refresh_token = getConfig('refresh_token', $this->disktag);
|
||||
if (!$refresh_token) {
|
||||
$html = 'No refresh_token config, please AddDisk again or wait minutes.<br>' . $this->disktag;
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$response = $this->get_access_token($refresh_token);
|
||||
if (!$response) return message($this->error['body'], 'Error', $this->error['stat']);
|
||||
}
|
||||
$tmp = null;
|
||||
if ($_POST['driveId']!='') {
|
||||
$tmp['driveId'] = $_POST['driveId'];
|
||||
} else {
|
||||
return message('no driveId', 'Error', 201);
|
||||
}
|
||||
|
||||
$response = setConfigResponse( setConfig($tmp, $this->disktag) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
} else {
|
||||
$str .= '
|
||||
<script>
|
||||
var status = "' . $response['status'] . '";
|
||||
var uploadList = setInterval(function(){
|
||||
if (document.getElementById("dis").style.display=="none") {
|
||||
console.log(min++);
|
||||
} else {
|
||||
clearInterval(uploadList);
|
||||
location.href = "' . $url . '";
|
||||
}
|
||||
}, 1000);
|
||||
</script>';
|
||||
return message($str, getconstStr('WaitJumpIndex'), 201, 1);
|
||||
}
|
||||
}
|
||||
if (isset($_GET['SelectDrive'])) {
|
||||
if ($this->access_token == '') {
|
||||
if (isset($_POST['refresh_token'])) {
|
||||
$res = curl('POST', $this->auth_url, json_encode([ 'refresh_token' => $_POST['refresh_token'], 'grant_type' => 'refresh_token' ]), ["content-type"=>"application/json; charset=utf-8"]);
|
||||
//return output($res['body']);
|
||||
if ($res['stat']!=200) {
|
||||
return message($res['body'], $res['stat'], $res['stat']);
|
||||
}
|
||||
//var_dump($res['body']);
|
||||
$result = json_decode($res['body'], true);
|
||||
|
||||
$tmp = null;
|
||||
$tmp['refresh_token'] = $result['refresh_token'];
|
||||
$tmp['token_expires'] = time()+3*24*60*60;
|
||||
$tmp['Driver'] = 'Aliyundrive';
|
||||
//error_log(json_encode($tmp));
|
||||
|
||||
$response = setConfigResponse( setConfig($tmp, $this->disktag) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
savecache('access_token', $result['access_token'], $this->disktag, $result['expires_in'] - 60);
|
||||
} else {
|
||||
$refresh_token = getConfig('refresh_token', $this->disktag);
|
||||
if (!$refresh_token) {
|
||||
$html = 'No refresh_token config, please AddDisk again or wait minutes.<br>' . $this->disktag;
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$response = $this->get_access_token($refresh_token);
|
||||
if (!$response) return message($this->error['body'], 'Error', $this->error['stat']);
|
||||
}
|
||||
}
|
||||
if (!isset($result['default_drive_id'])) {
|
||||
$res = curl('POST', $this->auth_url, json_encode([ 'refresh_token' => getConfig('refresh_token', $this->disktag), 'grant_type' => 'refresh_token' ]), ["content-type"=>"application/json; charset=utf-8"]);
|
||||
//return output($res['body']);
|
||||
if ($res['stat']!=200) {
|
||||
return message($res['body'], $res['stat'], $res['stat']);
|
||||
}
|
||||
//var_dump($res['body']);
|
||||
$result = json_decode($res['body'], true);
|
||||
}
|
||||
|
||||
//$tmp = null;
|
||||
//$tmp['driveId'] = $result['default_drive_id'];
|
||||
//$tmp['default_sbox_drive_id'] = $result['default_sbox_drive_id'];
|
||||
$title = 'Select Driver';
|
||||
$html = '
|
||||
<div>
|
||||
<form action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
|
||||
<label><input type="radio" name="driveId" value="' . $result['default_drive_id'] . '"' . ($result['default_drive_id']==$this->driveId?' checked':'') . '>' . '用普通空间 ' . getconstStr(' ') . '</label><br>
|
||||
<label><input type="radio" name="driveId" value="' . $result['default_sbox_drive_id'] . '"' . ($result['default_sbox_drive_id']==$this->driveId?' checked':'') . '>' . '用虎符文件保险箱 </label><br>
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
var status = "' . $response['status'] . '";
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.driveId.value==\'\') {
|
||||
alert(\'Select a Disk\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
';
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
if (isset($_GET['install0']) && $_POST['disktag_add']!='') {
|
||||
$_POST['disktag_add'] = preg_replace('/[^0-9a-zA-Z|_]/i', '', $_POST['disktag_add']);
|
||||
$f = substr($_POST['disktag_add'], 0, 1);
|
||||
if (strlen($_POST['disktag_add'])==1) $_POST['disktag_add'] .= '_';
|
||||
if (isCommonEnv($_POST['disktag_add'])) {
|
||||
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'disktag=; path=/; \'+expires;
|
||||
</script>', 'Error', 201);
|
||||
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
|
||||
return message('Please start with letters<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'disktag=; path=/; \'+expires;
|
||||
</script>', 'Error', 201);
|
||||
}
|
||||
|
||||
$tmp = null;
|
||||
foreach ($EnvConfigs as $env => $v) if (isInnerEnv($env)) $tmp[$env] = '';
|
||||
|
||||
$tmp['Driver'] = 'Aliyundrive';
|
||||
$tmp['disktag_add'] = $_POST['disktag_add'];
|
||||
$tmp['diskname'] = $_POST['diskname'];
|
||||
//error_log(json_encode($tmp));
|
||||
|
||||
$response = setConfigResponse( setConfig($tmp, $this->disktag) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 400);
|
||||
} else {
|
||||
$title = 'Refresh token';
|
||||
$html = '
|
||||
<form action="?SelectDrive&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
|
||||
<div>填入refresh_token:
|
||||
<input type="text" name="refresh_token" placeholder="自行百度如何获取' . getconstStr(' ') . '" style="width:100%"><br>
|
||||
</div><br>
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
<form>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.refresh_token.value==\'\') {
|
||||
alert(\'Input refresh_token\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
var status = "' . $response['status'] . '";
|
||||
</script>
|
||||
';
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$html = '
|
||||
<div>
|
||||
<form id="form1" action="" method="post" onsubmit="return notnull(this);">
|
||||
' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ')
|
||||
<input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br>
|
||||
' . getconstStr('DiskName') . ':
|
||||
<input type="text" name="diskname" placeholder="' . getconstStr('EnvironmentsDescription')['diskname'] . '" style="width:100%"><br>
|
||||
<br>
|
||||
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.disktag_add.value==\'\') {
|
||||
alert(\'' . getconstStr('DiskTag') . '\');
|
||||
return false;
|
||||
}
|
||||
envs = [' . $envs . '];
|
||||
if (envs.indexOf(t.disktag_add.value)>-1) {
|
||||
alert("Do not input ' . $envs . '");
|
||||
return false;
|
||||
}
|
||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
||||
if (!reg.test(t.disktag_add.value)) {
|
||||
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=Aliyundrive";
|
||||
//var expd = new Date();
|
||||
//expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
//var expires = "expires="+expd.toGMTString();
|
||||
//document.cookie=\'disktag=\'+t.disktag_add.value+\'; path=/; \'+expires;
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
$title = 'Select Account Type';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
protected function get_access_token($refresh_token) {
|
||||
if (!$refresh_token) {
|
||||
$tmp['stat'] = 0;
|
||||
$tmp['body'] = 'No refresh_token';
|
||||
$this->error = $tmp;
|
||||
return false;
|
||||
}
|
||||
if (!($this->access_token = getcache('access_token', $this->disktag))) {
|
||||
$p=0;
|
||||
$tmp1['refresh_token'] = $refresh_token;
|
||||
$tmp1['grant_type'] = 'refresh_token';
|
||||
while ($response['stat']==0&&$p<3) {
|
||||
$response = curl('POST', $this->auth_url, json_encode($tmp1), ["content-type"=>"application/json; charset=utf-8"]);
|
||||
$p++;
|
||||
}
|
||||
//error_log1(json_encode($response));
|
||||
if ($response['stat']==200) $ret = json_decode($response['body'], true);
|
||||
if (!isset($ret['access_token'])) {
|
||||
error_log1('failed to get [' . $this->disktag . '] access_token. response: ' . $response['stat'] . $response['body']);
|
||||
//$response['body'] = json_encode(json_decode($response['body']), JSON_PRETTY_PRINT);
|
||||
$response['body'] .= 'failed to get [' . $this->disktag . '] access_token.';
|
||||
$this->error = $response;
|
||||
return false;
|
||||
}
|
||||
$tmp = $ret;
|
||||
$tmp['access_token'] = substr($tmp['access_token'], 0, 10) . '******';
|
||||
$tmp['refresh_token'] = substr($tmp['refresh_token'], 0, 10) . '******';
|
||||
error_log1('[' . $this->disktag . '] Get access token:' . json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
$this->access_token = $ret['access_token'];
|
||||
savecache('access_token', $this->access_token, $this->disktag, $ret['expires_in'] - 300);
|
||||
if (time()>getConfig('token_expires', $this->disktag)) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+3*24*60*60 ], $this->disktag);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public function getDiskSpace() {
|
||||
if (!($diskSpace = getcache('diskSpace', $this->disktag))) {
|
||||
$url = $this->api_url . '/databox/get_personal_info';
|
||||
$header["content-type"] = "application/json; charset=utf-8";
|
||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||
$response = curl('POST', $url, '', $header);
|
||||
//error_log1(json_encode($response));
|
||||
$res = json_decode($response['body'], true)['personal_space_info'];
|
||||
$used = size_format($res['used_size']);
|
||||
$total = size_format($res['total_size']);
|
||||
$diskSpace = $used . ' / ' . $total;
|
||||
savecache('diskSpace', $diskSpace, $this->disktag);
|
||||
}
|
||||
return $diskSpace;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,865 @@
|
||||
<?php
|
||||
|
||||
class Googledrive {
|
||||
protected $access_token;
|
||||
protected $disktag;
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '106151778902-ajieetaab5ondhbvia97n4tr5k0cg8eo.apps.googleusercontent.com';
|
||||
$this->client_secret = 'LlCV-rQClzYIKCEqiVddh68G';
|
||||
}
|
||||
//$this->oauth_url = 'https://www.googleapis.com/oauth2/v4/';
|
||||
$this->oauth_url = 'https://accounts.google.com/o/oauth2/';
|
||||
$this->api_url = 'https://www.googleapis.com/drive/v3';
|
||||
$this->scope = 'https://www.googleapis.com/auth/drive';
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
//$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
//$this->ext_api_url = '/me/drive/root';
|
||||
$this->driveId = getConfig('driveId', $tag);
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
}
|
||||
|
||||
public function isfine()
|
||||
{
|
||||
if (!$this->access_token) return false;
|
||||
else return true;
|
||||
}
|
||||
public function show_base_class()
|
||||
{
|
||||
return get_class();
|
||||
//$tmp[0] = get_class();
|
||||
//$tmp[1] = get_class($this);
|
||||
//return $tmp;
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return ['driveId'];
|
||||
}
|
||||
|
||||
public function list_files($path = '/')
|
||||
{
|
||||
$files = $this->list_path($path);
|
||||
|
||||
return $this->files_format($files);
|
||||
}
|
||||
|
||||
protected function files_format($files)
|
||||
{
|
||||
if (isset($files['files']) || (isset($files['mimeType'])&&$files['mimeType']=='application/vnd.google-apps.folder') ) {
|
||||
$tmp['type'] = 'folder';
|
||||
$tmp['id'] = $files['id'];
|
||||
$tmp['name'] = $files['name'];
|
||||
$tmp['time'] = $files['modifiedTime'];
|
||||
$tmp['size'] = $files['size'];
|
||||
$tmp['childcount'] = $files['folder']['childCount'];
|
||||
$tmp['page'] = $files['folder']['page'];
|
||||
foreach ($files['files'] as $file) {
|
||||
$filename = strtolower($file['name']);
|
||||
if ($file['mimeType']=='application/vnd.google-apps.folder') {
|
||||
$tmp['list'][$filename]['type'] = 'folder';
|
||||
} else {
|
||||
$tmp['list'][$filename]['type'] = 'file';
|
||||
//var_dump($file);
|
||||
//echo $file['name'] . ':' . $this->DownurlStrName . ':' . $file[$this->DownurlStrName] . PHP_EOL;
|
||||
$tmp['list'][$filename]['url'] = ($file['downUrl']?$file['downUrl']:$file['webContentLink']);
|
||||
$tmp['list'][$filename]['mime'] = $file['mimeType'];
|
||||
}
|
||||
$tmp['list'][$filename]['id'] = $file['id'];
|
||||
$tmp['list'][$filename]['name'] = $file['name'];
|
||||
$tmp['list'][$filename]['time'] = $file['modifiedTime'];
|
||||
$tmp['list'][$filename]['size'] = $file['size'];
|
||||
}
|
||||
} elseif (isset($files['mimeType'])) {
|
||||
$tmp['type'] = 'file';
|
||||
$tmp['id'] = $files['id'];
|
||||
$tmp['name'] = $files['name'];
|
||||
$tmp['time'] = $files['modifiedTime'];
|
||||
$tmp['size'] = $files['size'];
|
||||
$tmp['mime'] = $files['mimeType'];
|
||||
$tmp['url'] = ($files['downUrl']?$files['downUrl']:$files['webContentLink']);
|
||||
$tmp['content'] = $files['content'];
|
||||
} else/*if (isset($files['error']))*/ {
|
||||
return $files;
|
||||
}
|
||||
//error_log1(json_encode($tmp));
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
protected function list_path($path = '/')
|
||||
{
|
||||
global $exts;
|
||||
while (substr($path, -1)=='/') $path = substr($path, 0, -1);
|
||||
if ($path == '') $path = '/';
|
||||
|
||||
if (!($files = getcache('path_' . $path, $this->disktag))) {
|
||||
//$response = curl('GET', $this->api_url . '/drives', '', ['Authorization' => 'Bearer ' . $this->access_token]);
|
||||
//$response = curl('GET', $this->api_url . '/files?fields=*,files(id,name,mimeType,size,modifiedTime,parents,webContentLink,thumbnailLink),nextPageToken' . (($this->driveId!='')?'&driveId=' . $this->driveId . '&corpora=teamDrive&includeItemsFromAllDrives=true&supportsAllDrives=true':''), '', ['Authorization' => 'Bearer ' . $this->access_token]);
|
||||
if ($path == '/' || $path == '') {
|
||||
$files = $this->fileList();
|
||||
//error_log1('root_id' . $files['id']);
|
||||
//$files['id'] = 'root';
|
||||
//$files['type'] = 'folder';
|
||||
} else {
|
||||
$tmp = splitlast($path, '/');
|
||||
$parent_path = $tmp[0];
|
||||
$filename = urldecode($tmp[1]);
|
||||
$parent_folder = $this->list_path($parent_path);
|
||||
$i = 0;
|
||||
foreach ($parent_folder['files'] as $item) {
|
||||
if ($item['name']==$filename) {
|
||||
if ($item['mimeType']=='application/vnd.google-apps.folder') {
|
||||
$files = $this->fileList($item['id']);
|
||||
$files['type'] = 'folder';
|
||||
$files['id'] = $item['id'];
|
||||
$files['name'] = $item['name'];
|
||||
$files['time'] = $item['modifiedTime'];
|
||||
$files['size'] = $item['size'];
|
||||
} else {
|
||||
if (isset($item['id'])&&$item['shared']!==true) $this->permission('create', $item['id']);
|
||||
//$this->permission('delete', $files['id']);
|
||||
|
||||
//if (isset($item['mimeType']) && $item['mimeType']!='application/vnd.google-apps.folder') {
|
||||
if (in_array(strtolower(splitlast($item['name'],'.')[1]), $exts['txt'])) {
|
||||
if ($files['size']<1024*1024) {
|
||||
if (!(isset($item['content'])&&$item['content']['stat']==200)) {
|
||||
//if (!isset($item['downUrl'])) {
|
||||
$res = curl('GET', $item['webContentLink'], '', [], 1);
|
||||
$weblink = $res['returnhead']['Location'];
|
||||
//if ($weblink!==null) $item['downUrl'] = $weblink;
|
||||
//else error_log1('Cant get link:' . json_encode($res, JSON_PRETTY_PRINT));
|
||||
//}
|
||||
if ($res['stat']==302) {
|
||||
$content1 = curl('GET', $weblink, '', ["User-Agent"=>"qkqpttgf/OneManager 3.0.0", "Accept"=>"*/*"]);
|
||||
$tmp = null;
|
||||
$tmp = json_decode(json_encode($content1), true);
|
||||
if ($tmp['body']===null) {
|
||||
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
|
||||
$tmp = json_decode(json_encode($tmp), true);
|
||||
if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
|
||||
}
|
||||
$item['content'] = $content1;
|
||||
}// else $content1 = $res;
|
||||
//error_log1($item['name'] . '~' . json_encode($content1, JSON_PRETTY_PRINT) . PHP_EOL);
|
||||
$parent_folder['files'][$i] = $item;
|
||||
savecache('path_' . $path, $parent_folder, $this->disktag);
|
||||
}
|
||||
} else {
|
||||
$files['content']['stat'] = 202;
|
||||
$files['content']['body'] = 'File too large.';
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//error_log1(json_encode($item, JSON_PRETTY_PRINT));
|
||||
$files = $item;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
//echo $files['name'];
|
||||
}
|
||||
|
||||
if (!$files) {
|
||||
$files['error']['code'] = 'Not Found';
|
||||
$files['error']['message'] = 'Not Found';
|
||||
$files['error']['stat'] = 404;
|
||||
} elseif (isset($files['stat'])) {
|
||||
$files['error']['stat'] = $files['stat'];
|
||||
$files['error']['code'] = 'Error';
|
||||
$files['error']['message'] = $files['body'];
|
||||
} else {
|
||||
savecache('path_' . $path, $files, $this->disktag, 600);
|
||||
}
|
||||
}
|
||||
//error_log1('path:' . $path . ', files:' . json_encode($files, JSON_PRETTY_PRINT));
|
||||
//error_log1('path:' . $path . ', files:' . substr(json_encode($files), 0, 150));
|
||||
return $files;
|
||||
}
|
||||
protected function fileList($parent_file_id = '')
|
||||
{
|
||||
$url = $this->api_url . '/files';
|
||||
|
||||
$url .= '?fields=files(id,name,mimeType,size,modifiedTime,parents,webContentLink,thumbnailLink,shared,permissions,permissionIds),nextPageToken';
|
||||
//$url .= '?fields=files(*),nextPageToken';
|
||||
//$url .= '?q=mimeType=\'application/vnd.google-apps.folder\'';
|
||||
if ($parent_file_id!='') {
|
||||
$q = $parent_file_id;
|
||||
} else {
|
||||
$q = $this->driveId;
|
||||
}
|
||||
$q = '\'' . $q . '\' in parents and trashed = false';
|
||||
$q = urlencode($q);
|
||||
$url .= '&q=' . $q;
|
||||
if ($this->driveId!='root') $url .= '&driveId=' . $this->driveId . '&corpora=teamDrive&includeItemsFromAllDrives=true&supportsAllDrives=true';
|
||||
|
||||
$header['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$res = curl('GET', $url, '', $header);
|
||||
if ($res['stat']==200) return json_decode($res['body'], true);
|
||||
else return $res;
|
||||
}
|
||||
protected function permission($op, $fileId)
|
||||
{
|
||||
$url = $this->api_url . '/files/' . $fileId . '/permissions';
|
||||
if ($op=='create') {
|
||||
$method = 'POST';
|
||||
$header['Content-Type'] = 'application/json';
|
||||
$tmp['role'] = 'reader';
|
||||
$tmp['type'] = 'anyone';
|
||||
$data = json_encode($tmp);
|
||||
} elseif ($op=='delete') {
|
||||
$url .= '/anyoneWithLink';
|
||||
$method = 'DELETE';
|
||||
$data = '';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$url .= '?supportsAllDrives=true';
|
||||
$header['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$res = curl($method, $url, $data, $header);
|
||||
//error_log1('Set Share' . json_encode($res, JSON_PRETTY_PRINT));
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function Rename($file, $newname) {
|
||||
$url = $this->api_url . '/files/' . $file['id'] . '?supportsAllDrives=true';
|
||||
$tmp['name'] = $newname;
|
||||
$result = $this->GDAPI('PATCH', $url, json_encode($tmp));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Delete($file) {
|
||||
$url = $this->api_url . '/files/' . $file['id'] . '?supportsAllDrives=true';
|
||||
$result = $this->GDAPI('DELETE', $url);
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Encrypt($folder, $passfilename, $pass) {
|
||||
$existfile = $this->list_path($folder['path'] . '/' . $passfilename);
|
||||
if (isset($existfile['name'])) {
|
||||
if ($pass==='') {
|
||||
// 如果为空,删除
|
||||
$this->Delete(['id'=>$existfile['id']]);
|
||||
return output('Success', 200);
|
||||
} else {
|
||||
$result = $this->editFile($existfile['id'], $pass);
|
||||
}
|
||||
} else {
|
||||
if (!$folder['id']) {
|
||||
$res = $this->list_path($folder['path']);
|
||||
//error_log1('res:' . json_encode($res));
|
||||
$folder['id'] = $res['id'];
|
||||
}
|
||||
if (!$folder['id']) {
|
||||
$folder['id'] = $this->driveId;
|
||||
}
|
||||
$result = $this->createFile_c($folder['id'], $passfilename, $pass);
|
||||
}
|
||||
|
||||
//error_log1('2,url:' . $url .' res:' . json_encode($result));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Move($file, $folder) {
|
||||
$nowParentId = $this->list_path($file['path'])['id'];
|
||||
if (!$nowParentId) {
|
||||
$nowParentId = $this->driveId;
|
||||
}
|
||||
if (!$folder['id']) {
|
||||
$res = $this->list_path($folder['path']);
|
||||
//error_log1('res:' . json_encode($res));
|
||||
$folder['id'] = $res['id'];
|
||||
}
|
||||
if (!$folder['id']) {
|
||||
$folder['id'] = $this->driveId;
|
||||
}
|
||||
$url = $this->api_url . '/files/' . $file['id'] . '?removeParents=' . $nowParentId . '&addParents=' . $folder['id'] . '&supportsAllDrives=true';
|
||||
//$tmp['name'] = $newname;
|
||||
$result = $this->GDAPI('PATCH', $url);
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Copy($file) {
|
||||
$url = $this->api_url . '/files/' . $file['id'] . '/copy?supportsAllDrives=true';
|
||||
$namearr = splitlast($file['name'], '.');
|
||||
date_default_timezone_set('UTC');
|
||||
if ($namearr[0]!='') {
|
||||
$newname = $namearr[0] . '_' . date("Ymd\_His");
|
||||
if ($namearr[1]!='') $newname .= '.' . $namearr[1];
|
||||
} else {
|
||||
$newname = '.' . $namearr[1] . '_' . date("Ymd\_His");
|
||||
}
|
||||
$tmp['name'] = $newname;
|
||||
$result = $this->GDAPI('POST', $url, json_encode($tmp));
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Edit($file, $content) {
|
||||
$tmp = splitlast($file['path'], '/');
|
||||
$folderpath = $tmp[0];
|
||||
$filename = $tmp[1];
|
||||
$existfile = $this->list_path($file['path']);
|
||||
if (isset($existfile['name'])) {
|
||||
$result = $this->editFile($existfile['id'], $content);
|
||||
} else {
|
||||
$result = $this->createFile_c($this->list_path($folderpath)['id'], $filename, $content);
|
||||
}
|
||||
//error_log1('edit: ' . json_encode($result, JSON_PRETTY_PRINT));
|
||||
if ($result['stat']==200) return output('success', 0);
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function Create($parent, $type, $name, $content = '') {
|
||||
$filename = spurlencode($name);
|
||||
$filename = path_format($parent['path'] . '/' . $filename);
|
||||
$res = $this->list_path($filename);
|
||||
//error_log1($filename . '查重:' . json_encode($res, JSON_PRETTY_PRINT) . PHP_EOL);
|
||||
if (isset($res['name'])) {
|
||||
$tmp['error']['code'] = 'File exist';
|
||||
$tmp['error']['message'] = $res;
|
||||
$tmp['error']['stat'] = 409;
|
||||
return output(json_encode($this->files_format($tmp), JSON_PRETTY_PRINT), $tmp['error']['stat']);
|
||||
}
|
||||
if (!$parent['id']) {
|
||||
$res = $this->list_path($parent['path']);
|
||||
//error_log1('找ID:' . json_encode($res));
|
||||
$parent['id'] = $res['id'];
|
||||
}
|
||||
if (!$parent['id']) {
|
||||
$parent['id'] = $this->driveId;
|
||||
}
|
||||
|
||||
if ($type=='file') {
|
||||
$result = $this->createFile_c($parent['id'], $name, $content);
|
||||
}
|
||||
if ($type=='folder') {
|
||||
$result = $this->createFolder($parent['id'], $name);
|
||||
}
|
||||
//error_log1('data:' . $data . ' res:' . json_encode($result, JSON_PRETTY_PRINT));
|
||||
//savecache('path_' . $path1, json_decode('{}',true), $_SERVER['disktag'], 1);
|
||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||
}
|
||||
public function get_thumbnails_url($path = '/') {
|
||||
$res = $this->list_path($path);
|
||||
$thumb_url = $res['thumbnailLink'];
|
||||
return $thumb_url;
|
||||
}
|
||||
public function bigfileupload($path) {
|
||||
return output('Stop!\nCan not upload form explorer without token.', 403);
|
||||
|
||||
// https://developers.google.com/drive/api/v3/manage-uploads#http---multiple-requests
|
||||
|
||||
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
|
||||
if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
|
||||
if (!$_SERVER['admin']) if (!isset($_POST['filemd5'])) return output('error: no file md5', 400);
|
||||
$filename = $_POST['upbigfilename'];
|
||||
$filename = path_format($path . '/' . $filename);
|
||||
$res = $this->list_path($filename);
|
||||
//error_log1($filename . '查重:' . json_encode($res, JSON_PRETTY_PRINT) . PHP_EOL);
|
||||
if (isset($res['name'])) {
|
||||
$tmp['error']['code'] = 'File exist';
|
||||
$tmp['error']['message'] = json_encode($res);
|
||||
$tmp['error']['stat'] = 409;
|
||||
return output(json_encode($this->files_format($tmp), JSON_PRETTY_PRINT), $tmp['error']['stat']);
|
||||
}
|
||||
$tmp = splitlast($_POST['upbigfilename'], '/');
|
||||
if ($tmp[1]!='') {
|
||||
$fileinfo['name'] = $tmp[1];
|
||||
if ($_SERVER['admin']) $fileinfo['path'] = $tmp[0];
|
||||
} else {
|
||||
$fileinfo['name'] = $_POST['upbigfilename'];
|
||||
}
|
||||
$fileinfo['size'] = $_POST['filesize'];
|
||||
$fileinfo['filelastModified'] = $_POST['filelastModified'];
|
||||
if ($_SERVER['admin']) {
|
||||
$filename = $fileinfo['name'];
|
||||
} else {
|
||||
$tmp1 = splitlast($fileinfo['name'], '.');
|
||||
if ($tmp1[0]==''||$tmp1[1]=='') $filename = $_POST['filemd5'];
|
||||
else $filename = $_POST['filemd5'] . '.' . $tmp1[1];
|
||||
}
|
||||
$parent = $this->list_path($path . '/' . $fileinfo['path']);
|
||||
if (isset($parent['id'])) {
|
||||
$parent_file_id = $parent['id'];
|
||||
} else {
|
||||
$res = $this->createFolder($this->list_path($path)['id'], $fileinfo['path']);
|
||||
//error_log1($res['body']);
|
||||
$parent_file_id = json_decode($res['body'], true)['id'];
|
||||
}
|
||||
$url = 'https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable';
|
||||
$res = $this->list_path($path);
|
||||
//error_log1('找ID:' . json_encode($res));
|
||||
$parentId = $res['id'];
|
||||
if (!$parentId) {
|
||||
$parentId = $this->driveId;
|
||||
}
|
||||
$tmp['name'] = $_POST['upbigfilename'];
|
||||
$tmp['parents'][0] = $parentId;
|
||||
|
||||
$header['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
$header['Content-Type'] = 'application/json; charset=UTF-8';
|
||||
//$header['Content-Length'] = '';
|
||||
//$header['X-Upload-Content-Type'] = '';
|
||||
//$header['X-Upload-Content-Length'] = $_POST['filesize'];
|
||||
|
||||
$response = curl('POST', $url, json_encode($tmp), $header, 1);
|
||||
return output($response['returnhead']['Location'], $response['stat']);
|
||||
}
|
||||
|
||||
protected function editFile($id, $content) {
|
||||
$url = 'https://www.googleapis.com/upload/drive/v3/files/' . $id . '?uploadType=multipart&supportsAllDrives=true';
|
||||
|
||||
$boundary = md5($id . date());
|
||||
$header['Content-Type'] = 'multipart/related; boundary=' . $boundary;
|
||||
$header['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
$data = '--' . $boundary . "\r\n";
|
||||
$data .= 'Content-Type: application/json; charset=UTF-8' . "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= '--' . $boundary . "\r\n";
|
||||
$data .= 'Content-Type: text/plain' . "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= $content . "\r\n";
|
||||
$data .= '--' . $boundary . "--";
|
||||
|
||||
$result = curl('PATCH', $url, $data, $header);
|
||||
//error_log1('url: ' . $url . ' data: ' . $data . ' result: ' . json_encode($result, JSON_PRETTY_PRINT));
|
||||
return $result;
|
||||
}
|
||||
protected function createFile_c($parentId, $name, $content) {
|
||||
while (substr($name, 0, 1)=='/') $name = substr($name, 1);
|
||||
while (substr($name, -1)=='/') $name = substr($name, 0, -1);
|
||||
if (strpos($name, '/')>0) {
|
||||
$p = splitlast($name, '/');
|
||||
$res = $this->createFolder($parentId, $p[0]);
|
||||
$parentId = json_decode($res['body'], true)['id'];
|
||||
$name = $p[1];
|
||||
}
|
||||
|
||||
$url = 'https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&supportsAllDrives=true';
|
||||
$tmp['name'] = $name;
|
||||
$tmp['parents'][0] = $parentId;
|
||||
|
||||
$boundary = md5($name . date());
|
||||
$header['Content-Type'] = 'multipart/related; boundary=' . $boundary;
|
||||
$header['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
$data = '--' . $boundary . "\r\n";
|
||||
$data .= 'Content-Type: application/json; charset=UTF-8' . "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= json_encode($tmp, JSON_PRETTY_PRINT) . "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= '--' . $boundary . "\r\n";
|
||||
$data .= 'Content-Type: text/plain' . "\r\n";
|
||||
$data .= "\r\n";
|
||||
$data .= $content . "\r\n";
|
||||
$data .= '--' . $boundary . "--";
|
||||
|
||||
$result = curl('POST', $url, $data, $header);
|
||||
return $result;
|
||||
}
|
||||
protected function createFolder($parentId, $name) {
|
||||
while (substr($name, 0, 1)=='/') $name = substr($name, 1);
|
||||
while (substr($name, -1)=='/') $name = substr($name, 0, -1);
|
||||
if (strpos($name, '/')>0) {
|
||||
$p = splitlast($name, '/');
|
||||
$res = $this->createFolder($parentId, $p[0]);
|
||||
$parentId = json_decode($res['body'], true)['id'];
|
||||
$name = $p[1];
|
||||
}
|
||||
|
||||
$url = $this->api_url . '/files?&supportsAllDrives=true';
|
||||
|
||||
$tmp['name'] = $name;
|
||||
$tmp['parents'][0] = $parentId;
|
||||
$tmp['mimeType'] = 'application/vnd.google-apps.folder';
|
||||
$data = json_encode($tmp);
|
||||
|
||||
$header['Content-Type'] = 'application/json; charset=UTF-8';
|
||||
$header['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
|
||||
$result = curl('POST', $url, $data, $header);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function AddDisk() {
|
||||
global $constStr;
|
||||
global $EnvConfigs;
|
||||
|
||||
$envs = '';
|
||||
foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
|
||||
$url = path_format($_SERVER['PHP_SELF'] . '/');
|
||||
|
||||
if (isset($_GET['Finish'])) {
|
||||
if ($this->access_token == '') {
|
||||
$refresh_token = getConfig('refresh_token', $this->disktag);
|
||||
if (!$refresh_token) {
|
||||
$html = 'No refresh_token config, please AddDisk again or wait minutes.<br>' . $this->disktag;
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$response = $this->get_access_token($refresh_token);
|
||||
if (!$response) return message($this->error['body'], 'Error', $this->error['stat']);
|
||||
}
|
||||
|
||||
$tmp = null;
|
||||
if ($_POST['DriveType']=='Googledrive') {
|
||||
$tmp['driveId'] = 'root';
|
||||
} else {
|
||||
// 直接是id
|
||||
$tmp['driveId'] = $_POST['DriveType'];
|
||||
}
|
||||
|
||||
$response = setConfigResponse( setConfig($tmp, $this->disktag) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
} else {
|
||||
$str .= '<meta http-equiv="refresh" content="5;URL=' . $url . '">';
|
||||
return message($str, getconstStr('WaitJumpIndex'), 201);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['SelectDrive'])) {
|
||||
if ($this->access_token == '') {
|
||||
$refresh_token = getConfig('refresh_token', $this->disktag);
|
||||
if (!$refresh_token) {
|
||||
$html = 'No refresh_token config, please AddDisk again or wait minutes.<br>' . $this->disktag;
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$response = $this->get_access_token($refresh_token);
|
||||
if (!$response) return message($this->error['body'], 'Error', $this->error['stat']);
|
||||
}
|
||||
|
||||
$api = $this->api_url . '/drives';
|
||||
$arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ]);
|
||||
//if (!($arr['stat']==200||$arr['stat']==403||$arr['stat']==400||$arr['stat']==404))
|
||||
if ($arr['stat']!=200) return message($arr['stat'] . json_encode(json_decode($arr['body']), JSON_PRETTY_PRINT), 'Get followedSites', $arr['stat']);
|
||||
error_log1($arr['body']);
|
||||
$drives = json_decode($arr['body'], true)['drives'];
|
||||
|
||||
$title = 'Select Driver';
|
||||
$html = '
|
||||
<div>
|
||||
<form action="?Finish&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '" method="post" onsubmit="return notnull(this);">
|
||||
<label><input type="radio" name="DriveType" value="Googledrive" checked>' . 'Use Googledrive ' . getconstStr(' ') . '</label><br>';
|
||||
if ($drives[0]!='') foreach ($drives as $k => $v) {
|
||||
$html .= '
|
||||
<label>
|
||||
<input type="radio" name="DriveType" value="' . $v['id'] . '" onclick="document.getElementById(\'sharepointSiteUrl\').value=\'' . $v['webUrl'] . '\';">' . 'Use Google share drive: <br><div style="width:100%;margin:0px 35px">: ' . $v['name'] . '<br>siteid: ' . $v['id'] . '</div>
|
||||
</label>';
|
||||
}
|
||||
$html .= '
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.DriveType.value==\'\') {
|
||||
alert(\'Select a Disk\');
|
||||
return false;
|
||||
}
|
||||
if (t.DriveType.value==\'Custom\') {
|
||||
if (t.sharepointSite.value==\'\') {
|
||||
alert(\'sharepoint Site Address\');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
if (isset($_GET['install2']) && isset($_GET['code'])) {
|
||||
$data['client_id'] = $this->client_id;
|
||||
$data['client_secret'] = $this->client_secret;
|
||||
$data['grant_type'] = 'authorization_code';
|
||||
$data['redirect_uri'] = $this->redirect_uri;
|
||||
$data['code'] = $_GET['code'];
|
||||
$api = $this->oauth_url . 'token';
|
||||
//$api = 'https://www.googleapis.com/oauth2/v4/token';
|
||||
$tmp = curl('POST',
|
||||
$api,
|
||||
json_encode($data)
|
||||
);
|
||||
if ($tmp['stat']==200) $ret = json_decode($tmp['body'], true);
|
||||
if (isset($ret['refresh_token'])) {
|
||||
$refresh_token = $ret['refresh_token'];
|
||||
$str = '
|
||||
refresh_token :<br>';
|
||||
$str .= '
|
||||
<textarea readonly style="width: 95%">' . $refresh_token . '</textarea><br><br>
|
||||
' . getconstStr('SavingToken') . '
|
||||
<script>
|
||||
var texta=document.getElementsByTagName(\'textarea\');
|
||||
for(i=0;i<texta.length;i++) {
|
||||
texta[i].style.height = texta[i].scrollHeight + \'px\';
|
||||
}
|
||||
</script>';
|
||||
$tmptoken['refresh_token'] = $refresh_token;
|
||||
//$tmptoken['token_expires'] = time()+7*24*60*60;
|
||||
$response = setConfigResponse( setConfig($tmptoken, $this->disktag) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
} else {
|
||||
savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60);
|
||||
$str .= '
|
||||
<meta http-equiv="refresh" content="3;URL=' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive">';
|
||||
return message($str, getconstStr('Wait') . ' 3s', 201);
|
||||
}
|
||||
}
|
||||
return message('<pre>' . $tmp['body'] . '</pre>', $tmp['stat']);
|
||||
//return message('<pre>' . json_encode($ret, JSON_PRETTY_PRINT) . '</pre>', 500);
|
||||
}
|
||||
|
||||
if (isset($_GET['install1'])) {
|
||||
if (get_class($this)=='Googledrive') {
|
||||
return message('
|
||||
<a href="" id="a1">' . getconstStr('JumptoOffice') . '</a>
|
||||
<script>
|
||||
url=location.protocol + "//" + location.host + "' . $url . '?install2&disktag=' . $_GET['disktag'] . '&AddDisk=' . get_class($this) . '";
|
||||
url="' . $this->oauth_url . 'auth?scope=' . $this->scope . '&response_type=code&client_id=' . $this->client_id . '&redirect_uri=' . $this->redirect_uri . '&access_type=offline&state=' . '"+encodeURIComponent(url);
|
||||
document.getElementById(\'a1\').href=url;
|
||||
//window.open(url,"_blank");
|
||||
location.href = url;
|
||||
</script>
|
||||
', getconstStr('Wait') . ' 1s', 201);
|
||||
} else {
|
||||
return message('Something error, retry after a few seconds.', 'Retry', 201);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['install0'])) {
|
||||
if ($_POST['disktag_add']!='') {
|
||||
$_POST['disktag_add'] = preg_replace('/[^0-9a-zA-Z|_]/i', '', $_POST['disktag_add']);
|
||||
$f = substr($_POST['disktag_add'], 0, 1);
|
||||
if (strlen($_POST['disktag_add'])==1) $_POST['disktag_add'] .= '_';
|
||||
if (isCommonEnv($_POST['disktag_add'])) {
|
||||
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>', 'Error', 201);
|
||||
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
|
||||
return message('Please start with letters<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'disktag=; path=/; \'+expires;
|
||||
</script>', 'Error', 201);
|
||||
}
|
||||
|
||||
$tmp = null;
|
||||
// clear envs
|
||||
foreach ($EnvConfigs as $env => $v) if (isInnerEnv($env)) $tmp[$env] = '';
|
||||
|
||||
//$this->disktag = $_POST['disktag_add'];
|
||||
$tmp['disktag_add'] = $_POST['disktag_add'];
|
||||
$tmp['diskname'] = $_POST['diskname'];
|
||||
$tmp['Driver'] = 'Googledrive';
|
||||
|
||||
if ($_POST['NT_Drive_custom']=='on') {
|
||||
$tmp['client_id'] = $_POST['NT_client_id'];
|
||||
$tmp['client_secret'] = $_POST['NT_client_secret'];
|
||||
}
|
||||
|
||||
$response = setConfigResponse( setConfig($tmp, $this->disktag) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
} else {
|
||||
$title = getconstStr('MayinEnv');
|
||||
$html = getconstStr('Wait') . ' 3s<meta http-equiv="refresh" content="3;URL=' . $url . '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=Googledrive">';
|
||||
}
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
}
|
||||
|
||||
$html = '
|
||||
<div>
|
||||
<form id="form1" action="" method="post" onsubmit="return notnull(this);">
|
||||
' . getconstStr('DiskTag') . ': (' . getConfig('disktag') . ')
|
||||
<input type="text" name="disktag_add" placeholder="' . getconstStr('EnvironmentsDescription')['disktag'] . '" style="width:100%"><br>
|
||||
' . getconstStr('DiskName') . ':
|
||||
<input type="text" name="diskname" placeholder="' . getconstStr('EnvironmentsDescription')['diskname'] . '" style="width:100%"><br>
|
||||
<br>
|
||||
<div>
|
||||
<label><input type="checkbox" name="NT_Drive_custom" onclick="document.getElementById(\'NT_secret\').style.display=(this.checked?\'\':\'none\');">' . getconstStr('CustomIdSecret') . '</label><br>
|
||||
<div id="NT_secret" style="display:none;margin:10px 35px">
|
||||
<a href="https://console.cloud.google.com/apis" target="_blank">' . getconstStr('GetSecretIDandKEY') . '</a><br>
|
||||
return_uri(Reply URL):<br>https://scfonedrive.github.io<br>
|
||||
client_id:<input type="text" name="NT_client_id" style="width:100%" placeholder="123456789-abcdefghijklmno.apps.googleusercontent.com"><br>
|
||||
client_secret:<input type="text" name="NT_client_secret" style="width:100%"><br>
|
||||
</div>
|
||||
</div>
|
||||
<br>';
|
||||
if ($_SERVER['language']=='zh-cn') $html .= '你要理解 scfonedrive.github.io 是github上的静态网站,<br><font color="red">除非github真的挂掉</font>了,<br>不然,稍后你如果连不上,请检查你的运营商或其它“你懂的”问题!<br>';
|
||||
$html .='
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.disktag_add.value==\'\') {
|
||||
alert(\'' . getconstStr('DiskTag') . '\');
|
||||
return false;
|
||||
}
|
||||
envs = [' . $envs . '];
|
||||
if (envs.indexOf(t.disktag_add.value)>-1) {
|
||||
alert("Do not input ' . $envs . '");
|
||||
return false;
|
||||
}
|
||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
||||
if (!reg.test(t.disktag_add.value)) {
|
||||
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (t.NT_Drive_custom.checked==true) {
|
||||
if (t.NT_client_secret.value==\'\'||t.NT_client_id.value==\'\') {
|
||||
alert(\'client_id & client_secret\');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("form1").action="?install0&disktag=" + t.disktag_add.value + "&AddDisk=Googledrive";
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
$title = 'Select Account Type';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
protected function get_access_token($refresh_token) {
|
||||
if (!$refresh_token) {
|
||||
$tmp['stat'] = 0;
|
||||
$tmp['body'] = 'No refresh_token';
|
||||
$this->error = $tmp;
|
||||
return false;
|
||||
}
|
||||
if (!($this->access_token = getcache('access_token', $this->disktag))) {
|
||||
$p=0;
|
||||
$data['client_id'] = $this->client_id;
|
||||
$data['client_secret'] = $this->client_secret;
|
||||
$data['grant_type'] = 'refresh_token';
|
||||
//$data['redirect_uri'] = $this->redirect_uri;
|
||||
$data['refresh_token'] = $refresh_token;
|
||||
while ($response['stat']==0&&$p<3) {
|
||||
//$response = curl('POST', 'https://www.googleapis.com/oauth2/v4/token', json_encode($data));
|
||||
$response = curl('POST', $this->oauth_url . 'token', json_encode($data));
|
||||
$p++;
|
||||
}
|
||||
if ($response['stat']==200) $ret = json_decode($response['body'], true);
|
||||
if (!isset($ret['access_token'])) {
|
||||
error_log1($this->oauth_url . 'token' . '?client_id=' . $this->client_id . '&client_secret=' . $this->client_secret . '&grant_type=refresh_token&refresh_token=' . substr($refresh_token, 0, 20) . '******' . substr($refresh_token, -20));
|
||||
error_log1('failed to get [' . $this->disktag . '] access_token. response: ' . $response['body']);
|
||||
$response['body'] = json_encode(json_decode($response['body']), JSON_PRETTY_PRINT);
|
||||
$response['body'] .= '\nfailed to get [' . $this->disktag . '] access_token.';
|
||||
$this->error = $response;
|
||||
return false;
|
||||
//throw new Exception($response['stat'].', failed to get ['.$this->disktag.'] access_token.'.$response['body']);
|
||||
}
|
||||
$tmp = $ret;
|
||||
$tmp['access_token'] = substr($tmp['access_token'], 0, 10) . '******';
|
||||
//$tmp['refresh_token'] = substr($tmp['refresh_token'], 0, 10) . '******';
|
||||
error_log1('[' . $this->disktag . '] Get access token:' . json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
$this->access_token = $ret['access_token'];
|
||||
savecache('access_token', $this->access_token, $this->disktag, $ret['expires_in'] - 300);
|
||||
//if (time()>getConfig('token_expires', $this->disktag)) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ], $this->disktag);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public function getDiskSpace() {
|
||||
if ($this->driveId!='root') return '0 / 0';
|
||||
if (!($diskSpace = getcache('diskSpace', $this->disktag))) {
|
||||
$url = $this->api_url . '/about?fields=storageQuota';
|
||||
$response = $this->GDAPI('GET', $url);
|
||||
if ($response['stat']==200) {
|
||||
$res = json_decode($response['body'], true)['storageQuota'];
|
||||
$used = size_format($res['usage']);
|
||||
$total = size_format($res['limit']);
|
||||
$diskSpace = $used . ' / ' . $total;
|
||||
savecache('diskSpace', $diskSpace, $this->disktag);
|
||||
} else return json_encode($response);
|
||||
}
|
||||
return $diskSpace;
|
||||
}
|
||||
|
||||
protected function GDAPI($method, $url, $data = '')
|
||||
{
|
||||
/*if (substr($path,0,7) == 'http://' or substr($path,0,8) == 'https://') {
|
||||
$url = $path;
|
||||
} else {
|
||||
$url = $this->api_url;
|
||||
if ($path=='' or $path=='/') {
|
||||
$url .= '/';
|
||||
} else {
|
||||
$url .= ':' . $path;
|
||||
if (substr($url,-1)=='/') $url=substr($url,0,-1);
|
||||
}
|
||||
if ($method=='PUT') {
|
||||
if ($path=='' or $path=='/') {
|
||||
$url .= 'content';
|
||||
} else {
|
||||
$url .= ':/content';
|
||||
}
|
||||
$headers['Content-Type'] = 'text/plain';
|
||||
} elseif ($method=='PATCH') {
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
} elseif ($method=='POST') {
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
} elseif ($method=='DELETE') {
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
} else {
|
||||
if ($path=='' or $path=='/') {
|
||||
$url .= $method;
|
||||
} else {
|
||||
$url .= ':/' . $method;
|
||||
}
|
||||
$method='POST';
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
}*/
|
||||
$headers['Authorization'] = 'Bearer ' . $this->access_token;
|
||||
if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
//if (!isset($headers['Referer'])) $headers['Referer'] = $url;*
|
||||
$sendHeaders = array();
|
||||
foreach ($headers as $headerName => $headerVal) {
|
||||
$sendHeaders[] = $headerName . ': ' . $headerVal;
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
|
||||
$response['body'] = curl_exec($ch);
|
||||
$response['stat'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
//$response['Location'] = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
/*error_log1($response['stat'].'
|
||||
' . $response['body'].'
|
||||
' . $url.'
|
||||
' . $data);*/
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
+1061
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class OnedriveCN extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
|
||||
$this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
|
||||
}
|
||||
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
|
||||
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/me/drive/root';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class Sharelink extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
$this->api_url = getConfig('shareapiurl', $tag);
|
||||
$res = $this->get_access_token(1);
|
||||
//$this->ext_api_url = '/me/drive/root';
|
||||
$this->DownurlStrName = '@content.downloadUrl';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'shareurl' ];
|
||||
}
|
||||
|
||||
protected function get_access_token($refresh_token) {
|
||||
if (!($this->access_token = getcache('access_token', $this->disktag))) {
|
||||
$shareurl = getConfig('shareurl', $this->disktag);
|
||||
if (!($this->sharecookie = getcache('sharecookie', $this->disktag))) {
|
||||
$res = curl('GET', $shareurl, '', [], 1);
|
||||
error_log1(json_encode($res, JSON_PRETTY_PRINT));
|
||||
if (isset($res['returnhead']['Set-Cookie'])) $this->sharecookie = $res['returnhead']['Set-Cookie'];
|
||||
if (isset($res['returnhead']['set-cookie'])) $this->sharecookie = $res['returnhead']['set-cookie'];
|
||||
if ($this->sharecookie=='') {
|
||||
$this->error = $res;
|
||||
return false;
|
||||
}
|
||||
savecache('sharecookie', $this->sharecookie, $this->disktag);
|
||||
}
|
||||
$tmp1 = splitlast($shareurl, '/')[0];
|
||||
$account = splitlast($tmp1, '/')[1];
|
||||
$domain = splitlast($shareurl, '/:')[0];
|
||||
$response = curl('POST',
|
||||
$domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE",
|
||||
'{"parameters":{"__metadata":{"type":"SP.RenderListDataParameters"},"RenderOptions":136967,"AllowMultipleValueFilterForTaxonomyFields":true,"AddRequiredFields":true}}',
|
||||
[ 'Accept' => 'application/json;odata=verbose', 'Content-Type' => 'application/json;odata=verbose', 'origin' => $domain, 'Cookie' => $this->sharecookie ]
|
||||
);
|
||||
if ($response['stat']==200) $ret = json_decode($response['body'], true);
|
||||
$this->access_token = splitlast($ret['ListSchema']['.driveAccessToken'],'=')[1];
|
||||
$this->api_url = $ret['ListSchema']['.driveUrl'].'/root';
|
||||
if (!$this->access_token) {
|
||||
error_log1($domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE");
|
||||
error_log1('failed to get share access_token. response' . json_encode($ret));
|
||||
//$response['body'] = json_encode(json_decode($response['body']), JSON_PRETTY_PRINT);
|
||||
$response['body'] .= '<br>' .json_decode($response['body'], true)['error']['message']['value'];
|
||||
$response['body'] .= '<br>failed to get shareurl access_token.';
|
||||
$this->error = $response;
|
||||
return false;
|
||||
//throw new Exception($response['stat'].', failed to get share access_token.'.$response['body']);
|
||||
}
|
||||
//$tmp = $ret;
|
||||
//$tmp['access_token'] = '******';
|
||||
//error_log1('['.$this->disktag.'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
savecache('access_token', $this->access_token, $this->disktag);
|
||||
$tmp1 = null;
|
||||
if (getConfig('shareapiurl', $this->disktag)!=$this->api_url) $tmp1['shareapiurl'] = $this->api_url;
|
||||
//if (getConfig('sharecookie', $this->disktag)!=$this->sharecookie) $tmp1['sharecookie'] = $this->sharecookie;
|
||||
if (!!$tmp1) setConfig($tmp1, $this->disktag);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class Sharepoint extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '734ef928-d74c-4555-8d1b-d942fa0a1a41';
|
||||
$this->client_secret = '_I5gOpmG5vTC2Ts_K._wCW4nN1km~4Pk52';
|
||||
}
|
||||
$this->oauth_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://graph.microsoft.com/v1.0';
|
||||
$this->scope = 'https://graph.microsoft.com/Files.ReadWrite.All https://graph.microsoft.com/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'sharepointSite', 'siteid' ];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class SharepointCN extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
|
||||
$this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
|
||||
}
|
||||
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
|
||||
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'sharepointSite', 'siteid' ];
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
//error_reporting(E_ALL & ~E_NOTICE);
|
||||
error_reporting(0);
|
||||
include 'vendor/autoload.php';
|
||||
include 'conststr.php';
|
||||
include 'common.php';
|
||||
|
||||
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
|
||||
//echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>';
|
||||
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||
if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php';
|
||||
else include 'platform/TencentSCF_env.php';
|
||||
@@ -15,8 +17,6 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||
//else include 'platform/HuaweiFG_env.php';
|
||||
echo 'FG' . PHP_EOL;
|
||||
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
|
||||
//set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/php');
|
||||
//include 'BaiduBce.phar';
|
||||
include 'platform/BaiduCFC.php';
|
||||
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
|
||||
include 'platform/Heroku.php';
|
||||
@@ -31,6 +31,19 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||
}
|
||||
http_response_code($re['statusCode']);
|
||||
echo $re['body'];
|
||||
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
|
||||
include 'platform/Vercel.php';
|
||||
$path = getpath();
|
||||
//echo 'path:'. $path;
|
||||
$_GET = getGET();
|
||||
//echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
|
||||
$re = main($path);
|
||||
$sendHeaders = array();
|
||||
foreach ($re['headers'] as $headerName => $headerVal) {
|
||||
header($headerName . ': ' . $headerVal, true);
|
||||
}
|
||||
http_response_code($re['statusCode']);
|
||||
echo $re['body'];
|
||||
} else {
|
||||
include 'platform/Normal.php';
|
||||
$path = getpath();
|
||||
@@ -136,28 +149,3 @@ function handler($event, $context)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// used by Aliyun FC
|
||||
function myErrorHandler($errno, $errstr, $errfile, $errline) {
|
||||
if (!(error_reporting() & $errno)) {
|
||||
return false;
|
||||
}
|
||||
switch ($errno) {
|
||||
case E_USER_ERROR:
|
||||
$errInfo = array(
|
||||
"errorMessage" => $errstr,
|
||||
"errorType" => \ServerlessFC\friendly_error_type($errno),
|
||||
"stackTrace" => array(
|
||||
"file" => $errfile,
|
||||
"line" => $errline,
|
||||
),
|
||||
);
|
||||
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||
break;
|
||||
|
||||
default: // E_USER_WARNING | E_USER_NOTICE
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+72
-20
@@ -28,7 +28,6 @@ function GetGlobalVariable($event)
|
||||
$pos = strpos($cookievalues,"=");
|
||||
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
|
||||
}
|
||||
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
|
||||
}
|
||||
|
||||
function GetPathSetting($event, $context)
|
||||
@@ -44,30 +43,38 @@ function GetPathSetting($event, $context)
|
||||
if ($path=='/'||$path=='') {
|
||||
$_SERVER['base_path'] = $tmp;
|
||||
} else {
|
||||
$_SERVER['base_path'] = substr($tmp, 0, -strlen($path)+1);
|
||||
$_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($path)+1);
|
||||
}
|
||||
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['clientIP'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'][0];
|
||||
if (isset($event['headers']['Authorization'])) {
|
||||
$basicAuth = splitfirst(base64_decode(splitfirst($event['headers']['Authorization'][0], 'Basic ')[1]), ':');
|
||||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['HTTP_HOST'] = $event['headers']['Host'][0];
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'][0];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
|
||||
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode(getenv($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($env[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode(getenv($str));
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
@@ -75,29 +82,36 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|", getConfig('disktag'));
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -105,12 +119,23 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = '';
|
||||
}
|
||||
}
|
||||
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
|
||||
//';
|
||||
$response = updateEnvironment($tmp, $_SERVER['accountId'], $_SERVER['region'], $_SERVER['service_name'], $_SERVER['function_name'], getConfig('AccessKeyID'), getConfig('AccessKeySecret'));
|
||||
@@ -237,7 +262,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -313,7 +338,8 @@ function updateEnvironment($Envs, $accountId, $region, $service_name, $function_
|
||||
$tmp_env[$key1] = $value1;
|
||||
}
|
||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
|
||||
ksort($tmp_env);
|
||||
//ksort($tmp_env);
|
||||
sortConfig($tmp_env);
|
||||
|
||||
$tmpdata['environmentVariables'] = $tmp_env;
|
||||
return FCAPI2016($config, 'PUT', json_encode($tmpdata));
|
||||
@@ -449,3 +475,29 @@ function addFileToZip($zip, $rootpath, $path = '')
|
||||
}
|
||||
@closedir($path);
|
||||
}
|
||||
|
||||
function myErrorHandler($errno, $errstr, $errfile, $errline) {
|
||||
if (!(error_reporting() & $errno)) {
|
||||
return false;
|
||||
}
|
||||
switch ($errno) {
|
||||
case E_USER_ERROR:
|
||||
$errInfo = array(
|
||||
"errorMessage" => $errstr,
|
||||
"errorType" => \ServerlessFC\friendly_error_type($errno),
|
||||
"stackTrace" => array(
|
||||
"file" => $errfile,
|
||||
"line" => $errline,
|
||||
),
|
||||
);
|
||||
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||
break;
|
||||
default: // E_USER_WARNING | E_USER_NOTICE
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+52
-22
@@ -26,9 +26,6 @@ function GetGlobalVariable($event)
|
||||
$pos = strpos($cookievalues,"=");
|
||||
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
|
||||
}
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['User-Agent'];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
|
||||
}
|
||||
|
||||
function GetPathSetting($event, $context)
|
||||
@@ -39,25 +36,35 @@ function GetPathSetting($event, $context)
|
||||
$path = $event['path'];
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['X-Requested-With'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['User-Agent'];
|
||||
if (isset($event['headers']['authorization'])) {
|
||||
$basicAuth = splitfirst(base64_decode(splitfirst($event['headers']['authorization'], 'Basic ')[1]), ':');
|
||||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['HTTP_HOST'] = $event['headers']['Host'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode(getenv($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($env[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode(getenv($str));
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
@@ -65,29 +72,36 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -95,12 +109,23 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = '';
|
||||
}
|
||||
}
|
||||
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
|
||||
//';
|
||||
$response = updateEnvironment($tmp, getConfig('SecretId'), getConfig('SecretKey'));
|
||||
@@ -224,7 +249,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -294,7 +319,8 @@ function updateEnvironment($Envs, $SecretId, $SecretKey)
|
||||
$tmp_env[$key1] = $value1;
|
||||
}
|
||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
|
||||
ksort($tmp_env);
|
||||
//ksort($tmp_env);
|
||||
sortConfig($tmp_env);
|
||||
|
||||
$tmp['Environment']['Variables'] = $tmp_env;
|
||||
$data = json_encode($tmp);
|
||||
@@ -337,7 +363,7 @@ function api_error_msg($response)
|
||||
{
|
||||
if (isset($response['code'])) $html = $response['code'] . '<br>
|
||||
' . $response['message'];
|
||||
else $html = var_dump($response);
|
||||
else $html = json_encode($response, JSON_PRETTY_PRINT);
|
||||
return $html . '<br><br>
|
||||
BRN: ' . $_SERVER['functionBrn'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
@@ -405,3 +431,7 @@ function addFileToZip($zip, $rootpath, $path = '')
|
||||
}
|
||||
@closedir($path);
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+96
-38
@@ -1,9 +1,37 @@
|
||||
<?php
|
||||
// https://devcenter.heroku.com/articles/platform-api-reference#build-create
|
||||
|
||||
function getpath()
|
||||
{
|
||||
if (getConfig('function_name') && getConfig('APIKey')) {
|
||||
$APIKey = getConfig('APIKey');
|
||||
$res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('function_name'), '', $APIKey);
|
||||
$response = json_decode($res['body'], true);
|
||||
if (isset($response['build_stack'])) {
|
||||
$tmp['HerokuappId'] = $response['id'];
|
||||
$tmp['function_name'] = null;
|
||||
} else {
|
||||
error_log1('Something error' . 'Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT));
|
||||
//return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
|
||||
}
|
||||
$response = json_decode(setHerokuConfig($tmp, $tmp['HerokuappId'], $APIKey)['body'], true);
|
||||
$title = 'Change function_name to HerokuappId';
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$stat = 500;
|
||||
error_log1('Change function_name to HerokuappId' . $html);
|
||||
} else {
|
||||
$html = getconstStr('Wait') . ' 5s, jump to index.
|
||||
<meta http-equiv="refresh" content="5;URL=/">';
|
||||
$stat = 201;
|
||||
}
|
||||
//return message($html, $title, $stat);
|
||||
}
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_X_FORWARDED_PROTO'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
$_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
|
||||
@@ -15,14 +43,14 @@ function getpath()
|
||||
|
||||
function getGET()
|
||||
{
|
||||
//error_log('POST:' . json_encode($_POST));
|
||||
//error_log1('POST:' . json_encode($_POST));
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
//error_log('RAW:' . $tmpdata);
|
||||
//error_log1('RAW:' . $tmpdata);
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
//error_log('PHPINPUT:' . $tmpdata);
|
||||
//error_log1('PHPINPUT:' . $tmpdata);
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
@@ -30,7 +58,7 @@ function getGET()
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
//error_log('POSTformPHPINPUT:' . json_encode($_POST));
|
||||
//error_log1('POSTformPHPINPUT:' . json_encode($_POST));
|
||||
}
|
||||
}
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
@@ -58,17 +86,15 @@ function getGET()
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode(getenv($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($env[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode(getenv($str));
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
@@ -76,29 +102,36 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
if ($disktag!='') $diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -106,16 +139,27 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = null;
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = '';
|
||||
else $tmp['disktag'] = null;
|
||||
}
|
||||
}
|
||||
foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
|
||||
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
|
||||
//';
|
||||
return setHerokuConfig($tmp, getConfig('function_name'), getConfig('APIKey'));
|
||||
|
||||
return setHerokuConfig($tmp, getConfig('HerokuappId'), getConfig('APIKey'));
|
||||
error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
function install()
|
||||
@@ -131,15 +175,25 @@ function install()
|
||||
$APIKey = $_POST['APIKey'];
|
||||
$tmp['APIKey'] = $APIKey;
|
||||
}
|
||||
$HerokuappId = getConfig('HerokuappId');
|
||||
if ($HerokuappId=='') {
|
||||
$function_name = getConfig('function_name');
|
||||
if ($function_name=='') {
|
||||
$tmp1 = substr($_SERVER['HTTP_HOST'], 0, strrpos($_SERVER['HTTP_HOST'], '.'));
|
||||
$maindomain = substr($tmp1, strrpos($tmp1, '.')+1);
|
||||
if ($maindomain=='herokuapp') $function_name = substr($tmp1, 0, strrpos($tmp1, '.'));
|
||||
else $function_name = 'visit from xxxx.herokuapp.com';
|
||||
$tmp['function_name'] = $function_name;
|
||||
else return message('Please visit from xxxx.herokuapp.com', '', 500);
|
||||
$res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . $function_name, '', $APIKey);
|
||||
$response = json_decode($res['body'], true);
|
||||
if (isset($response['build_stack'])) {
|
||||
$HerokuappId = $response['id'];
|
||||
} else {
|
||||
return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
|
||||
}
|
||||
$response = json_decode(setHerokuConfig($tmp, $function_name, $APIKey)['body'], true);
|
||||
}
|
||||
}
|
||||
$tmp['HerokuappId'] = $HerokuappId;
|
||||
$response = json_decode(setHerokuConfig($tmp, $HerokuappId, $APIKey)['body'], true);
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
@@ -147,7 +201,7 @@ function install()
|
||||
return output('Jump
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
@@ -206,7 +260,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -223,7 +277,7 @@ function HerokuAPI($method, $url, $data = '', $apikey)
|
||||
foreach ($headers as $headerName => $headerVal) {
|
||||
$sendHeaders[] = $headerName . ': ' . $headerVal;
|
||||
}
|
||||
error_log($method . $url . $data . $apikey);
|
||||
error_log1($method . $url . $data . $apikey);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
|
||||
@@ -238,28 +292,28 @@ function HerokuAPI($method, $url, $data = '', $apikey)
|
||||
$response['body'] = curl_exec($ch);
|
||||
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
error_log($response['stat'].'
|
||||
error_log1($response['stat'].'
|
||||
'.$response['body'].'
|
||||
');
|
||||
return $response;
|
||||
}
|
||||
|
||||
function getHerokuConfig($function_name, $apikey)
|
||||
function getHerokuConfig($HerokuappId, $apikey)
|
||||
{
|
||||
return HerokuAPI('GET', 'https://api.heroku.com/apps/' . $function_name . '/config-vars', '', $apikey);
|
||||
return HerokuAPI('GET', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', '', $apikey);
|
||||
}
|
||||
|
||||
function setHerokuConfig($env, $function_name, $apikey)
|
||||
function setHerokuConfig($env, $HerokuappId, $apikey)
|
||||
{
|
||||
$data = json_encode($env);
|
||||
return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $function_name . '/config-vars', $data, $apikey);
|
||||
if (substr($data, 0, 1)=='{') return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', $data, $apikey);
|
||||
}
|
||||
|
||||
function updateHerokuapp($function_name, $apikey, $source)
|
||||
function updateHerokuapp($HerokuappId, $apikey, $source)
|
||||
{
|
||||
$tmp['source_blob']['url'] = $source;
|
||||
$data = json_encode($tmp);
|
||||
return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $function_name . '/builds', $data, $apikey);
|
||||
return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
@@ -279,10 +333,14 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||
{
|
||||
//'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
|
||||
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
return updateHerokuapp(getConfig('function_name'), getConfig('APIKey'), $source);
|
||||
return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode( $response['body'], true );
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+50
-21
@@ -39,9 +39,6 @@ function GetGlobalVariable($event)
|
||||
$pos = strpos($cookievalues,"=");
|
||||
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
|
||||
}
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
}
|
||||
|
||||
function GetPathSetting($event, $context)
|
||||
@@ -61,26 +58,35 @@ function GetPathSetting($event, $context)
|
||||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
if (isset($event['headers']['authorization'])) {
|
||||
$basicAuth = splitfirst(base64_decode(splitfirst($event['headers']['authorization'], 'Basic ')[1]), ':');
|
||||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
global $contextUserData;
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode($contextUserData->getUserData($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($env[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($contextUserData->getUserData($str));
|
||||
if (isBase64Env($str)) return base64y_decode($contextUserData->getUserData($str));
|
||||
else return $contextUserData->getUserData($str);
|
||||
}
|
||||
return '';
|
||||
@@ -88,30 +94,37 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
global $contextUserData;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$diskconfig = json_decode($contextUserData->getUserData($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -119,12 +132,23 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = '';
|
||||
}
|
||||
}
|
||||
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
|
||||
//';
|
||||
$response = updateEnvironment($tmp, getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'));
|
||||
@@ -270,7 +294,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -349,7 +373,8 @@ function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
|
||||
$tmp_env[$key1] = $value1;
|
||||
}
|
||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
|
||||
ksort($tmp_env);
|
||||
//ksort($tmp_env);
|
||||
sortConfig($tmp_env);
|
||||
|
||||
$tmpdata['handler'] = 'index.handler';
|
||||
$tmpdata['memory_size'] = $contextUserData->getMemorySize()+1-1;
|
||||
@@ -462,3 +487,7 @@ function addFileToZip($zip, $rootpath, $path = '')
|
||||
}
|
||||
@closedir($path);
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+65
-31
@@ -39,9 +39,6 @@ function GetGlobalVariable($event)
|
||||
$pos = strpos($cookievalues,"=");
|
||||
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
|
||||
}
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
}
|
||||
|
||||
function GetPathSetting($event, $context)
|
||||
@@ -61,31 +58,42 @@ function GetPathSetting($event, $context)
|
||||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['headers']['x-real-ip'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
if (isset($event['headers']['authorization'])) {
|
||||
$basicAuth = splitfirst(base64_decode(splitfirst($event['headers']['authorization'], 'Basic ')[1]), ':');
|
||||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
//include 'config.php';
|
||||
$s = file_get_contents(__DIR__ . '/../config.php');
|
||||
//$configs = substr($s, 18, -2);
|
||||
|
||||
global $slash;
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') {
|
||||
$envs = json_decode($configs, true);
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
if (isset($envs[$disktag][$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($envs[$disktag][$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
|
||||
else return $envs[$disktag][$str];
|
||||
}
|
||||
} else {
|
||||
if (isset($envs[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($envs[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$str]);
|
||||
else return $envs[$str];
|
||||
}
|
||||
}
|
||||
@@ -95,20 +103,23 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
//include 'config.php';
|
||||
$s = file_get_contents(__DIR__ . '/../config.php');
|
||||
//$configs = substr($s, 18, -2);
|
||||
global $slash;
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
else $envs[$disktag][$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
@@ -118,9 +129,15 @@ function setConfig($arr, $disktag = '')
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$envs[$newtag] = $envs[$v];
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
$envs[$k] = $v;
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -130,13 +147,24 @@ function setConfig($arr, $disktag = '')
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$envs['disktag'] = implode('|', $tags);
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
$envs[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
//ksort($envs);
|
||||
$response = updateEnvironment($envs, getConfig('HW_urn'), getConfig('HW_key'), getConfig('HW_secret'));
|
||||
return $response;
|
||||
}
|
||||
@@ -280,7 +308,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -340,7 +368,7 @@ function getfunctioncode($HW_urn, $HW_key, $HW_secret)
|
||||
' . '/' . $bucket . '/' . $path;
|
||||
|
||||
$signature = base64_encode(hash_hmac('sha1', $StringToSign, $HW_secret, true));
|
||||
$response = curl_request($url, false, [ 'Authorization' => 'OBS ' . $HW_key . ':' . $signature, 'x-obs-date' => $date, 'Content-Type' => '' ]);
|
||||
$response = curl('GET', $url, false, [ 'Authorization' => 'OBS ' . $HW_key . ':' . $signature, 'x-obs-date' => $date, 'Content-Type' => '' ]);
|
||||
//if ($response['stat']==200) return $response['body'];
|
||||
if ($response['stat']==0) return json_encode( [ 'error_code' => 'Network', 'error_msg' => 'Network error in getting code.' ] );
|
||||
else return $response['body'];
|
||||
@@ -369,9 +397,8 @@ function copyFolder($from, $to)
|
||||
|
||||
function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
|
||||
{
|
||||
|
||||
sortConfig($Envs);
|
||||
//echo json_encode($Envs,JSON_PRETTY_PRINT);
|
||||
global $contextUserData;
|
||||
$source = '/tmp/code.zip';
|
||||
$outPath = '/tmp/code/';
|
||||
$oldcode = '/tmp/oldcode.zip';
|
||||
@@ -384,7 +411,7 @@ function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
|
||||
// 将配置写入
|
||||
$prestr = '<?php $configs = \'' . PHP_EOL;
|
||||
$aftstr = PHP_EOL . '\';';
|
||||
file_put_contents($outPath . 'config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
file_put_contents($outPath . '.data/config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
|
||||
// 将目录中文件打包成zip
|
||||
//$zip=new ZipArchive();
|
||||
@@ -399,6 +426,7 @@ function updateEnvironment($Envs, $HW_urn, $HW_key, $HW_secret)
|
||||
|
||||
function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
|
||||
{
|
||||
global $slash;
|
||||
//echo json_encode($Envs,JSON_PRETTY_PRINT);
|
||||
if ($Envs['ONEMANAGER_CONFIG_SAVE'] == 'file') $envs = Array( 'ONEMANAGER_CONFIG_SAVE' => 'file' );
|
||||
else {
|
||||
@@ -440,15 +468,17 @@ function SetbaseConfig($Envs, $HW_urn, $HW_key, $HW_secret)
|
||||
if (api_error(setConfigResponse($response))) {
|
||||
return $response;
|
||||
}
|
||||
$s = file_get_contents(__DIR__ . '/../config.php');
|
||||
//$configs = substr($s, 18, -2);
|
||||
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $tmp_env = json_decode($configs, true);
|
||||
foreach ($Envs as $k => $v) {
|
||||
$tmp_env[$k] = $v;
|
||||
}
|
||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null');
|
||||
ksort($tmp_env);
|
||||
//ksort($tmp_env);
|
||||
$response = updateEnvironment($tmp_env, $HW_urn, $HW_key, $HW_secret);
|
||||
return $response;
|
||||
}
|
||||
@@ -530,7 +560,7 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||
}
|
||||
|
||||
// 放入配置文件
|
||||
file_put_contents($outPath . '/config.php', file_get_contents(__DIR__.'/../config.php'));
|
||||
file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
|
||||
|
||||
// 将目录中文件打包成zip
|
||||
//$zip=new ZipArchive();
|
||||
@@ -838,3 +868,7 @@ class Signer
|
||||
return $curl;
|
||||
}
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+57
-25
@@ -4,6 +4,16 @@ function getpath()
|
||||
{
|
||||
$_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_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
|
||||
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
||||
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
||||
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
||||
}
|
||||
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
|
||||
}
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/app') $_SERVER['base_path'] = '/';
|
||||
else $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
@@ -58,27 +68,22 @@ function getGET()
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
|
||||
$slash = '/';
|
||||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
global $slash;
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') {
|
||||
$envs = json_decode($configs, true);
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
if (isset($envs[$disktag][$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($envs[$disktag][$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
|
||||
else return $envs[$disktag][$str];
|
||||
}
|
||||
} else {
|
||||
if (isset($envs[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($envs[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$str]);
|
||||
else return $envs[$str];
|
||||
}
|
||||
}
|
||||
@@ -88,23 +93,22 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
global $slash;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$slash = '/';
|
||||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
$disktags = explode("|", getConfig('disktag'));
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
else $envs[$disktag][$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
@@ -114,9 +118,20 @@ function setConfig($arr, $disktag = '')
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$envs[$newtag] = $envs[$v];
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
//$tmpdisk = json_decode($v, true);
|
||||
//var_dump($tmpdisk);
|
||||
//error_log(json_encode($tmpdisk));
|
||||
//if ($tmpdisk===null)
|
||||
$envs[$k] = $v;
|
||||
//else $envs[$k] = $tmpdisk;
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -126,13 +141,26 @@ function setConfig($arr, $disktag = '')
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$envs['disktag'] = implode('|', $tags);
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
unset($envs[$arr['disktag_rename']]);
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
//ksort($envs);
|
||||
sortConfig($envs);
|
||||
|
||||
//echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';
|
||||
$prestr = '<?php $configs = \'' . PHP_EOL;
|
||||
$aftstr = PHP_EOL . '\';';
|
||||
@@ -206,7 +234,7 @@ function install()
|
||||
url += location.pathname;
|
||||
if (url.substr(-1)!="/") url += "/";
|
||||
url += "app.json";
|
||||
//alert(url);
|
||||
url += "?" + Date.now();
|
||||
var xhr4 = new XMLHttpRequest();
|
||||
xhr4.open("GET", url);
|
||||
xhr4.setRequestHeader("x-requested-with","XMLHttpRequest");
|
||||
@@ -218,7 +246,7 @@ function install()
|
||||
document.getElementById("submitbtn").disabled = false;
|
||||
document.getElementById("formdiv").style.display = "";
|
||||
} else {
|
||||
alert("Url: " + url + "\nExpect http code 201, but received " + xhr4.status);
|
||||
alert("' . getconstStr('MakesuerRewriteOn') . '?\nfalse\n\nUrl: " + url + "\nExpect http code 201, but received " + xhr4.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +279,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -296,8 +324,8 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||
$githubfile = file_get_contents($url);
|
||||
if (!$githubfile) return 0;
|
||||
file_put_contents($tarfile, $githubfile);
|
||||
if (splitfirst(PHP_VERSION, '.')[0] == '7') {
|
||||
$phar = new PharData($tarfile); // need php7
|
||||
if (splitfirst(PHP_VERSION, '.')[0] > '5') {
|
||||
$phar = new PharData($tarfile); // need php5.3, 7, 8
|
||||
$phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
|
||||
} else {
|
||||
ob_start();
|
||||
@@ -315,7 +343,7 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||
break;
|
||||
}
|
||||
}
|
||||
//error_log($outPath);
|
||||
//error_log1($outPath);
|
||||
if ($outPath=='') return 0;
|
||||
|
||||
//unlink($outPath.'/config.php');
|
||||
@@ -357,3 +385,7 @@ function moveFolder($from, $to, $slash)
|
||||
rmdir($from);
|
||||
return json_encode( [ 'response' => 'success' ] );
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+200
-33
@@ -23,9 +23,6 @@ function GetGlobalVariable($event)
|
||||
$pos = strpos($cookievalues,"=");
|
||||
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
|
||||
}
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
$_SERVER['USER'] = 'qcloud';
|
||||
}
|
||||
|
||||
function GetPathSetting($event, $context)
|
||||
@@ -33,7 +30,7 @@ function GetPathSetting($event, $context)
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['accept-language'],';')[0],',')[0]);
|
||||
$_SERVER['function_name'] = $context['function_name'];
|
||||
$_SERVER['namespace'] = $context['namespace'];
|
||||
$_SERVER['Region'] = getenv('TENCENTCLOUD_REGION');
|
||||
$_SERVER['Region'] = $context['tencentcloud_region'];
|
||||
$host_name = $event['headers']['host'];
|
||||
$_SERVER['HTTP_HOST'] = $host_name;
|
||||
$serviceId = $event['requestContext']['serviceId'];
|
||||
@@ -46,25 +43,35 @@ function GetPathSetting($event, $context)
|
||||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
if (isset($event['headers']['authorization'])) {
|
||||
$basicAuth = splitfirst(base64_decode(splitfirst($event['headers']['authorization'], 'Basic ')[1]), ':');
|
||||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-api-scheme'];
|
||||
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
$_SERVER['USER'] = 'qcloud';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode(getenv($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($env[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode(getenv($str));
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
@@ -72,29 +79,36 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
$diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$oparetdisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $diskconfig[$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$oparetdisk = 1;
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -102,12 +116,23 @@ function setConfig($arr, $disktag = '')
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($oparetdisk) {
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = '';
|
||||
}
|
||||
}
|
||||
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
|
||||
//';
|
||||
$response = updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
|
||||
@@ -248,7 +273,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -316,7 +341,8 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
|
||||
}
|
||||
$tmp_env = array_filter($tmp_env, 'array_value_isnot_null'); // remove null. 清除空值
|
||||
//$tmp_env['Region'] = $Region;
|
||||
ksort($tmp_env);
|
||||
//ksort($tmp_env);
|
||||
sortConfig($tmp_env);
|
||||
|
||||
$i = 0;
|
||||
foreach ($tmp_env as $key1 => $value1) {
|
||||
@@ -345,9 +371,6 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
|
||||
{
|
||||
//echo json_encode($Envs,JSON_PRETTY_PRINT);
|
||||
if ($Envs['ONEMANAGER_CONFIG_SAVE'] == 'file') $Envs = Array( 'ONEMANAGER_CONFIG_SAVE' => 'file' );
|
||||
/*$trynum = 0;
|
||||
while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
|
||||
'.++$trynum;*/
|
||||
//json_decode($a,true)['Response']['Environment']['Variables'][0]['Key']
|
||||
$tmp = json_decode(getfunctioninfo($function_name, $Region, $Namespace, $SecretId, $SecretKey),true)['Response']['Environment']['Variables'];
|
||||
foreach ($tmp as $tmp1) {
|
||||
@@ -387,7 +410,7 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
|
||||
return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr));
|
||||
}
|
||||
|
||||
function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source)
|
||||
function updateProgram_OLD($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source)
|
||||
{
|
||||
WaitSCFStat();
|
||||
$meth = 'POST';
|
||||
@@ -426,14 +449,158 @@ namespace:' . $_SERVER['namespace'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
$source['url'] = 'https://github.com/' . $auth . '/' . $project;
|
||||
$source['branch'] = $branch;
|
||||
return updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'), $source);
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode( $response, true )['Response'];
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
//$trynum = 0;
|
||||
//while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']!='Active' ) echo '
|
||||
//'.++$trynum;
|
||||
if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKey, $source)
|
||||
{
|
||||
$secretId = $SecretId;
|
||||
$secretKey = $SecretKey;
|
||||
$host = 'scf.tencentcloudapi.com';
|
||||
$service = "scf";
|
||||
$version = "2018-04-16";
|
||||
$action = "UpdateFunctionCode";
|
||||
$region = $Region;
|
||||
$timestamp = time();
|
||||
$algorithm = "TC3-HMAC-SHA256";
|
||||
|
||||
// step 1: build canonical request string
|
||||
$httpRequestMethod = "POST";
|
||||
$canonicalUri = "/";
|
||||
$canonicalQueryString = "";
|
||||
$canonicalHeaders = "content-type:application/json; charset=utf-8\n"."host:".$host."\n";
|
||||
$signedHeaders = "content-type;host";
|
||||
|
||||
//$tmpdata['Action'] = 'UpdateFunctionCode';
|
||||
$tmpdata['Code']['ZipFile'] = base64_encode( file_get_contents($source) );
|
||||
$tmpdata['CodeSource'] = 'ZipFile';
|
||||
$tmpdata['FunctionName'] = $function_name;
|
||||
$tmpdata['Handler'] = 'index.main_handler';
|
||||
//$tmpdata['Namespace'] = $Namespace;
|
||||
//$tmpdata['Nonce'] = time();
|
||||
//$tmpdata['Region'] = $Region;
|
||||
//$tmpdata['SecretId'] = $SecretId;
|
||||
//$tmpdata['Timestamp'] = time();
|
||||
//$tmpdata['Token'] = '';
|
||||
//$tmpdata['Version'] = '2018-04-16';
|
||||
$payload = json_encode($tmpdata);
|
||||
//$payload = '{"Limit": 1, "Filters": [{"Values": ["\u672a\u547d\u540d"], "Name": "instance-name"}]}';
|
||||
$hashedRequestPayload = hash("SHA256", $payload);
|
||||
$canonicalRequest = $httpRequestMethod."\n"
|
||||
.$canonicalUri."\n"
|
||||
.$canonicalQueryString."\n"
|
||||
.$canonicalHeaders."\n"
|
||||
.$signedHeaders."\n"
|
||||
.$hashedRequestPayload;
|
||||
//echo $canonicalRequest.PHP_EOL;
|
||||
|
||||
// step 2: build string to sign
|
||||
$date = gmdate("Y-m-d", $timestamp);
|
||||
$credentialScope = $date."/".$service."/tc3_request";
|
||||
$hashedCanonicalRequest = hash("SHA256", $canonicalRequest);
|
||||
$stringToSign = $algorithm."\n"
|
||||
.$timestamp."\n"
|
||||
.$credentialScope."\n"
|
||||
.$hashedCanonicalRequest;
|
||||
//echo $stringToSign.PHP_EOL;
|
||||
|
||||
// step 3: sign string
|
||||
$secretDate = hash_hmac("SHA256", $date, "TC3".$secretKey, true);
|
||||
$secretService = hash_hmac("SHA256", $service, $secretDate, true);
|
||||
$secretSigning = hash_hmac("SHA256", "tc3_request", $secretService, true);
|
||||
$signature = hash_hmac("SHA256", $stringToSign, $secretSigning);
|
||||
//echo $signature.PHP_EOL;
|
||||
|
||||
// step 4: build authorization
|
||||
$authorization = $algorithm
|
||||
." Credential=".$secretId."/".$credentialScope
|
||||
.", SignedHeaders=content-type;host, Signature=".$signature;
|
||||
//echo $authorization.PHP_EOL;
|
||||
|
||||
//$curl = "curl -X POST https://".$host
|
||||
// .' -H "Authorization: '.$authorization.'"'
|
||||
// .' -H "Content-Type: application/json; charset=utf-8"'
|
||||
// .' -H "Host: '.$host.'"'
|
||||
// .' -H "X-TC-Action: '.$action.'"'
|
||||
// .' -H "X-TC-Timestamp: '.$timestamp.'"'
|
||||
// .' -H "X-TC-Version: '.$version.'"'
|
||||
// .' -H "X-TC-Region: '.$region.'"'
|
||||
// ." -d '".$payload."'";
|
||||
//error_log1( $curl.PHP_EOL );
|
||||
//return '{"response": {"Error": {"Message":"' . $curl . '"}}}';
|
||||
$headers['Authorization'] = $authorization;
|
||||
$headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
$headers['Host'] = $host;
|
||||
$headers['X-TC-Action'] = $action;
|
||||
$headers['X-TC-Timestamp'] = $timestamp;
|
||||
$headers['X-TC-Version'] = $version;
|
||||
$headers['X-TC-Region'] = $region;
|
||||
return curl('POST', 'https://'.$host, $payload, $headers)['body'];
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
$source = '/tmp/code.zip';
|
||||
$outPath = '/tmp/';
|
||||
|
||||
// 从github下载对应tar.gz,并解压
|
||||
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
$tarfile = '/tmp/github.tar.gz';
|
||||
file_put_contents($tarfile, file_get_contents($url));
|
||||
$phar = new PharData($tarfile);
|
||||
$html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
|
||||
|
||||
// 获取包中目录名
|
||||
$tmp = scandir('phar://'.$tarfile);
|
||||
$name = $auth.'-'.$project;
|
||||
foreach ($tmp as $f) {
|
||||
if ( substr($f, 0, strlen($name)) == $name) {
|
||||
$outPath .= $f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 放入配置文件
|
||||
file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
|
||||
|
||||
// 将目录中文件打包成zip
|
||||
//$zip=new ZipArchive();
|
||||
$zip=new PharData($source);
|
||||
//if($zip->open($source, ZipArchive::CREATE)){
|
||||
addFileToZip($zip, $outPath); //调用方法,对要打包的根目录进行操作,并将ZipArchive的对象传递给方法
|
||||
// $zip->close(); //关闭处理的zip文件
|
||||
//}
|
||||
|
||||
return updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'), $source);
|
||||
}
|
||||
|
||||
function addFileToZip($zip, $rootpath, $path = '')
|
||||
{
|
||||
if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
|
||||
if (substr($path,0,1)=='/') $path = substr($path, 1);
|
||||
$handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
|
||||
while($filename=readdir($handler)){
|
||||
if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
|
||||
$nowname = path_format($rootpath.'/'.$path."/".$filename);
|
||||
if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归
|
||||
$zip->addEmptyDir($path."/".$filename);
|
||||
addFileToZip($zip, $rootpath, $path."/".$filename);
|
||||
}else{ //将文件加入zip对象
|
||||
$newname = $path."/".$filename;
|
||||
if (substr($newname,0,1)=='/') $newname = substr($newname, 1);
|
||||
$zip->addFile($nowname, $newname);
|
||||
//$zip->renameName($nowname, $newname);
|
||||
}
|
||||
}
|
||||
}
|
||||
@closedir($path);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ function GetGlobalVariable($event)
|
||||
$pos = strpos($cookievalues,"=");
|
||||
$_COOKIE[urldecode(substr($cookievalues,0,$pos))]=urldecode(substr($cookievalues,$pos+1));
|
||||
}
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
$_SERVER['USER'] = 'qcloud';
|
||||
}
|
||||
|
||||
function GetPathSetting($event, $context)
|
||||
@@ -33,7 +30,7 @@ function GetPathSetting($event, $context)
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($event['headers']['accept-language'],';')[0],',')[0]);
|
||||
$_SERVER['function_name'] = $context['function_name'];
|
||||
$_SERVER['namespace'] = $context['namespace'];
|
||||
$_SERVER['Region'] = getenv('TENCENTCLOUD_REGION');
|
||||
$_SERVER['Region'] = $context['tencentcloud_region'];
|
||||
$host_name = $event['headers']['host'];
|
||||
$_SERVER['HTTP_HOST'] = $host_name;
|
||||
$serviceId = $event['requestContext']['serviceId'];
|
||||
@@ -46,31 +43,41 @@ function GetPathSetting($event, $context)
|
||||
}
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
//$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
|
||||
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = $event['headers']['x-requested-with'];
|
||||
$_SERVER['HTTP_USER_AGENT'] = $event['headers']['user-agent'];
|
||||
if (isset($event['headers']['authorization'])) {
|
||||
$basicAuth = splitfirst(base64_decode(splitfirst($event['headers']['authorization'], 'Basic ')[1]), ':');
|
||||
$_SERVER['PHP_AUTH_USER'] = $basicAuth[0];
|
||||
$_SERVER['PHP_AUTH_PW'] = $basicAuth[1];
|
||||
}
|
||||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-api-scheme'];
|
||||
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
$_SERVER['USER'] = 'qcloud';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
//include 'config.php';
|
||||
$s = file_get_contents('config.php');
|
||||
$s = file_get_contents('.data/config.php');
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') {
|
||||
$envs = json_decode($configs, true);
|
||||
if (in_array($str, $InnerEnv)) {
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
if (isset($envs[$disktag][$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($envs[$disktag][$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
|
||||
else return $envs[$disktag][$str];
|
||||
}
|
||||
} else {
|
||||
if (isset($envs[$str])) {
|
||||
if (in_array($str, $Base64Env)) return base64y_decode($envs[$str]);
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$str]);
|
||||
else return $envs[$str];
|
||||
}
|
||||
}
|
||||
@@ -80,11 +87,9 @@ function getConfig($str, $disktag = '')
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $InnerEnv;
|
||||
global $Base64Env;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
//include 'config.php';
|
||||
$s = file_get_contents('config.php');
|
||||
$s = file_get_contents('.data/config.php');
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
@@ -92,8 +97,11 @@ function setConfig($arr, $disktag = '')
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (in_array($k, $InnerEnv)) {
|
||||
if (in_array($k, $Base64Env)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
else $envs[$disktag][$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
@@ -103,9 +111,15 @@ function setConfig($arr, $disktag = '')
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$envs[$newtag] = $envs[$v];
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
if (in_array($k, $Base64Env)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
$envs[$k] = $v;
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
@@ -115,13 +129,24 @@ function setConfig($arr, $disktag = '')
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$envs['disktag'] = implode('|', $tags);
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
$envs[$arr['disktag_rename']] = '';
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
//ksort($envs);
|
||||
$response = updateEnvironment($envs, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
|
||||
WaitSCFStat($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
|
||||
return $response;
|
||||
@@ -260,7 +285,7 @@ language:<br>';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Error';
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
@@ -358,6 +383,7 @@ function copyFolder($from, $to)
|
||||
|
||||
function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId, $SecretKey)
|
||||
{
|
||||
sortConfig($Envs);
|
||||
// 获取当前代码并解压
|
||||
//$codeurl = json_decode(getfunctioncodeurl($function_name, $Region, $Namespace, $SecretId, $SecretKey), true)['Response']['Url'];
|
||||
//$codezip = '/tmp/oldcode.zip';
|
||||
@@ -374,7 +400,7 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
|
||||
// 将配置写入
|
||||
$prestr = '<?php $configs = \'' . PHP_EOL;
|
||||
$aftstr = PHP_EOL . '\';';
|
||||
file_put_contents($outPath . 'config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
file_put_contents($outPath . '.data/config.php', $prestr . json_encode($Envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
|
||||
// 将目录中文件打包成zip
|
||||
$source = '/tmp/code.zip';
|
||||
@@ -387,7 +413,7 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
|
||||
|
||||
return updateProgram($function_name, $Region, $namespace, $SecretId, $SecretKey, $source);
|
||||
$tmp1['Response']['Error']['Message'] = $codeurl;
|
||||
error_log($tmp1['Response']['Error']['Message']);
|
||||
error_log1($tmp1['Response']['Error']['Message']);
|
||||
return json_encode($tmp1);
|
||||
}
|
||||
|
||||
@@ -443,7 +469,7 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
|
||||
}
|
||||
WaitSCFStat($function_name, $Region, $Namespace, $SecretId, $SecretKey);
|
||||
|
||||
$s = file_get_contents('config.php');
|
||||
$s = file_get_contents('.data/config.php');
|
||||
//$configs = substr($s, 18, -2);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
@@ -451,7 +477,7 @@ function SetbaseConfig($Envs, $function_name, $Region, $Namespace, $SecretId, $S
|
||||
$envs[$k] = $v;
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
ksort($envs);
|
||||
//ksort($envs);
|
||||
$response = updateEnvironment($envs, $function_name, $Region, $Namespace, $SecretId, $SecretKey);
|
||||
return $response;
|
||||
}
|
||||
@@ -530,7 +556,7 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe
|
||||
// .' -H "X-TC-Version: '.$version.'"'
|
||||
// .' -H "X-TC-Region: '.$region.'"'
|
||||
// ." -d '".$payload."'";
|
||||
//error_log( $curl.PHP_EOL );
|
||||
//error_log1( $curl.PHP_EOL );
|
||||
//return '{"response": {"Error": {"Message":"' . $curl . '"}}}';
|
||||
$headers['Authorization'] = $authorization;
|
||||
$headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
@@ -539,7 +565,7 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe
|
||||
$headers['X-TC-Timestamp'] = $timestamp;
|
||||
$headers['X-TC-Version'] = $version;
|
||||
$headers['X-TC-Region'] = $region;
|
||||
return curl_request('https://'.$host, $payload, $headers)['body'];
|
||||
return curl('POST', 'https://'.$host, $payload, $headers)['body'];
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
@@ -585,7 +611,7 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||
}
|
||||
}
|
||||
// 放入配置文件
|
||||
file_put_contents($outPath . '/config.php', file_get_contents(__DIR__.'/../config.php'));
|
||||
file_put_contents($outPath . '/.data/config.php', file_get_contents(__DIR__ . '/../.data/config.php'));
|
||||
|
||||
// 将目录中文件打包成zip
|
||||
//$zip=new ZipArchive();
|
||||
@@ -619,3 +645,8 @@ function addFileToZip($zip, $rootpath, $path = '')
|
||||
}
|
||||
@closedir($path);
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
if ( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')),true)['Response']['Status']=='Active' ) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,446 @@
|
||||
<?php
|
||||
// https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment
|
||||
|
||||
function getpath()
|
||||
{
|
||||
$_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_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
|
||||
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
||||
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
||||
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
||||
}
|
||||
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
|
||||
}
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
$_SERVER['base_path'] = "/";
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
|
||||
else $path = $_SERVER['REQUEST_URI'];
|
||||
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/var/task/user';
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getGET()
|
||||
{
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
|
||||
$getstrarr = explode("&",$getstr);
|
||||
foreach ($getstrarr as $getvalues) {
|
||||
if ($getvalues != '') {
|
||||
$pos = strpos($getvalues, "=");
|
||||
//echo $pos;
|
||||
if ($pos > 0) {
|
||||
$getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
|
||||
} else {
|
||||
$getarry[urldecode($getvalues)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($getarry)) {
|
||||
return $getarry;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$tmp = getenv($disktag);
|
||||
if (is_array($tmp)) $env = $tmp;
|
||||
else $env = json_decode($tmp, true);
|
||||
if (isset($env[$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|", getenv('disktag'));
|
||||
if ($disktag!='') {
|
||||
$tmp = getenv($disktag);
|
||||
if (is_array($tmp)) $diskconfig = $tmp;
|
||||
else $diskconfig = json_decode($tmp, true);
|
||||
}
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tagvalue = getenv($v);
|
||||
if (is_array($tagvalue)) $tmp[$newtag] = json_encode($tagvalue);
|
||||
else $tmp[$newtag] = $tagvalue;
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tagvalue = getenv($arr['disktag_rename']);
|
||||
if (is_array($tagvalue)) $tmp[$arr['disktag_newname']] = json_encode($tagvalue);
|
||||
else $tmp[$arr['disktag_newname']] = $tagvalue;
|
||||
$tmp[$arr['disktag_rename']] = null;
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = null;
|
||||
}
|
||||
}
|
||||
foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
|
||||
|
||||
//error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
//echo json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT);
|
||||
return setVercelConfig($tmp, getConfig('HerokuappId'), getConfig('APIKey'));
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
global $constStr;
|
||||
if ($_GET['install1']) {
|
||||
if ($_POST['admin']!='') {
|
||||
$tmp['admin'] = $_POST['admin'];
|
||||
//$tmp['language'] = $_POST['language'];
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
$APIKey = $_POST['APIKey'];
|
||||
//if ($APIKey=='') {
|
||||
// $APIKey = getConfig('APIKey');
|
||||
//}
|
||||
$tmp['APIKey'] = $APIKey;
|
||||
|
||||
$token = $APIKey;
|
||||
$header["Authorization"] = "Bearer " . $token;
|
||||
$header["Content-Type"] = "application/json";
|
||||
$aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true);
|
||||
$host = splitfirst($_SERVER["host"], "//")[1];
|
||||
foreach ($aliases["aliases"] as $key => $aliase) {
|
||||
if ($host==$aliase["alias"]) $projectId = $aliase["projectId"];
|
||||
}
|
||||
$tmp['HerokuappId'] = $projectId;
|
||||
|
||||
$response = json_decode(setVercelConfig($tmp, $projectId, $APIKey), true);
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 400);
|
||||
} else {
|
||||
/*$html = '<script>
|
||||
var status = "' . $response['status'] . '";
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>';
|
||||
return message($html, $title, 201, 1);*/
|
||||
$data["dplId"] = $response['status'];
|
||||
return output(json_encode($data), 201);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
$html .= '
|
||||
<form action="?install1" method="post" onsubmit="return notnull(this);">
|
||||
language:<br>';
|
||||
foreach ($constStr['languages'] as $key1 => $value1) {
|
||||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
//if (getConfig('APIKey')=='')
|
||||
$html .= '<br>
|
||||
<a href="https://vercel.com/account/tokens" target="_blank">' . getconstStr('Create') . ' token</a><br>
|
||||
<label>Token:<input name="APIKey" type="password" placeholder="" value="' . getConfig('APIKey') . '"></label><br>';
|
||||
$html .= '<br>
|
||||
<label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
|
||||
$html .= '
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
</form>
|
||||
<div id="showerror"></div>
|
||||
<script>
|
||||
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;
|
||||
var errordiv = document.getElementById("showerror");
|
||||
function changelanguage(str)
|
||||
{
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.admin.value==\'\') {
|
||||
alert(\'input admin\');
|
||||
return false;
|
||||
}
|
||||
if (t.APIKey.value==\'\') {
|
||||
alert(\'input Token\');
|
||||
return false;
|
||||
}
|
||||
t.style.display = "none";
|
||||
errordiv.innerHTML = "' . getconstStr('Wait') . '";
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", t.action);
|
||||
xhr.onload = function(e) {
|
||||
if (xhr.status==201) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
getStatus(res.dplId, t.APIKey.value);
|
||||
} else {
|
||||
t.style.display = "";
|
||||
errordiv.innerHTML = xhr.status + "<br>" + xhr.responseText;
|
||||
}
|
||||
}
|
||||
xhr.send("admin=" + t.admin.value + "&APIKey=" + t.APIKey.value);
|
||||
|
||||
var x = "";
|
||||
var min = 0;
|
||||
function getStatus(id, VercelToken) {
|
||||
x += ".";
|
||||
min++;
|
||||
var xhr = new XMLHttpRequest();
|
||||
var url = "https://api.vercel.com/v11/now/deployments/" + id;
|
||||
xhr.open("GET", url);
|
||||
xhr.setRequestHeader("Authorization", "Bearer " + VercelToken);
|
||||
xhr.onload = function(e) {
|
||||
if (xhr.status==200) {
|
||||
var deployStat = JSON.parse(xhr.responseText).readyState;
|
||||
if (deployStat=="READY") {
|
||||
x = "";
|
||||
min = 0;
|
||||
errordiv.innerHTML = "Deploy done.";
|
||||
location.href = "/";
|
||||
} else {
|
||||
errordiv.innerHTML = deployStat + ", " + min + ".<br>' . getconstStr('Wait') . ' " + x;
|
||||
if (deployStat!=="ERROR") setTimeout(function() { getStatus(id, VercelToken) }, 1000);
|
||||
}
|
||||
} else {
|
||||
t.style.display = "";
|
||||
console.log(xhr.status);
|
||||
console.log(xhr.responseText);
|
||||
}
|
||||
}
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SelectLanguage');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
if (substr($_SERVER["host"], -10)=="vercel.app") {
|
||||
$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>" ;
|
||||
} else {
|
||||
$html.= "Please visit form *.vercel.app";
|
||||
}
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
// POST /v8/projects/:id/env
|
||||
function setVercelConfig($envs, $appId, $token)
|
||||
{
|
||||
$url = "https://api.vercel.com/v8/projects/" . $appId . "/env";
|
||||
$header["Authorization"] = "Bearer " . $token;
|
||||
$header["Content-Type"] = "application/json";
|
||||
$response = curl("GET", $url, "", $header);
|
||||
$result = json_decode($response['body'], true);
|
||||
foreach ($result["envs"] as $key => $value) {
|
||||
$existEnvs[$value["key"]] = $value["id"];
|
||||
}
|
||||
$response = null;
|
||||
foreach ($envs as $key => $value) {
|
||||
$tmp = null;
|
||||
$tmp["type"] = "encrypted";
|
||||
$tmp["key"] = $key;
|
||||
$tmp["value"] = $value;
|
||||
$tmp["target"] = [ "development", "production", "preview" ];
|
||||
if (isset($existEnvs[$key])) {
|
||||
if ($value) $response = curl("PATCH", $url . "/" . $existEnvs[$key], json_encode($tmp), $header);
|
||||
else $response = curl("DELETE", $url . "/" . $existEnvs[$key], "", $header);
|
||||
} else {
|
||||
if ($value) $response = curl("POST", $url, json_encode($tmp), $header);
|
||||
}
|
||||
//echo $key . " = " . $value . ", <br>" . json_encode($response, JSON_PRETTY_PRINT) . "<br>";
|
||||
if ($response['stat']!=200) return $response['body'];
|
||||
}
|
||||
return VercelUpdate($appId, $token);
|
||||
}
|
||||
|
||||
function VercelUpdate($appId, $token, $sourcePath = "")
|
||||
{
|
||||
$url = "https://api.vercel.com/v12/now/deployments";
|
||||
$header["Authorization"] = "Bearer " . $token;
|
||||
$header["Content-Type"] = "application/json";
|
||||
$data["name"] = "OneManager";
|
||||
$data["project"] = $appId;
|
||||
$data["target"] = "production";
|
||||
$data["routes"][0]["src"] = "/(.*)";
|
||||
$data["routes"][0]["dest"] = "/api/index.php";
|
||||
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.4.0";
|
||||
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
|
||||
//echo $sourcePath . "<br>";
|
||||
getEachFiles($file, $sourcePath);
|
||||
$data["files"] = $file;
|
||||
|
||||
//echo json_encode($data, JSON_PRETTY_PRINT) . " ,data<br>";
|
||||
$response = curl("POST", $url, json_encode($data), $header);
|
||||
$result = json_decode($response["body"], true);
|
||||
$result['status'] = $result['id'];
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
function getEachFiles(&$file, $base, $path = "")
|
||||
{
|
||||
//if (substr($base, -1)=="/") $base = substr($base, 0, -1);
|
||||
//if (substr($path, -1)=="/") $path = substr($path, 0, -1);
|
||||
$handler=opendir(path_format($base . "/" . $path));
|
||||
while($filename=readdir($handler)) {
|
||||
if($filename != '.' && $filename != '..' && $filename != '.git'){
|
||||
$fromfile = path_format($base . "/" . $path . "/" . $filename);
|
||||
//echo $fromfile . "<br>";
|
||||
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
|
||||
$response = getEachFiles($file, $base, path_format($path . "/" . $filename));
|
||||
if (api_error(setConfigResponse($response))) return $response;
|
||||
}else{
|
||||
$tmp['file'] = path_format($path . "/" . $filename);
|
||||
$tmp['data'] = file_get_contents($fromfile);
|
||||
$file[] = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handler);
|
||||
|
||||
return json_encode( [ 'response' => 'success' ] );
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
{
|
||||
return isset($response['error']);
|
||||
}
|
||||
|
||||
function api_error_msg($response)
|
||||
{
|
||||
return $response['error']['code'] . '<br>
|
||||
' . $response['error']['message'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
$tmppath = '/tmp';
|
||||
|
||||
// 从github下载对应tar.gz,并解压
|
||||
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
$tarfile = $tmppath . '/github.tar.gz';
|
||||
$githubfile = file_get_contents($url);
|
||||
if (!$githubfile) return '{"error":{"message":"fail to download from github"}}';
|
||||
file_put_contents($tarfile, $githubfile);
|
||||
$phar = new PharData($tarfile); // need php5.3, 7, 8
|
||||
$phar->extractTo($tmppath, null, true);//路径 要解压的文件 是否覆盖
|
||||
unlink($tarfile);
|
||||
|
||||
$outPath = '';
|
||||
$tmp = scandir($tmppath);
|
||||
$name = $auth . '-' . $project;
|
||||
mkdir($tmppath . "/" . $name, 0777);
|
||||
foreach ($tmp as $f) {
|
||||
if ( substr($f, 0, strlen($name)) == $name) {
|
||||
rename($tmppath . '/' . $f, $tmppath . "/" . $name . '/api');
|
||||
$outPath = $tmppath . "/" . $name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//echo $outPath . "<br>";
|
||||
//error_log1($outPath);
|
||||
if ($outPath=='') return '{"error":{"message":"no outpath"}}';
|
||||
|
||||
return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
|
||||
}
|
||||
|
||||
function WaitFunction($deployid) {
|
||||
$header["Authorization"] = "Bearer " . getConfig('APIKey');
|
||||
$header["Content-Type"] = "application/json";
|
||||
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
|
||||
$response = curl("GET", $url, "", $header);
|
||||
if ($response['stat']==200) {
|
||||
$result = json_decode($response['body'], true);
|
||||
if ($result['readyState']=="READY") return true;
|
||||
if ($result['readyState']=="ERROR") return $response;
|
||||
return false;
|
||||
} else {
|
||||
$response['body'] .= $url;
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
Install program first, then add onedrive in setup after login.
|
||||
先安装程序,登录后在设置中添加onedrive。
|
||||
# NOTICE: the release is used as archive.
|
||||
# 注意:release只是用来存档的。
|
||||
Please read the descriptions of settings before raising an issue.
|
||||
请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
|
||||
|
||||
# Deploy to Heroku
|
||||
Official: https://heroku.com
|
||||
Demo: https://herooneindex.herokuapp.com/
|
||||
|
||||
How to Install: Click the button [](https://heroku.com/deploy?template=https://github.com/qkqpttgf/OneManager-php) to Deploy a new app, or create an app then deploy via connect to your github fork.
|
||||
How to Install:
|
||||
> ~~Click the button [](https://heroku.com/deploy?template=https://github.com/qkqpttgf/OneManager-php) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)
|
||||
> Fork this project, create a heroku app, then turn to Deploy tab, deploy via connect to your github fork.
|
||||
|
||||
|
||||
# Deploy to Glitch
|
||||
@@ -15,6 +19,17 @@ Demo: https://onemanager.glitch.me/
|
||||
How to Install: New Project -> Import form Github -> paste "https://github.com/qkqpttgf/OneManager-php", after done, Show -> In a New Window.
|
||||
|
||||
|
||||
# Deploy to Vercel
|
||||
Official: https://vercel.com/
|
||||
Demo: null
|
||||
Notice:
|
||||
> 1, you must wait 30-50s to make sure deploy READY after change config;
|
||||
> 2, the max size of environment is 4k, so you can add 3 onedrive or less;
|
||||
> 3, Vercel limit 100 deploy every day.
|
||||
|
||||
How to Install: https://scfonedrive.github.io/Vercel/Deploy.html .
|
||||
|
||||
|
||||
# Deploy to Tencent Serverless Cloud Function (SCF 腾讯无服务器云函数)
|
||||
Official: https://cloud.tencent.com/product/scf
|
||||
DEMO: 无
|
||||
@@ -31,25 +46,10 @@ How to Install:
|
||||
添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。
|
||||
|
||||
|
||||
# Deploy to Virtual Private Server (VPS 或空间)
|
||||
DEMO: 无
|
||||
How to Install:
|
||||
1.Start web service on your server (httpd or other), make sure you can visit it.
|
||||
启动web服务器,确保你能访问到。
|
||||
2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
|
||||
开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
|
||||
3.Upload code.
|
||||
上传好代码。
|
||||
4.Change the file config.php can be read&write (666 is suggested).
|
||||
让代码中的config.php文件程序可读写,推荐chmod 666 config.php。
|
||||
5.View the website in chrome or other.
|
||||
在浏览器中访问。
|
||||
|
||||
|
||||
# Deploy to Huawei cloud Function Graph (FG 华为云函数工作流)
|
||||
Official: https://console.huaweicloud.com/functiongraph/
|
||||
DEMO: 无
|
||||
注意:FG中,环境变量整体大小为2KB,所以最多添加2个盘。
|
||||
注意:FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)。
|
||||
|
||||
How to Install:
|
||||
1,在函数列表,点右边创建函数
|
||||
@@ -86,6 +86,21 @@ How to Install:
|
||||
6,点击右边触发器,复制并访问提供的url,开始安装
|
||||
|
||||
|
||||
# Deploy to Virtual Private Server (VPS 或空间)
|
||||
DEMO: 无
|
||||
How to Install:
|
||||
1.Start web service on your server (httpd or other), make sure you can visit it.
|
||||
启动web服务器,确保你能访问到。
|
||||
2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
|
||||
开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
|
||||
3.Upload code.
|
||||
上传好代码。
|
||||
4.Change the file .data/config.php can be read&write (666 is suggested).
|
||||
使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
|
||||
5.View the website in chrome or other.
|
||||
在浏览器中访问。
|
||||
|
||||
|
||||
# Features 特性
|
||||
When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
|
||||
下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
|
||||
@@ -104,5 +119,19 @@ If there is 'index.html' file, program will only show the content of 'index.html
|
||||
Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
|
||||
点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
|
||||
|
||||
QQ Group: 943919989 (请看完上面的中英双语再加群,谢谢!)
|
||||
# Functional files 功能性文件
|
||||
### favicon.ico
|
||||
put it in the showing home folder of FIRST disk (maybe not root of onedrive). 放在第一个盘的显示目录(不一定是onedrive根目录)。
|
||||
### index.html
|
||||
show content of index.html as html. 将index.html以静态网页显示出来。
|
||||
### head.md readme.md
|
||||
it will showed at top or bottom as markdown. 以MD语法显示在顶部或底部。
|
||||
### head.omf foot.omf
|
||||
it will showed at top or bottom as html (javascript works!). 以html显示在顶部或底部(可以跑js)。
|
||||
|
||||
# A cup of coffee
|
||||
paypal.me/qkqpttgf
|
||||
|
||||
# Chat
|
||||
QQ Group: 212088653 (请看完上面的中英双语再加群,谢谢!)
|
||||
Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
|
||||
|
||||
@@ -254,14 +254,14 @@
|
||||
<div class="title pull-left">
|
||||
<a href="<!--base_path-->"><!--Sitename--></a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="pull-right"><!--
|
||||
<!--LoginStart-->
|
||||
<a class="pull-left" onclick="/*login();*/"><!--constStr@Login--></a>
|
||||
<!--LoginEnd-->
|
||||
<!--AdminStart-->
|
||||
<a class="pull-left" onclick="logout();"><!--constStr@Logout--></a>
|
||||
<!--AdminEnd-->
|
||||
|
|
||||
| -->
|
||||
<div class="pull-right lang">
|
||||
<select name="language" id="language" class="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
|
||||
<option value="">Language</option>
|
||||
|
||||
+495
-104
@@ -3,9 +3,9 @@
|
||||
"music":"musical-notes",
|
||||
"video":"logo-youtube",
|
||||
"img":"image",
|
||||
"office":"paper",
|
||||
"office":"newspaper",
|
||||
"txt":"clipboard",
|
||||
"zip":"filing",
|
||||
"zip":"file-tray-full",
|
||||
"iso":"disc",
|
||||
"apk":"logo-android",
|
||||
"exe":"logo-windows",
|
||||
@@ -31,13 +31,13 @@
|
||||
.title{text-align:center;margin-top:1rem;letter-spacing:2px;margin-bottom:2rem}
|
||||
.title a{color:#333;text-decoration:none}
|
||||
.list-wrapper{width:80%;margin:0 auto 30px;position:relative;box-shadow:0 0 32px 0 rgb(128,128,128);border-radius:15px;}
|
||||
.list-container{position:relative;overflow:hidden;border-radius:15px;}
|
||||
.list-container{position:relative;/*overflow:hidden;*/border-radius:15px;background-color:rgba(245,245,245,0.5);}
|
||||
.list-container,.list-header-container,.list-wrapper,a.back-link:hover,body{color:#24292e}
|
||||
.list-header-container{position:relative}
|
||||
.list-header-container a.back-link{color:#000;display:inline-block;position:absolute;font-size:16px;margin:20px 10px;padding:10px 10px;vertical-align:middle;text-decoration:none}
|
||||
.list-container,.list-header-container,.list-wrapper,a.back-link:hover,body{color:#24292e}
|
||||
.table-header{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;background-color:rgba(245,245,245,0.5);word-break: break-all;word-wrap: break-word;}
|
||||
.list-body-container{position:relative;left:0;overflow-x:hidden;overflow-y:auto;box-sizing:border-box;background:rgba(245,245,245,0.5)}
|
||||
.more-disk{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;background-color:rgba(245,245,245,0.5);white-space:nowrap;overflow:auto;}
|
||||
.table-header{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;word-break: break-all;word-wrap: break-word;}
|
||||
.list-body-container{position:relative;left:0;box-sizing:border-box;/*overflow-x:hidden;overflow-y:auto;background:rgba(245,245,245,0.5)*/}
|
||||
.more-disk{margin:0;border:0 none;padding:30px 30px;text-align:left;font-weight:400;color:#000;white-space:nowrap;overflow:auto;}
|
||||
.more-disk a{margin:0 10px;padding:5px;transition-duration: 0.4s;border-radius: 12px; background-color: white; color: black; border: 2px solid rgba(85,85,85,0.7); }
|
||||
.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}
|
||||
@@ -54,15 +54,16 @@
|
||||
.operate{display:inline-table;margin:0;margin-right:5px;list-style:none}
|
||||
.operate ul{position:absolute;display:none;background:#fffaaa;border:0px #f7f7f7 solid;border-radius:5px;margin:-7px 0 0 0;padding:0 7px;color:#205D67;z-index:1;}
|
||||
.operate:hover ul{position:absolute;display:inline-table;}
|
||||
body .active ul{position:absolute;display:inline-table;} /*for some mobile browser */
|
||||
.operate ul li{padding:7px;list-style:none;display:block;}
|
||||
.list-table tr[data-to]:hover .operate ul li a{color:black}
|
||||
<!--AdminEnd-->
|
||||
.operatediv{position:absolute;border:1px #CCCCCC;background-color:#FFFFCC;z-index:2;}
|
||||
.operatediv div{margin:16px}
|
||||
.operatediv_close{position:absolute;right:3px;top:3px;}
|
||||
.readme{padding:8px;background-color:rgba(245,245,245,0.5);}
|
||||
.readme{padding:8px;}
|
||||
.markdown-body, .customfile{padding:20px;text-align:left}
|
||||
@media only screen and (max-width:480px){
|
||||
@media only screen and (orientation: portrait){
|
||||
<!--BackgroundMStart-->
|
||||
body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-image:url("<!--BackgroundMUrl-->");}
|
||||
<!--BackgroundMEnd-->
|
||||
@@ -85,7 +86,7 @@
|
||||
<li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul>
|
||||
<!--IsFolderStart-->
|
||||
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li>
|
||||
<!--IsFolderEnd-->
|
||||
<li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li>
|
||||
@@ -163,7 +164,7 @@
|
||||
</div>
|
||||
<!--EncryptedEnd-->
|
||||
<!--GuestUploadStart-->
|
||||
<div id="upload_div" style="margin:0 0 16px 0">
|
||||
<div id="upload_div" style="padding:0 0 16px 0">
|
||||
<div id="upload_btns" align="center">
|
||||
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
|
||||
<option value=""><!--constStr@UploadFile--></option>
|
||||
@@ -176,14 +177,14 @@
|
||||
<!--GuestUploadEnd-->
|
||||
|
||||
<!--IsFileStart-->
|
||||
<div style="margin: 12px 4px 4px; text-align: center">
|
||||
<div style="padding: 12px 4px 4px; text-align: center">
|
||||
<div style="margin: 24px">
|
||||
<textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
|
||||
<a href="<!--FileUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
|
||||
<a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
|
||||
</div>
|
||||
<div style="margin: 24px">
|
||||
<!--IsimgFileStart-->
|
||||
<img src="<!--FileDownUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';" />
|
||||
<img src="<!--FileEncodeUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';if (this.offsetHeight>document.documentElement.clientHeight) this.style.height=document.documentElement.clientHeight + 'px';" />
|
||||
<!--IsimgFileEnd-->
|
||||
<!--IsvideoFileStart-->
|
||||
<div id="video-a0"></div>
|
||||
@@ -240,7 +241,7 @@
|
||||
<!--AdminStart-->
|
||||
<li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a>
|
||||
<ul>
|
||||
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li>
|
||||
<li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li>
|
||||
<li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li>
|
||||
@@ -249,7 +250,7 @@
|
||||
</li>
|
||||
<!--AdminEnd-->
|
||||
<ion-icon name="folder"></ion-icon>
|
||||
<a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/"><!--FileEncodeReplaceName--></a>
|
||||
<a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/" fileid="<!--FileId-->"><!--FileEncodeReplaceName--></a>
|
||||
</td>
|
||||
<td class="updated_at" id="folder_time<!--filenum-->"><!--lastModifiedDateTime--></td>
|
||||
<td class="size" id="folder_size<!--filenum-->"><!--size--></td>
|
||||
@@ -269,7 +270,7 @@
|
||||
</li>
|
||||
<!--AdminEnd-->
|
||||
<ion-icon name="<!--IconValue-->"></ion-icon>
|
||||
<a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->?preview" target=_blank><!--FileEncodeReplaceName--></a>
|
||||
<a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->?preview" fileid="<!--FileId-->" target=_blank><!--FileEncodeReplaceName--></a>
|
||||
<a class="download" href="<!--FileEncodeReplaceUrl-->"><ion-icon name="download"></ion-icon></a>
|
||||
</td>
|
||||
<td class="updated_at" id="file_time<!--filenum-->"><!--lastModifiedDateTime--></td>
|
||||
@@ -305,7 +306,7 @@
|
||||
</form>
|
||||
<!--MorePageEnd-->
|
||||
<!--AdminStart-->
|
||||
<div id="upload_div" style="margin:0 0 16px 0">
|
||||
<div id="upload_div" style="padding:0 0 16px 0">
|
||||
<div id="upload_btns" align="center">
|
||||
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
|
||||
<option value=""><!--constStr@UploadFile--></option>
|
||||
@@ -357,6 +358,7 @@
|
||||
<label id="rename_label"></label><br><br><a onclick="operatediv_close('rename')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="rename_form" onsubmit="return submit_operate('rename');">
|
||||
<input id="rename_sid" name="rename_sid" type="hidden" value="">
|
||||
<input id="rename_fileid" name="rename_fileid" type="hidden" value="">
|
||||
<input id="rename_hidden" name="rename_oldname" type="hidden" value="">
|
||||
<input id="rename_input" name="rename_newname" type="text" value="">
|
||||
<input name="operate_action" type="submit" value="<!--constStr@Rename-->">
|
||||
@@ -370,6 +372,7 @@
|
||||
<form id="delete_form" onsubmit="return submit_operate('delete');">
|
||||
<label id="delete_input"><!--constStr@Delete-->?</label>
|
||||
<input id="delete_sid" name="delete_sid" type="hidden" value="">
|
||||
<input id="delete_fileid" name="delete_fileid" type="hidden" value="">
|
||||
<input id="delete_hidden" name="delete_name" type="hidden" value="">
|
||||
<input name="operate_action" type="submit" value="<!--constStr@Submit-->">
|
||||
</form>
|
||||
@@ -380,6 +383,7 @@
|
||||
<label id="encrypt_label"></label><br><br><a onclick="operatediv_close('encrypt')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="encrypt_form" onsubmit="return submit_operate('encrypt');">
|
||||
<input id="encrypt_sid" name="encrypt_sid" type="hidden" value="">
|
||||
<input id="encrypt_fileid" name="encrypt_fileid" type="hidden" value="">
|
||||
<input id="encrypt_hidden" name="encrypt_folder" type="hidden" value="">
|
||||
<input id="encrypt_input" name="encrypt_newpass" type="text" value="" placeholder="<!--constStr@InputPasswordUWant-->">
|
||||
<!--EncryptBtnStart--><input name="operate_action" type="submit" value="<!--constStr@Encrypt-->"><!--EncryptBtnEnd--><!--EncryptAlertStart--><br><label><!--constStr@SetpassfileBfEncrypt--></label><!--EncryptAlertEnd-->
|
||||
@@ -391,6 +395,7 @@
|
||||
<label id="copy_label"></label><br><br><a onclick="operatediv_close('copy')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="copy_form" onsubmit="return submit_operate('copy');">
|
||||
<input id="copy_sid" name="copy_sid" type="hidden" value="">
|
||||
<input id="copy_fileid" name="copy_fileid" type="hidden" value="">
|
||||
<input id="copy_hidden" name="copy_name" type="hidden" value="">
|
||||
<input id="copy_input" name="copy_input" type="hidden" value="">
|
||||
<input name="operate_action" type="submit" value="<!--constStr@Copy-->">
|
||||
@@ -402,6 +407,7 @@
|
||||
<label id="move_label"></label><br><br><a onclick="operatediv_close('move')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="move_form" onsubmit="return submit_operate('move');">
|
||||
<input id="move_sid" name="move_sid" type="hidden" value="">
|
||||
<input id="move_fileid" name="move_fileid" type="hidden" value="">
|
||||
<input id="move_hidden" name="move_name" type="hidden" value="">
|
||||
<select id="move_input" name="move_folder">
|
||||
<!--MoveRootStart-->
|
||||
@@ -420,6 +426,7 @@
|
||||
<a onclick="operatediv_close('create')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="create_form" onsubmit="return submit_operate('create');">
|
||||
<input id="create_sid" name="create_sid" type="hidden" value="">
|
||||
<input id="create_fileid" name="create_fileid" type="hidden" value="">
|
||||
<input id="create_hidden" type="hidden" value="">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -457,8 +464,9 @@
|
||||
<div style="margin:50px">
|
||||
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<center>
|
||||
<form action="<!--IsPreview?-->admin" method="post">
|
||||
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);">
|
||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||
<input name="timestamp" type="hidden" value="">
|
||||
<input type="submit" value="<!--constStr@Login-->">
|
||||
</form>
|
||||
</center>
|
||||
@@ -472,6 +480,7 @@
|
||||
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.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-->
|
||||
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
|
||||
<!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
|
||||
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
|
||||
<!--ListEnd-->
|
||||
<script type="text/javascript">
|
||||
@@ -484,28 +493,32 @@
|
||||
document.cookie='language='+str+'; path=/; '+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
<!--LoginStart-->
|
||||
function login() {
|
||||
document.getElementById('mask').style.display='';
|
||||
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
document.getElementById('login_div').style.display='';
|
||||
document.getElementById('login_div').style.left=(document.body.clientWidth-document.getElementById('login_div').offsetWidth)/2 +'px';
|
||||
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
|
||||
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.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
<!--ListStart-->
|
||||
/*var root = '<!--base_disk_path-->';
|
||||
function path_format(path) {
|
||||
path = '/' + path + '/';
|
||||
while (path.indexOf('//') !== -1) {
|
||||
path = path.replace('//', '/')
|
||||
}
|
||||
return path
|
||||
}
|
||||
document.querySelectorAll('.table-header').forEach(function (e) {
|
||||
var path = e.innerText;
|
||||
if (path.substr(path.length-1)=='/') path = path.substr(0, path.length-1);
|
||||
var paths = path.split('/');
|
||||
e.innerHTML = '/ ';
|
||||
if (paths <= 2) return;
|
||||
for (var i = 1; i < paths.length - 1; i++) {
|
||||
var to = path_format(root + paths.slice(0, i + 1).join('/'));
|
||||
e.innerHTML += '<a href="' + to + '">' + paths[i] + '</a> / '
|
||||
}
|
||||
e.innerHTML += paths[paths.length - 1];
|
||||
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
|
||||
});*/
|
||||
|
||||
<!--IsFileStart-->
|
||||
var $url = document.getElementById('url');
|
||||
if ($url) {
|
||||
@@ -633,7 +646,6 @@
|
||||
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-->
|
||||
@@ -796,6 +808,40 @@
|
||||
alert(tmptextarea.innerHTML+"<!--constStr@Success-->");
|
||||
}
|
||||
<!--UploadJsStart-->
|
||||
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';
|
||||
}
|
||||
function seconds2hour(seconds) {
|
||||
let h, m, s;
|
||||
if (parseFloat(seconds)<60) {
|
||||
return seconds + 's';
|
||||
} else {
|
||||
s = (seconds % 60).toFixed(0);
|
||||
m = parseInt(seconds / 60);
|
||||
if (parseInt(m)<60) {
|
||||
return m + 'm' + s + 's';
|
||||
} else {
|
||||
h = parseInt(m / 60);
|
||||
m = m % 60;
|
||||
return h + 'h' + m + 'm' + s + 's';
|
||||
}
|
||||
}
|
||||
}
|
||||
function uploadbuttonhide() {
|
||||
document.getElementById('upload_btns').style.display='none';
|
||||
/*document.getElementById('upload_submit').disabled='disabled';
|
||||
@@ -810,6 +856,9 @@
|
||||
document.getElementById('upload_submit').style.display='';
|
||||
document.getElementById('upload_file').style.display='';*/
|
||||
}
|
||||
var uploading = new Object();
|
||||
<!--UploadJsEnd-->
|
||||
<!--OnedriveUploadJsStart-->
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
@@ -822,7 +871,15 @@
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
var uploadList = setInterval(function(){
|
||||
if (i<files.length) {
|
||||
if (Object.keys(uploading).length<5) {
|
||||
getuplink(i);
|
||||
i++;
|
||||
}// else console.log(Object.keys(uploading).length);
|
||||
} else clearInterval(uploadList);
|
||||
}, 1000);
|
||||
//getuplink(i);
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var td1;
|
||||
@@ -835,7 +892,7 @@
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
@@ -848,7 +905,9 @@
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
uploading[upbigfilename] = i;
|
||||
var filemd5='';
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
strarry=str.split('.');
|
||||
@@ -880,13 +939,16 @@
|
||||
if (asize < file.size) {
|
||||
readblob(asize);
|
||||
} else {
|
||||
var filemd5 = spark.end();
|
||||
filemd5 = spark.end();
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
delete uploading[upbigfilename];
|
||||
upbigfilename = filemd5+ext;
|
||||
uploading[upbigfilename] = i;
|
||||
<!--GuestEnd-->
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onprogress = function(e){
|
||||
td2.innerHTML+='.';
|
||||
@@ -894,15 +956,6 @@
|
||||
xhr1.onload = function(e){
|
||||
//console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==409) {
|
||||
// td2.innerHTML='nameAlreadyExists';
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
|
||||
<!--GuestStart-->
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
<!--GuestEnd-->
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" 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>';
|
||||
}
|
||||
if (xhr1.status==200) {
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
@@ -915,13 +968,27 @@
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
|
||||
}
|
||||
} else {
|
||||
if (xhr1.status==409) {
|
||||
// td2.innerHTML='nameAlreadyExists';
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
|
||||
<!--GuestStart-->
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'"><!--constStr@CopyUrl--></button></div>';
|
||||
<!--GuestEnd-->
|
||||
<!--AdminStart-->
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" style="display:none"><!--constStr@CopyUrl--></button></div>';
|
||||
<!--AdminEnd-->
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
/*if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}*/
|
||||
delete uploading[upbigfilename];
|
||||
}
|
||||
}
|
||||
xhr1.send(null);
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5);
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
@@ -929,24 +996,7 @@
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
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';
|
||||
}
|
||||
|
||||
function binupfile(file,url,tdnum,filename){
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
@@ -957,6 +1007,7 @@
|
||||
var newstartsize = 0;
|
||||
if(!!file){
|
||||
var asize=0;
|
||||
var chunksize=10*1024*1024; // chunk size, max 60M. 每小块上传大小,最大60M,微软建议10M
|
||||
var totalsize=file.size;
|
||||
var xhr2 = new XMLHttpRequest();
|
||||
xhr2.open("GET", url);
|
||||
@@ -974,8 +1025,6 @@
|
||||
} else {
|
||||
StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
}
|
||||
var chunksize=5*1024*1024; // chunk size, max 60M. 每小块上传大小,最大60M,微软建议10M
|
||||
if (totalsize>200*1024*1024) chunksize=10*1024*1024;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
@@ -985,6 +1034,7 @@
|
||||
|
||||
reader.onload = function(e){
|
||||
var binary = this.result;
|
||||
var lastCurrentSpeed;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", url, true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
@@ -992,10 +1042,11 @@
|
||||
xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize);
|
||||
xhr.upload.onprogress = function(e){
|
||||
if (e.lengthComputable) {
|
||||
var tmptime = new Date();
|
||||
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
|
||||
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--> '+remaintime.toFixed(1)+'s';
|
||||
let tmptime = new Date();
|
||||
let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
|
||||
lastCurrentSpeed = 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));
|
||||
}
|
||||
}
|
||||
var C_starttime = new Date();
|
||||
@@ -1020,10 +1071,12 @@
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
delete uploading[filename];
|
||||
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>';
|
||||
label.innerHTML=StartStr+MiddleStr;
|
||||
label.style.color='green';
|
||||
|
||||
// uploadbuttonshow();
|
||||
<!--AdminStart-->
|
||||
response.name=file.webkitRelativePath||response.name;
|
||||
@@ -1032,9 +1085,13 @@
|
||||
} else {
|
||||
if (!response['nextExpectedRanges']) {
|
||||
label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
|
||||
delete uploading[filename];
|
||||
} else {
|
||||
var a=response['nextExpectedRanges'][0];
|
||||
asize=Number( a.slice(0,a.indexOf("-")) );
|
||||
chunksize = 10*1024*1024;
|
||||
if (lastCurrentSpeed>5*1024*1024) chunksize = 20*1024*1024;
|
||||
if (lastCurrentSpeed>10*1024*1024) chunksize = 50*1024*1024;
|
||||
readblob(asize);
|
||||
}
|
||||
} } else readblob(asize);
|
||||
@@ -1047,12 +1104,331 @@
|
||||
} else {
|
||||
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';
|
||||
}
|
||||
delete uploading[filename];
|
||||
// uploadbuttonshow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--UploadJsEnd-->
|
||||
<!--OnedriveUploadJsEnd-->
|
||||
<!--AliyundriveUploadJsStart-->
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
if (files.length<1) {
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
};
|
||||
var table1=document.createElement('table');
|
||||
document.getElementById('upload_div').appendChild(table1);
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
var uploadList = setInterval(function(){
|
||||
if (i<files.length) {
|
||||
if (Object.keys(uploading).length<5) {
|
||||
getuplink(i);
|
||||
i++;
|
||||
}// else console.log(Object.keys(uploading).length);
|
||||
} else clearInterval(uploadList);
|
||||
}, 1000);
|
||||
//getuplink(i);
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var td1;
|
||||
var td2;
|
||||
if (r==0) {
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
}
|
||||
var tdnum = timea+'_'+i;
|
||||
td1=document.getElementById('upfile_td1_'+tdnum);
|
||||
td2=document.getElementById('upfile_td2_'+tdnum);
|
||||
var chunksize=10*1024*1024; // 分块大小
|
||||
//var chunksize=100*1024; // 测试小块
|
||||
/*if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}*/
|
||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
uploading[upbigfilename] = [i];
|
||||
var spark = sha1.create();
|
||||
var reader = new FileReader();
|
||||
var asize = 0;
|
||||
var filesha1;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
|
||||
var binary = this.result;
|
||||
spark.update(binary);
|
||||
asize += chunksize;
|
||||
if (asize < file.size) {
|
||||
readblob(asize);
|
||||
} else {
|
||||
filesha1 = spark.hex();
|
||||
td2.innerHTML='SHA1: ' + filesha1;
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
let p = str.lastIndexOf('.');
|
||||
if (p===-1) return '';
|
||||
if (p===0) return '';
|
||||
return str.substr(p);
|
||||
}
|
||||
var ext = getext(file.webkitRelativePath||file.name);
|
||||
upbigfilename = filesha1 + ext;
|
||||
<!--GuestEnd-->
|
||||
//while (upbigfilename.indexOf('%2F')>0) upbigfilename = upbigfilename.replace('%2F', '/');
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var html = JSON.parse(localStorage.getItem(filesha1));
|
||||
//console.log(html);
|
||||
if (html!==null && ('part_info_list' in html)) {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
|
||||
} else {
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
//console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==201) {
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
return;
|
||||
}
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//console.log(html);
|
||||
if (!html['part_info_list']) {
|
||||
if (html.name!='') {
|
||||
if (html.exist==true) td2.innerHTML=html.name+' 文件名已有';
|
||||
else if (html.rapid_upload==true) td2.innerHTML=html.name+' 秒传';
|
||||
else td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" 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>';
|
||||
} else {
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
}
|
||||
delete uploading[upbigfilename];
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
//console.log(html);
|
||||
localStorage.setItem(filesha1, JSON.stringify(html));
|
||||
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
|
||||
}
|
||||
} else {
|
||||
delete uploading[upbigfilename];
|
||||
}
|
||||
/*if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}*/
|
||||
}
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
function binupfile(file, res, tdnum, filename, filesha1, chunksize) {
|
||||
// xhr.getResponseHeader
|
||||
if (!('ETag' in res)) res['ETag'] = new Array();
|
||||
var fileid = res['file_id'];
|
||||
var uploadid = res['upload_id'];
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
var StartStr='';
|
||||
var MiddleStr='';
|
||||
var StartTime;
|
||||
var EndTime;
|
||||
var newstartsize = 0;
|
||||
if(!!file){
|
||||
var chunknum = 0;
|
||||
var chunknumtotal = res['part_info_list'].length;
|
||||
var asize=0;
|
||||
var totalsize=file.size;
|
||||
var newstartsize=0;
|
||||
while (res['ETag'][chunknum]!=null) {
|
||||
chunknum++;
|
||||
newstartsize += chunksize;
|
||||
}
|
||||
StartTime = new Date();
|
||||
asize = newstartsize;
|
||||
if (newstartsize==0) {
|
||||
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
} else {
|
||||
StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
}
|
||||
//var chunksize=5*1024*1024; // chunk size, max 60M. 每小块上传大小
|
||||
//if (totalsize>200*1024*1024) chunksize=10*1024*1024;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
//reader.readAsArrayBuffer(file);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
if (asize>totalsize) {
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.responseText+','+xhr1.status);
|
||||
if (xhr1.status==200) {
|
||||
localStorage.removeItem(filesha1);
|
||||
<!--AdminStart-->
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//response.name=file.webkitRelativePath||response.name;
|
||||
addelement(html);
|
||||
<!--AdminEnd-->
|
||||
/*if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}*/
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
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.style.color='green';
|
||||
} else {
|
||||
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
|
||||
localStorage.removeItem(filesha1);
|
||||
}
|
||||
delete uploading[filename];
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
} else {
|
||||
var binary = this.result;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", res['part_info_list'][chunknum]['upload_url'], true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
bsize=asize+e.loaded-1;
|
||||
xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize);
|
||||
xhr.upload.onprogress = function(e){
|
||||
if (e.lengthComputable) {
|
||||
var tmptime = new Date();
|
||||
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
|
||||
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));
|
||||
}
|
||||
}
|
||||
var C_starttime = new Date();
|
||||
xhr.onload = function(e){
|
||||
if (xhr.status<500) {
|
||||
//console.log(xhr.responseText);
|
||||
//console.log(xhr.getResponseHeader('ETag'));
|
||||
//var response=JSON.parse(xhr.responseText);
|
||||
if (xhr.responseText==''&&xhr.getResponseHeader('ETag')!='') {
|
||||
// 有ETag说明本段上传成功
|
||||
let etag = xhr.getResponseHeader('ETag');
|
||||
//if (etag.substr(0,1)=='"') etag = etag.substr(1);还就要引号!
|
||||
//if (etag.substr(-1)=='"') etag = etag.substr(0, etag.length-1);
|
||||
res['ETag'][chunknum] = etag;
|
||||
localStorage.setItem(filesha1, JSON.stringify(res));
|
||||
chunknum++;
|
||||
asize = bsize + 1;
|
||||
if (chunknum==chunknumtotal) {
|
||||
// 上传结束
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.responseText+','+xhr1.status);
|
||||
if (xhr1.status==200) {
|
||||
localStorage.removeItem(filesha1);
|
||||
<!--AdminStart-->
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//response.name=file.webkitRelativePath||response.name;
|
||||
addelement(html);
|
||||
<!--AdminEnd-->
|
||||
/*if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}*/
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
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.style.color='green';
|
||||
} else {
|
||||
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
|
||||
localStorage.removeItem(filesha1);
|
||||
}
|
||||
delete uploading[filename];
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
// uploadbuttonshow();
|
||||
} else {
|
||||
readblob(asize);
|
||||
}
|
||||
} else {
|
||||
console.log(xhr.status+xhr.responseText);//<PartEtag>
|
||||
if (xhr.status==409) {
|
||||
let str = xhr.responseText;
|
||||
str = str.substr(str.indexOf('<PartEtag>')+10);
|
||||
str = str.substr(0, str.indexOf('</PartEtag>'));
|
||||
res['ETag'][chunknum] = str;
|
||||
localStorage.setItem(filesha1, JSON.stringify(res));
|
||||
chunknum++;
|
||||
asize += chunksize;
|
||||
readblob(asize);
|
||||
} else {
|
||||
delete uploading[filename];
|
||||
}
|
||||
//label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
|
||||
} } else readblob(asize);
|
||||
}
|
||||
xhr.send(binary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--AliyundriveUploadJsEnd-->
|
||||
<!--GoogledriveUploadJsStart-->
|
||||
function preup() {
|
||||
alert("Stop!\nCan not upload form explorer without token.");
|
||||
}
|
||||
<!--GoogledriveUploadJsEnd-->
|
||||
<!--ListEnd-->
|
||||
function operatediv_close(operate) {
|
||||
document.getElementById(operate+'_div').style.display='none';
|
||||
@@ -1060,9 +1436,28 @@
|
||||
}
|
||||
<!--AdminStart-->
|
||||
function logout() {
|
||||
document.cookie = "admin=; path=/";
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie = "admin=; path=/; "+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
/*for some mobile browser*/
|
||||
function menu_click(e){
|
||||
var ee=document.getElementsByClassName("active");
|
||||
for(var i=0;i<ee.length;i++){
|
||||
ee[i].classList.remove("active");
|
||||
}
|
||||
if(e.type!="mouseout")this.classList.add("active");
|
||||
}
|
||||
(function(){
|
||||
var e=document.getElementsByClassName("operate");
|
||||
document.body.addEventListener("touchstart", menu_click);
|
||||
for(var i=0;i<e.length;i++){
|
||||
e[i].addEventListener("touchstart", menu_click);
|
||||
e[i].addEventListener("mouseout", menu_click);
|
||||
}
|
||||
})();
|
||||
<!--IsFolderStart-->
|
||||
function showdiv(event,action,num) {
|
||||
var $operatediv=document.getElementsByName('operatediv');
|
||||
@@ -1074,27 +1469,30 @@
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
if (num=='') {
|
||||
var str='';
|
||||
var fileid='';
|
||||
} else {
|
||||
var str=decodeURIComponent(document.getElementById('file_a'+num).href);
|
||||
if (str.substr(-1)==' ') str=str.substr(0, str.length-1);
|
||||
if (str.substr(-1)=='/') str=str.substr(0, str.length-1);
|
||||
if (str.substr(-8)=='?preview') str=str.substr(0, str.length-8);
|
||||
if (str.lastIndexOf('/')>-1) str=str.substr(str.lastIndexOf('/')+1);
|
||||
var fileid=document.getElementById('file_a'+num).attributes['fileid'].nodeValue;
|
||||
}
|
||||
document.getElementById(action + '_div').style.display='';
|
||||
document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&');
|
||||
document.getElementById(action + '_sid').value=num;
|
||||
document.getElementById(action + '_fileid').value=fileid;
|
||||
document.getElementById(action + '_hidden').value=str;
|
||||
if (action=='rename') document.getElementById(action + '_input').value=str;
|
||||
var $e = event || window.event;
|
||||
var $scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||
/*var $e = event || window.event;
|
||||
var $scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;*/
|
||||
var $scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
var $x = $e.pageX || $e.clientX + $scrollX;
|
||||
/*var $x = $e.pageX || $e.clientX + $scrollX;
|
||||
var $y = $e.pageY || $e.clientY + $scrollY;
|
||||
if (action=='create') {
|
||||
if (action=='create') {*/
|
||||
document.getElementById(action + '_div').style.left=(document.body.clientWidth-document.getElementById(action + '_div').offsetWidth)/2 +'px';
|
||||
document.getElementById(action + '_div').style.top=(window.innerHeight-document.getElementById(action + '_div').offsetHeight)/2+$scrollY +'px';
|
||||
} else {
|
||||
/*} else {
|
||||
if ($x + document.getElementById(action + '_div').offsetWidth > document.body.clientWidth) {
|
||||
if (document.getElementById(action + '_div').offsetWidth > document.body.clientWidth) {
|
||||
document.getElementById(action + '_div').offsetWidth=document.body.clientWidth+'px';
|
||||
@@ -1106,13 +1504,14 @@
|
||||
document.getElementById(action + '_div').style.left=$x+'px';
|
||||
}
|
||||
document.getElementById(action + '_div').style.top=$y+'px';
|
||||
}
|
||||
}*/
|
||||
document.getElementById(action + '_input').focus();
|
||||
}
|
||||
function submit_operate(str) {
|
||||
var num=document.getElementById(str+'_sid').value;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", '');
|
||||
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
|
||||
xhr.onload = function(e){
|
||||
var html;
|
||||
@@ -1129,6 +1528,7 @@
|
||||
html=JSON.parse(xhr.responseText);
|
||||
addelement(html);
|
||||
}
|
||||
//alert('success');
|
||||
} else alert(xhr.status+'\n'+xhr.responseText);
|
||||
document.getElementById(str+'_div').style.display='none';
|
||||
document.getElementById('mask').style.display='none';
|
||||
@@ -1147,15 +1547,16 @@
|
||||
a1.target='_blank';
|
||||
var td2=document.createElement('td');
|
||||
td2.setAttribute('class','updated_at');
|
||||
td2.innerText=html.lastModifiedDateTime.replace(/T/,' ').replace(/Z/,'');
|
||||
if (!!html.time) td2.innerText=html.time.replace(/T/,' ').replace(/Z/,'');
|
||||
var td3=document.createElement('td');
|
||||
td3.setAttribute('class','size');
|
||||
td3.innerText=size_format(html.size);
|
||||
if (!!html.folder) {
|
||||
if (!!html.size) td3.innerText=size_format(html.size);
|
||||
else td3.innerText='0 B';
|
||||
if (html.type=='folder') {
|
||||
a1.href+='/';
|
||||
document.getElementById('tr0').parentNode.insertBefore(tr1,document.getElementById('tr0').nextSibling);
|
||||
}
|
||||
if (!!html.file) {
|
||||
if (html.type=='file') {
|
||||
a1.href+='?preview';
|
||||
a1.name='filelist';
|
||||
document.getElementById('tr0').parentNode.appendChild(tr1);
|
||||
@@ -1229,21 +1630,11 @@
|
||||
}
|
||||
<!--IsFolderEnd-->
|
||||
<!--AdminEnd-->
|
||||
<!--LoginStart-->
|
||||
function login() {
|
||||
document.getElementById('mask').style.display='';
|
||||
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
document.getElementById('login_div').style.display='';
|
||||
document.getElementById('login_div').style.left=(document.body.clientWidth-document.getElementById('login_div').offsetWidth)/2 +'px';
|
||||
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
|
||||
document.getElementById('login_input').focus();
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
<!--EncryptedStart-->
|
||||
document.getElementById('password1').focus();
|
||||
<!--EncryptedEnd-->
|
||||
</script>
|
||||
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/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-->
|
||||
<!--customScript-->
|
||||
</html>
|
||||
|
||||
+1657
File diff suppressed because it is too large
Load Diff
-1289
File diff suppressed because it is too large
Load Diff
-1283
File diff suppressed because it is too large
Load Diff
-1544
File diff suppressed because it is too large
Load Diff
+494
-153
@@ -3,9 +3,9 @@
|
||||
"music":"musical-notes",
|
||||
"video":"logo-youtube",
|
||||
"img":"image",
|
||||
"office":"paper",
|
||||
"office":"newspaper",
|
||||
"txt":"clipboard",
|
||||
"zip":"filing",
|
||||
"zip":"file-tray-full",
|
||||
"iso":"disc",
|
||||
"apk":"logo-android",
|
||||
"exe":"logo-windows",
|
||||
@@ -45,7 +45,9 @@
|
||||
background-image: url('<!--BackgroundUrl-->');
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
height: 100%;
|
||||
background-attachment: fixed;
|
||||
background-position: center;
|
||||
height: 100vh;
|
||||
<!--BackgroundEnd-->
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<!--IsFolderStart-->
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#NewFileModal"><ion-icon name="create"></ion-icon><!--constStr@Create--></a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value=''"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value=''"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a>
|
||||
<a class="dropdown-item" href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a>
|
||||
<!--IsFolderEnd-->
|
||||
<a class="dropdown-item" href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a>
|
||||
@@ -175,7 +177,7 @@
|
||||
<div style="padding:20px">
|
||||
<center>
|
||||
<form action="" method="post">
|
||||
<input name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||
<input id="password1" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||
<input type="submit" value="<!--constStr@Submit-->">
|
||||
</form>
|
||||
</center>
|
||||
@@ -285,7 +287,7 @@
|
||||
<ion-icon name="construct"></ion-icon>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value='<!--FileEncodeReplaceName-->'"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#exampleencrypt" onclick="document.getElementById('encrypt_hidden').value='<!--FileEncodeReplaceName-->'"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#renameModal" onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#MoveModal" onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#CopyModal" onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a>
|
||||
@@ -677,13 +679,17 @@ return false;
|
||||
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.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-->
|
||||
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
|
||||
<!--AliyundriveUploadJsStart--><script src="//cdn.bootcdn.net/ajax/libs/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
|
||||
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
|
||||
<!--ListEnd-->
|
||||
<script type="text/javascript">
|
||||
function changelanguage(str)
|
||||
{
|
||||
if (str=='Language') str = '';
|
||||
document.cookie='language='+str+'; path=/';
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie='language='+str+'; path=/; '+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
<!--ListStart-->
|
||||
@@ -790,14 +796,20 @@ return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
addVideos(['<!--FileDownUrl-->']);
|
||||
addVideos(['<!--FileEncodeUrl-->']);
|
||||
<!--IsvideoFileEnd-->
|
||||
<!--IspdfFileStart-->
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
|
||||
var loadingTask = pdfjsLib.getDocument({ url: '<!--FileDownUrl-->', });
|
||||
var loadingTask = pdfjsLib.getDocument({
|
||||
url: '<!--FileDownUrl-->',
|
||||
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
|
||||
cMapPacked: true,
|
||||
rangeChunkSize: 65535
|
||||
});
|
||||
loadingTask.promise.then(function(pdf) {
|
||||
var pagenum = pdf.numPages;
|
||||
var pdfContainer = document.getElementById('pdf-d');
|
||||
pdfContainer.innerHTML = '';
|
||||
for (var i=1;i<=pagenum;i++) {
|
||||
var canvasNew = document.createElement('canvas');
|
||||
canvasNew.id = 'pdf-c'+i;
|
||||
@@ -829,7 +841,6 @@ return false;
|
||||
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-->
|
||||
@@ -840,29 +851,35 @@ return false;
|
||||
<!--ReadmemdEnd-->
|
||||
<!--ShowThumbnailsStart-->
|
||||
function showthumbnails(obj) {
|
||||
images = [<!--ImgExts-->];
|
||||
var files=document.getElementsByName('filelist');
|
||||
for ($i=0;$i<files.length;$i++) {
|
||||
str=files[$i].innerText;
|
||||
if (str.substr(-1)==' ') str=str.substr(0,str.length-1);
|
||||
if (!str) return;
|
||||
if (!str) continue;
|
||||
strarry=str.split('.');
|
||||
ext=strarry[strarry.length-1].toLowerCase();
|
||||
images = [<!--ImgExts-->];
|
||||
if (images.indexOf(ext)>-1) get_thumbnails_url(str, files[$i]);
|
||||
if (images.indexOf(ext)>-1) {
|
||||
var url=files[$i].href;
|
||||
url=url.substr(0,url.length-8);
|
||||
if (document.getElementById('originalpic').checked==true) {
|
||||
files[$i].parentNode.parentNode.innerHTML='<td colspan="3"><img src="'+url+'" alt="'+str+'" onload="if (this.offsetWidth>document.getElementById(\'list-div\').offsetWidth) this.style.width=\'100%\';"></td>';
|
||||
$i--;
|
||||
} else {
|
||||
url+='?thumbnails';
|
||||
get_thumbnails_url(url, str, files[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.disabled='disabled';
|
||||
}
|
||||
function get_thumbnails_url(str, filea) {
|
||||
if (!str) return;
|
||||
var nurl=window.location.href;
|
||||
if (nurl.substr(-1)!="/") nurl+="/";
|
||||
function get_thumbnails_url(url, name, filea) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", nurl+str+'?thumbnails', true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr.open("GET", url, true);
|
||||
xhr.send('');
|
||||
xhr.onload = function(e){
|
||||
if (xhr.status==200) {
|
||||
if (xhr.responseText!='') filea.innerHTML='<img src="'+xhr.responseText+'" alt="'+str+'">';
|
||||
if (xhr.responseText!='') filea.innerHTML='<img src="'+xhr.responseText+'" alt="'+name+'">';
|
||||
} else console.log(xhr.status+'\n'+xhr.responseText);
|
||||
}
|
||||
}
|
||||
@@ -986,76 +1003,6 @@ return false;
|
||||
alert(tmptextarea.innerHTML+"<!--constStr@Success-->");
|
||||
}
|
||||
<!--UploadJsStart-->
|
||||
function uploadbuttonhide() {
|
||||
document.getElementById('upload_btns').style.display='none';
|
||||
/*document.getElementById('upload_submit').disabled='disabled';
|
||||
document.getElementById('upload_file').disabled='disabled';
|
||||
document.getElementById('upload_submit').style.display='none';
|
||||
document.getElementById('upload_file').style.display='none';*/
|
||||
}
|
||||
function uploadbuttonshow() {
|
||||
document.getElementById('upload_btns').style.display='';
|
||||
/*document.getElementById('upload_file').disabled='';
|
||||
document.getElementById('upload_submit').disabled='';
|
||||
document.getElementById('upload_submit').style.display='';
|
||||
document.getElementById('upload_file').style.display='';*/
|
||||
}
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
if (files.length<1) {
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
};
|
||||
var table1=document.createElement('table');
|
||||
document.getElementById('uploading_div').appendChild(table1);
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
getuplink(i);
|
||||
function getuplink(i) {
|
||||
var file=files[i];
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
var td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
var td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ encodeURIComponent((file.webkitRelativePath||file.name)) +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.send(null);
|
||||
xhr1.onload = function(e){
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==200) {
|
||||
console.log(xhr1.responseText);
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
if (!html['uploadUrl']) {
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
uploadbuttonshow();
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i);
|
||||
}
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function size_format(num) {
|
||||
if (num>1024) {
|
||||
num=num/1024;
|
||||
@@ -1074,7 +1021,145 @@ return false;
|
||||
}
|
||||
return num.toFixed(2) + ' GB';
|
||||
}
|
||||
function binupfile(file,url,tdnum){
|
||||
function uploadbuttonhide() {
|
||||
document.getElementById('upload_btns').style.display='none';
|
||||
/*document.getElementById('upload_submit').disabled='disabled';
|
||||
document.getElementById('upload_file').disabled='disabled';
|
||||
document.getElementById('upload_submit').style.display='none';
|
||||
document.getElementById('upload_file').style.display='none';*/
|
||||
}
|
||||
function uploadbuttonshow() {
|
||||
document.getElementById('upload_btns').style.display='';
|
||||
/*document.getElementById('upload_file').disabled='';
|
||||
document.getElementById('upload_submit').disabled='';
|
||||
document.getElementById('upload_submit').style.display='';
|
||||
document.getElementById('upload_file').style.display='';*/
|
||||
}
|
||||
<!--UploadJsEnd-->
|
||||
<!--OnedriveUploadJsStart-->
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
if (files.length<1) {
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
};
|
||||
var table1=document.createElement('table');
|
||||
document.getElementById('upload_div').appendChild(table1);
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
getuplink(i);
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var td1;
|
||||
var td2;
|
||||
if (r==0) {
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
}
|
||||
var tdnum = timea+'_'+i;
|
||||
td1=document.getElementById('upfile_td1_'+tdnum);
|
||||
td2=document.getElementById('upfile_td2_'+tdnum);
|
||||
if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
var filemd5='';
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
strarry=str.split('.');
|
||||
if (strarry.length==1) return '';
|
||||
ext=strarry[strarry.length-1].toLowerCase();
|
||||
var reg = new RegExp(".","g");
|
||||
var a = str.replace(reg,"");
|
||||
if (a == ext) ext = "";
|
||||
else ext = "." + ext;
|
||||
return ext;
|
||||
}
|
||||
var ext = getext(file.webkitRelativePath||file.name);
|
||||
var spark = new SparkMD5.ArrayBuffer();
|
||||
var reader = new FileReader();
|
||||
var chunksize=10*1024*1024;
|
||||
var asize = 0;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
td2.innerHTML='<!--constStr@Calculate--> md5: '+(asize*100/file.size).toFixed(2)+'%';
|
||||
var binary = this.result;
|
||||
spark.append(binary);
|
||||
asize += chunksize;
|
||||
if (asize < file.size) {
|
||||
readblob(asize);
|
||||
} else {
|
||||
filemd5 = spark.end();
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
upbigfilename = filemd5+ext;
|
||||
<!--GuestEnd-->
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onprogress = function(e){
|
||||
td2.innerHTML+='.';
|
||||
}
|
||||
xhr1.onload = function(e){
|
||||
//console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==409) {
|
||||
// td2.innerHTML='nameAlreadyExists';
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
|
||||
<!--GuestStart-->
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
<!--GuestEnd-->
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" 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>';
|
||||
}
|
||||
if (xhr1.status==200) {
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
return;
|
||||
}
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
if (!html['uploadUrl']) {
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
|
||||
}
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}
|
||||
}
|
||||
xhr1.send('upbigfilename='+ encodeURIComponent(upbigfilename) +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5);
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
<!--GuestEnd-->
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
|
||||
function binupfile(file,url,tdnum,filename){
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
var StartStr='';
|
||||
@@ -1095,9 +1180,7 @@ return false;
|
||||
var a = html['nextExpectedRanges'][0];
|
||||
newstartsize = Number( a.slice(0,a.indexOf("-")) );
|
||||
StartTime = new Date();
|
||||
<!--AdminStart-->
|
||||
asize = newstartsize;
|
||||
<!--AdminEnd-->
|
||||
if (newstartsize==0) {
|
||||
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
} else {
|
||||
@@ -1111,19 +1194,9 @@ return false;
|
||||
reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
readblob(asize);
|
||||
<!--LoginStart-->
|
||||
var spark = new SparkMD5.ArrayBuffer();
|
||||
<!--LoginEnd-->
|
||||
|
||||
reader.onload = function(e){
|
||||
var binary = this.result;
|
||||
<!--LoginStart-->
|
||||
spark.append(binary);
|
||||
if (asize < newstartsize) {
|
||||
asize += chunksize;
|
||||
readblob(asize);
|
||||
return;
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", url, true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
@@ -1143,39 +1216,15 @@ return false;
|
||||
var response=JSON.parse(xhr.responseText);
|
||||
if (response['size']>0) {
|
||||
// contain size, upload finish. 有size说明是最终返回,上传结束
|
||||
if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+encodeURIComponent((file.webkitRelativePath||file.name)));
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
<!--LoginStart-->
|
||||
var filemd5 = spark.end();
|
||||
var xhr4 = new XMLHttpRequest();
|
||||
xhr4.open("GET", '?action=uploaded_rename&filename='+encodeURIComponent((file.webkitRelativePath||file.name))+'&filemd5='+filemd5);
|
||||
xhr4.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr4.send(null);
|
||||
xhr4.onload = function(e){
|
||||
console.log(xhr4.responseText+','+xhr4.status);
|
||||
var filename;
|
||||
//if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name'];
|
||||
//if (xhr4.status==409) filename = filemd5 + (file.webkitRelativePath||file.name).substr((file.webkitRelativePath||file.name).indexOf('.'));
|
||||
filename = JSON.parse(xhr4.responseText)['name'];
|
||||
if (filename=='') {
|
||||
alert('<!--constStr@UploadErrorUpAgain-->');
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
var lasturl = location.href;
|
||||
if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/';
|
||||
lasturl += filename + '?preview';
|
||||
//window.open(lasturl);
|
||||
document.getElementById('upfile_a_'+tdnum).href = lasturl;
|
||||
document.getElementById('upfile_a1_'+tdnum).href = filename;
|
||||
document.getElementById('upfile_cpbt_'+tdnum).style.display = "";
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
@@ -1183,10 +1232,13 @@ return false;
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path-->'+response.name+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path-->'+response.name+'" 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>';
|
||||
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>';
|
||||
label.innerHTML=StartStr+MiddleStr;
|
||||
uploadbuttonshow();
|
||||
label.style.color='green';
|
||||
// uploadbuttonshow();
|
||||
<!--AdminStart-->
|
||||
response.name=file.webkitRelativePath||response.name;
|
||||
addelement(response);
|
||||
<!--AdminEnd-->
|
||||
} else {
|
||||
@@ -1202,17 +1254,299 @@ return false;
|
||||
xhr.send(binary);
|
||||
}
|
||||
} else {
|
||||
if (window.location.pathname.indexOf('%23')>0||(file.webkitRelativePath||file.name).indexOf('%23')>0) {
|
||||
if (window.location.pathname.indexOf('%23')>0||filename.indexOf('%23')>0) {
|
||||
label.innerHTML='<font color="red"><!--constStr@UploadFail23--></font>';
|
||||
} else {
|
||||
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';
|
||||
}
|
||||
// uploadbuttonshow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--OnedriveUploadJsEnd-->
|
||||
<!--AliyundriveUploadJsStart-->
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
if (files.length<1) {
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
};
|
||||
var table1=document.createElement('table');
|
||||
document.getElementById('upload_div').appendChild(table1);
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
getuplink(i);
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var td1;
|
||||
var td2;
|
||||
if (r==0) {
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
}
|
||||
var tdnum = timea+'_'+i;
|
||||
td1=document.getElementById('upfile_td1_'+tdnum);
|
||||
td2=document.getElementById('upfile_td2_'+tdnum);
|
||||
var chunksize=10*1024*1024; // 分块大小
|
||||
//var chunksize=100*1024; // 测试小块
|
||||
/*if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}*/
|
||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
var reader = new FileReader();
|
||||
reader.onprogress = function(e) {
|
||||
td2.innerText = '计算SHA1... ' + (e.loaded*100/file.size).toFixed(2) + " %";
|
||||
}
|
||||
reader.onload = function(e) {
|
||||
var filesha1 = sha1(this.result);
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
let p = str.lastIndexOf('.');
|
||||
if (p===-1) return '';
|
||||
if (p===0) return '';
|
||||
return str.substr(p);
|
||||
}
|
||||
var ext = getext(file.webkitRelativePath||file.name);
|
||||
upbigfilename = filesha1 + ext;
|
||||
<!--GuestEnd-->
|
||||
while (upbigfilename.indexOf('%2F')>0) upbigfilename = upbigfilename.replace('%2F', '/');
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var html = JSON.parse(localStorage.getItem(filesha1));
|
||||
//console.log(html);
|
||||
if (html!==null && ('part_info_list' in html)) {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
|
||||
} else {
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
//console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==201) {
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
return;
|
||||
}
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//console.log(html);
|
||||
if (!html['part_info_list']) {
|
||||
if (html.name!='') {
|
||||
if (html.exist==true) td2.innerHTML=html.name+' 文件名已有';
|
||||
else if (html.rapid_upload==true) td2.innerHTML=html.name+' 秒传';
|
||||
else td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" 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>';
|
||||
} else {
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
}
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
//console.log(html);
|
||||
localStorage.setItem(filesha1, JSON.stringify(html));
|
||||
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
|
||||
}
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}
|
||||
}
|
||||
xhr1.send('upbigfilename='+ encodeURIComponent(upbigfilename) +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize);
|
||||
}
|
||||
}
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
function binupfile(file, res, tdnum, filename, filesha1, chunksize) {
|
||||
// xhr.getResponseHeader
|
||||
if (!('ETag' in res)) res['ETag'] = new Array();
|
||||
var fileid = res['file_id'];
|
||||
var uploadid = res['upload_id'];
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
var StartStr='';
|
||||
var MiddleStr='';
|
||||
var StartTime;
|
||||
var EndTime;
|
||||
var newstartsize = 0;
|
||||
if(!!file){
|
||||
var chunknum = 0;
|
||||
var chunknumtotal = res['part_info_list'].length;
|
||||
var asize=0;
|
||||
var totalsize=file.size;
|
||||
var newstartsize=0;
|
||||
while (res['ETag'][chunknum]!=null) {
|
||||
chunknum++;
|
||||
newstartsize += chunksize;
|
||||
}
|
||||
StartTime = new Date();
|
||||
asize = newstartsize;
|
||||
if (newstartsize==0) {
|
||||
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
} else {
|
||||
StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
}
|
||||
//var chunksize=5*1024*1024; // chunk size, max 60M. 每小块上传大小
|
||||
//if (totalsize>200*1024*1024) chunksize=10*1024*1024;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
//reader.readAsArrayBuffer(file);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
if (asize>totalsize) {
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.responseText+','+xhr1.status);
|
||||
if (xhr1.status==200) {
|
||||
localStorage.removeItem(filesha1);
|
||||
<!--AdminStart-->
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//response.name=file.webkitRelativePath||response.name;
|
||||
addelement(html);
|
||||
<!--AdminEnd-->
|
||||
/*if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}*/
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
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.style.color='green';
|
||||
} else {
|
||||
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
|
||||
localStorage.removeItem(filesha1);
|
||||
}
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
} else {
|
||||
var binary = this.result;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", res['part_info_list'][chunknum]['upload_url'], true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
bsize=asize+e.loaded-1;
|
||||
xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize);
|
||||
xhr.upload.onprogress = function(e){
|
||||
if (e.lengthComputable) {
|
||||
var tmptime = new Date();
|
||||
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
|
||||
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--> '+remaintime.toFixed(1)+'s';
|
||||
}
|
||||
}
|
||||
var C_starttime = new Date();
|
||||
xhr.onload = function(e){
|
||||
if (xhr.status<500) {
|
||||
//console.log(xhr.responseText);
|
||||
//console.log(xhr.getResponseHeader('ETag'));
|
||||
//var response=JSON.parse(xhr.responseText);
|
||||
if (xhr.responseText==''&&xhr.getResponseHeader('ETag')!='') {
|
||||
// 有ETag说明本段上传成功
|
||||
let etag = xhr.getResponseHeader('ETag');
|
||||
//if (etag.substr(0,1)=='"') etag = etag.substr(1);还就要引号!
|
||||
//if (etag.substr(-1)=='"') etag = etag.substr(0, etag.length-1);
|
||||
res['ETag'][chunknum] = etag;
|
||||
localStorage.setItem(filesha1, JSON.stringify(res));
|
||||
chunknum++;
|
||||
asize = bsize + 1;
|
||||
if (chunknum==chunknumtotal) {
|
||||
// 上传结束
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.responseText+','+xhr1.status);
|
||||
if (xhr1.status==200) {
|
||||
localStorage.removeItem(filesha1);
|
||||
<!--AdminStart-->
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//response.name=file.webkitRelativePath||response.name;
|
||||
addelement(html);
|
||||
<!--AdminEnd-->
|
||||
/*if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}*/
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
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.style.color='green';
|
||||
} else {
|
||||
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
|
||||
localStorage.removeItem(filesha1);
|
||||
}
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
// uploadbuttonshow();
|
||||
} else {
|
||||
readblob(asize);
|
||||
}
|
||||
} else {
|
||||
console.log(xhr.status+xhr.responseText);//<PartEtag>
|
||||
if (xhr.status==409) {
|
||||
let str = xhr.responseText;
|
||||
str = str.substr(str.indexOf('<PartEtag>')+10);
|
||||
str = str.substr(0, str.indexOf('</PartEtag>'));
|
||||
res['ETag'][chunknum] = str;
|
||||
localStorage.setItem(filesha1, JSON.stringify(res));
|
||||
chunknum++;
|
||||
asize += chunksize;
|
||||
readblob(asize);
|
||||
}
|
||||
//label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
|
||||
} } else readblob(asize);
|
||||
}
|
||||
xhr.send(binary);
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--UploadJsEnd-->
|
||||
}
|
||||
<!--AliyundriveUploadJsEnd-->
|
||||
<!--ListEnd-->
|
||||
function operatediv_close(operate) {
|
||||
document.getElementById(operate+'_div').style.display='none';
|
||||
@@ -1220,7 +1554,10 @@ return false;
|
||||
}
|
||||
<!--AdminStart-->
|
||||
function logout() {
|
||||
document.cookie = "admin=; path=/";
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie = "admin=; path=/; "+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
<!--IsFolderStart-->
|
||||
@@ -1229,26 +1566,24 @@ return false;
|
||||
for ($i=0;$i<$operatediv.length;$i++) {
|
||||
$operatediv[$i].style.display='none';
|
||||
}
|
||||
document.getElementById('mask').style.display='none';
|
||||
document.getElementById('mask').style.display='';
|
||||
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
if (num=='') {
|
||||
var str='';
|
||||
var fileid='';
|
||||
} else {
|
||||
var str=document.getElementById('file_a'+num).innerText;
|
||||
if (str=='') {
|
||||
str=document.getElementById('file_a'+num).getElementsByTagName("img")[0].alt;
|
||||
if (str=='') {
|
||||
alert('<!--constStr@GetFileNameFail-->');
|
||||
operatediv_close(action);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var str=decodeURIComponent(document.getElementById('file_a'+num).href);
|
||||
if (str.substr(-1)==' ') str=str.substr(0, str.length-1);
|
||||
if (str.substr(-1)=='/') str=str.substr(0, str.length-1);
|
||||
if (str.substr(-8)=='?preview') str=str.substr(0, str.length-8);
|
||||
if (str.lastIndexOf('/')>-1) str=str.substr(str.lastIndexOf('/')+1);
|
||||
var fileid=document.getElementById('file_a'+num).attributes['fileid'].nodeValue;
|
||||
}
|
||||
document.getElementById(action + '_div').style.display='';
|
||||
document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&');
|
||||
document.getElementById(action + '_sid').value=num;
|
||||
document.getElementById(action + '_fileid').value=fileid;
|
||||
document.getElementById(action + '_hidden').value=str;
|
||||
if (action=='rename') document.getElementById(action + '_input').value=str;
|
||||
var $e = event || window.event;
|
||||
@@ -1277,9 +1612,9 @@ return false;
|
||||
function submit_operate(str) {
|
||||
var num=document.getElementById(str+'_sid').value;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", '?'+serializeForm(str+'_form'));
|
||||
xhr.open("POST", '');
|
||||
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
|
||||
xhr.send(null);
|
||||
xhr.onload = function(e){
|
||||
var html;
|
||||
if (xhr.status<300) {
|
||||
@@ -1295,10 +1630,12 @@ return false;
|
||||
html=JSON.parse(xhr.responseText);
|
||||
addelement(html);
|
||||
}
|
||||
//alert('success');
|
||||
} else alert(xhr.status+'\n'+xhr.responseText);
|
||||
document.getElementById(str+'_div').style.display='none';
|
||||
document.getElementById('mask').style.display='none';
|
||||
}
|
||||
xhr.send(serializeForm(str+'_form'));
|
||||
return false;
|
||||
}
|
||||
function addelement(html) {
|
||||
@@ -1312,15 +1649,16 @@ return false;
|
||||
a1.target='_blank';
|
||||
var td2=document.createElement('td');
|
||||
td2.setAttribute('class','updated_at');
|
||||
td2.innerText=html.lastModifiedDateTime.replace(/T/,' ').replace(/Z/,'');
|
||||
if (!!html.time) td2.innerText=html.time.replace(/T/,' ').replace(/Z/,'');
|
||||
var td3=document.createElement('td');
|
||||
td3.setAttribute('class','size');
|
||||
td3.innerText=size_format(html.size);
|
||||
if (!!html.folder) {
|
||||
if (!!html.size) td3.innerText=size_format(html.size);
|
||||
else td3.innerText='0 B';
|
||||
if (html.type=='folder') {
|
||||
a1.href+='/';
|
||||
document.getElementById('tr0').parentNode.insertBefore(tr1,document.getElementById('tr0').nextSibling);
|
||||
}
|
||||
if (!!html.file) {
|
||||
if (html.type=='file') {
|
||||
a1.href+='?preview';
|
||||
a1.name='filelist';
|
||||
document.getElementById('tr0').parentNode.appendChild(tr1);
|
||||
@@ -1396,7 +1734,7 @@ return false;
|
||||
<!--AdminEnd-->
|
||||
<!--LoginStart-->
|
||||
function login() {
|
||||
document.getElementById('mask').style.display='none';
|
||||
document.getElementById('mask').style.display='';
|
||||
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
document.getElementById('login_div').style.display='';
|
||||
@@ -1405,8 +1743,11 @@ return false;
|
||||
document.getElementById('login_input').focus();
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
<!--EncryptedStart-->
|
||||
document.getElementById('password1').focus();
|
||||
<!--EncryptedEnd-->
|
||||
</script>
|
||||
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
||||
<script src="//cdn.bootcdn.net/ajax/libs/jquery/3.3.1/jquery.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="//cdn.bootcdn.net/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
||||
<script src="//cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
|
||||
|
||||
+503
-115
@@ -3,9 +3,9 @@
|
||||
"music":"musical-notes",
|
||||
"video":"logo-youtube",
|
||||
"img":"image",
|
||||
"office":"paper",
|
||||
"office":"newspaper",
|
||||
"txt":"clipboard",
|
||||
"zip":"filing",
|
||||
"zip":"file-tray-full",
|
||||
"iso":"disc",
|
||||
"apk":"logo-android",
|
||||
"exe":"logo-windows",
|
||||
@@ -27,6 +27,9 @@
|
||||
<!--BackgroundStart-->
|
||||
<style>body{background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-position-x:center;background-image:url("<!--BackgroundUrl-->")}</style>
|
||||
<!--BackgroundEnd-->
|
||||
<!--BackgroundMStart-->
|
||||
<style>@media screen and (orientation:portrait){body{background-image:url("<!--BackgroundMUrl-->");}}</style>
|
||||
<!--BackgroundMEnd-->
|
||||
<script type="text/javascript">if(window.console&&window.console.log){console.log("%c Onemoe Theme %c https://github.com/kizx/onemoe-theme ","color: #fff; margin: 1em 0; padding: 5px 0; background: #673ab7;","margin: 1em 0; padding: 5px 0; background: #efefef;")}</script>
|
||||
<!--customCss-->
|
||||
</head>
|
||||
@@ -40,7 +43,7 @@
|
||||
<li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul>
|
||||
<!--IsFolderStart-->
|
||||
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li>
|
||||
<!--IsFolderEnd-->
|
||||
<li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li>
|
||||
@@ -104,42 +107,41 @@
|
||||
<div class="list-wrapper" id="list-div">
|
||||
<div class="list-container">
|
||||
<div class="list-header-container">
|
||||
<!--BackArrowStart-->
|
||||
<a href="<!--BackArrowUrl-->" class="back-link">
|
||||
<ion-icon name="arrow-back"></ion-icon>
|
||||
</a>
|
||||
<!--BackArrowEnd-->
|
||||
<h3 class="table-header"><!--PathArrayStart--> / <a href="<!--PathArrayLink-->"><!--PathArrayName--></a><!--PathArrayEnd--></h3>
|
||||
<h3 class="table-header"><a href="<!--base_path-->"><!--constStr@Home--></a><!--DiskPathArrayStart--> / <a href="<!--PathArrayLink-->"><!--PathArrayName--></a><!--DiskPathArrayEnd--></h3>
|
||||
</div>
|
||||
<div class="list-body-container">
|
||||
<!--EncryptedStart-->
|
||||
<div style="padding:20px">
|
||||
<center>
|
||||
<form action="" method="post">
|
||||
<input name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||
<input id="password1" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||
<input type="submit" value="<!--constStr@Submit-->">
|
||||
</form>
|
||||
</center>
|
||||
</div>
|
||||
<!--EncryptedEnd-->
|
||||
<!--GuestUploadStart-->
|
||||
<div id="upload_div" style="margin:10px">
|
||||
<div id="upload_div" style="padding:0 0 16px 0">
|
||||
<div id="upload_btns" align="center">
|
||||
<input id="upload_file" type="file" name="upload_filename">
|
||||
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
|
||||
<option value=""><!--constStr@UploadFile--></option>
|
||||
<option value="1"><!--constStr@UploadFolder--></option>
|
||||
</select>
|
||||
<input id="upload_file" type="file" name="upload_filename" multiple="multiple">
|
||||
<input id="upload_submit" onclick="preup();" value="<!--constStr@Upload-->" type="button">
|
||||
</div>
|
||||
</div>
|
||||
<!--GuestUploadEnd-->
|
||||
|
||||
<!--IsFileStart-->
|
||||
<div style="margin: 12px 4px 4px; text-align: center">
|
||||
<div style="padding: 12px 4px 4px; text-align: center">
|
||||
<div style="margin: 24px">
|
||||
<textarea id="url" title="url" rows="1" style="width: 100%; margin-top: 2px;" readonly><!--FileEncodeUrl--></textarea>
|
||||
<a href="<!--FileUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
|
||||
<a href="<!--FileEncodeUrl-->"><ion-icon name="download" style="line-height: 16px;vertical-align: middle;"></ion-icon> <!--constStr@Download--></a>
|
||||
</div>
|
||||
<div style="margin: 24px">
|
||||
<!--IsimgFileStart-->
|
||||
<img src="<!--FileDownUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';" />
|
||||
<img src="<!--FileEncodeUrl-->" alt="<!--FileName-->" onload="if (this.offsetWidth>document.getElementById('url').offsetWidth) this.style.width='100%';" />
|
||||
<!--IsimgFileEnd-->
|
||||
<!--IsvideoFileStart-->
|
||||
<div id="video-a0"></div>
|
||||
@@ -196,7 +198,7 @@
|
||||
<!--AdminStart-->
|
||||
<li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a>
|
||||
<ul>
|
||||
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li>
|
||||
<li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li>
|
||||
<li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li>
|
||||
@@ -205,7 +207,7 @@
|
||||
</li>
|
||||
<!--AdminEnd-->
|
||||
<ion-icon name="folder"></ion-icon>
|
||||
<a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/"><!--FileEncodeReplaceName--></a>
|
||||
<a id="file_a<!--filenum-->" name="folderlist" href="<!--FileEncodeReplaceUrl-->/" fileid="<!--FileId-->"><!--FileEncodeReplaceName--></a>
|
||||
</td>
|
||||
<td class="updated_at" id="folder_time<!--filenum-->"><!--lastModifiedDateTime--></td>
|
||||
<td class="size" id="folder_size<!--filenum-->"><!--size--></td>
|
||||
@@ -225,7 +227,7 @@
|
||||
</li>
|
||||
<!--AdminEnd-->
|
||||
<ion-icon name="<!--IconValue-->"></ion-icon>
|
||||
<a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->?preview" target=_blank><!--FileEncodeReplaceName--></a>
|
||||
<a id="file_a<!--filenum-->" name="filelist" href="<!--FileEncodeReplaceUrl-->?preview" fileid="<!--FileId-->" target=_blank><!--FileEncodeReplaceName--></a>
|
||||
<a class="download" href="<!--FileEncodeReplaceUrl-->"><ion-icon name="download"></ion-icon></a>
|
||||
</td>
|
||||
<td class="updated_at" id="file_time<!--filenum-->"><!--lastModifiedDateTime--></td>
|
||||
@@ -261,7 +263,7 @@
|
||||
</form>
|
||||
<!--MorePageEnd-->
|
||||
<!--AdminStart-->
|
||||
<div id="upload_div" style="margin:0 0 16px 0">
|
||||
<div id="upload_div" style="padding:0 0 16px 0">
|
||||
<div id="upload_btns" align="center">
|
||||
<select onchange="document.getElementById('upload_file').webkitdirectory=this.value;">
|
||||
<option value=""><!--constStr@UploadFile--></option>
|
||||
@@ -273,10 +275,10 @@
|
||||
</div>
|
||||
<!--AdminEnd-->
|
||||
<!--IsFolderEnd-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--ListEnd-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--ReadmemdStart-->
|
||||
<div class="list-wrapper" id="readme-div">
|
||||
<div class="list-container">
|
||||
@@ -313,6 +315,7 @@
|
||||
<label id="rename_label"></label><br><br><a onclick="operatediv_close('rename')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="rename_form" onsubmit="return submit_operate('rename');">
|
||||
<input id="rename_sid" name="rename_sid" type="hidden" value="">
|
||||
<input id="rename_fileid" name="rename_fileid" type="hidden" value="">
|
||||
<input id="rename_hidden" name="rename_oldname" type="hidden" value="">
|
||||
<input id="rename_input" name="rename_newname" type="text" value="">
|
||||
<input name="operate_action" type="submit" value="<!--constStr@Rename-->">
|
||||
@@ -326,6 +329,7 @@
|
||||
<form id="delete_form" onsubmit="return submit_operate('delete');">
|
||||
<label id="delete_input"><!--constStr@Delete-->?</label>
|
||||
<input id="delete_sid" name="delete_sid" type="hidden" value="">
|
||||
<input id="delete_fileid" name="delete_fileid" type="hidden" value="">
|
||||
<input id="delete_hidden" name="delete_name" type="hidden" value="">
|
||||
<input name="operate_action" type="submit" value="<!--constStr@Submit-->">
|
||||
</form>
|
||||
@@ -336,6 +340,7 @@
|
||||
<label id="encrypt_label"></label><br><br><a onclick="operatediv_close('encrypt')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="encrypt_form" onsubmit="return submit_operate('encrypt');">
|
||||
<input id="encrypt_sid" name="encrypt_sid" type="hidden" value="">
|
||||
<input id="encrypt_fileid" name="encrypt_fileid" type="hidden" value="">
|
||||
<input id="encrypt_hidden" name="encrypt_folder" type="hidden" value="">
|
||||
<input id="encrypt_input" name="encrypt_newpass" type="text" value="" placeholder="<!--constStr@InputPasswordUWant-->">
|
||||
<!--EncryptBtnStart--><input name="operate_action" type="submit" value="<!--constStr@Encrypt-->"><!--EncryptBtnEnd--><!--EncryptAlertStart--><br><label><!--constStr@SetpassfileBfEncrypt--></label><!--EncryptAlertEnd-->
|
||||
@@ -347,6 +352,7 @@
|
||||
<label id="copy_label"></label><br><br><a onclick="operatediv_close('copy')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="copy_form" onsubmit="return submit_operate('copy');">
|
||||
<input id="copy_sid" name="copy_sid" type="hidden" value="">
|
||||
<input id="copy_fileid" name="copy_fileid" type="hidden" value="">
|
||||
<input id="copy_hidden" name="copy_name" type="hidden" value="">
|
||||
<input id="copy_input" name="copy_input" type="hidden" value="">
|
||||
<input name="operate_action" type="submit" value="<!--constStr@Copy-->">
|
||||
@@ -358,6 +364,7 @@
|
||||
<label id="move_label"></label><br><br><a onclick="operatediv_close('move')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="move_form" onsubmit="return submit_operate('move');">
|
||||
<input id="move_sid" name="move_sid" type="hidden" value="">
|
||||
<input id="move_fileid" name="move_fileid" type="hidden" value="">
|
||||
<input id="move_hidden" name="move_name" type="hidden" value="">
|
||||
<select id="move_input" name="move_folder">
|
||||
<!--MoveRootStart-->
|
||||
@@ -376,6 +383,7 @@
|
||||
<a onclick="operatediv_close('create')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<form id="create_form" onsubmit="return submit_operate('create');">
|
||||
<input id="create_sid" name="create_sid" type="hidden" value="">
|
||||
<input id="create_fileid" name="create_fileid" type="hidden" value="">
|
||||
<input id="create_hidden" type="hidden" value="">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -413,8 +421,9 @@
|
||||
<div style="margin:50px">
|
||||
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
||||
<center>
|
||||
<form action="<!--IsPreview?-->admin" method="post">
|
||||
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);">
|
||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||
<input name="timestamp" type="hidden" value="">
|
||||
<input type="submit" value="<!--constStr@Login-->">
|
||||
</form>
|
||||
</center>
|
||||
@@ -428,6 +437,7 @@
|
||||
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.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-->
|
||||
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
|
||||
<!--AliyundriveUploadJsStart--><script src="https://cdn.bootcss.com/js-sha1/0.6.0/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
|
||||
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
|
||||
<!--ListEnd-->
|
||||
<script type="text/javascript">
|
||||
@@ -440,28 +450,32 @@
|
||||
document.cookie='language='+str+'; path=/; '+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
<!--LoginStart-->
|
||||
function login() {
|
||||
document.getElementById('mask').style.display='';
|
||||
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
document.getElementById('login_div').style.display='';
|
||||
document.getElementById('login_div').style.left=(document.body.clientWidth-document.getElementById('login_div').offsetWidth)/2 +'px';
|
||||
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
|
||||
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.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
<!--ListStart-->
|
||||
/*var root = '<!--base_disk_path-->';
|
||||
function path_format(path) {
|
||||
path = '/' + path + '/';
|
||||
while (path.indexOf('//') !== -1) {
|
||||
path = path.replace('//', '/')
|
||||
}
|
||||
return path
|
||||
}
|
||||
document.querySelectorAll('.table-header').forEach(function (e) {
|
||||
var path = e.innerText;
|
||||
if (path.substr(path.length-1)=='/') path = path.substr(0, path.length-1);
|
||||
var paths = path.split('/');
|
||||
e.innerHTML = '/ ';
|
||||
if (paths <= 2) return;
|
||||
for (var i = 1; i < paths.length - 1; i++) {
|
||||
var to = path_format(root + paths.slice(0, i + 1).join('/'));
|
||||
e.innerHTML += '<a href="' + to + '">' + paths[i] + '</a> / '
|
||||
}
|
||||
e.innerHTML += paths[paths.length - 1];
|
||||
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
|
||||
});*/
|
||||
|
||||
<!--IsFileStart-->
|
||||
var $url = document.getElementById('url');
|
||||
if ($url) {
|
||||
@@ -544,7 +558,7 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
addVideos(['<!--FileDownUrl-->']);
|
||||
addVideos(['<!--FileEncodeUrl-->']);
|
||||
<!--IsvideoFileEnd-->
|
||||
<!--IspdfFileStart-->
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
|
||||
@@ -589,7 +603,6 @@
|
||||
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-->
|
||||
@@ -609,15 +622,13 @@
|
||||
strarry=str.split('.');
|
||||
ext=strarry[strarry.length-1].toLowerCase();
|
||||
if (images.indexOf(ext)>-1) {
|
||||
if (document.getElementById('originalpic').checked==true) {
|
||||
var url=files[$i].href;
|
||||
url=url.substr(0,url.length-8);
|
||||
if (document.getElementById('originalpic').checked==true) {
|
||||
files[$i].parentNode.parentNode.innerHTML='<td colspan="3"><img src="'+url+'" alt="'+str+'" onload="if (this.offsetWidth>document.getElementById(\'list-div\').offsetWidth) this.style.width=\'100%\';"></td>';
|
||||
$i--;
|
||||
} else {
|
||||
var nurl=window.location.href;
|
||||
if (nurl.substr(-1)!="/") nurl+="/";
|
||||
var url=nurl+str+'?thumbnails';
|
||||
url+='?thumbnails';
|
||||
get_thumbnails_url(url, str, files[$i]);
|
||||
}
|
||||
}
|
||||
@@ -754,6 +765,40 @@
|
||||
alert(tmptextarea.innerHTML+"<!--constStr@Success-->");
|
||||
}
|
||||
<!--UploadJsStart-->
|
||||
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';
|
||||
}
|
||||
function seconds2hour(seconds) {
|
||||
let h, m, s;
|
||||
if (parseFloat(seconds)<60) {
|
||||
return seconds + 's';
|
||||
} else {
|
||||
s = (seconds % 60).toFixed(0);
|
||||
m = parseInt(seconds / 60);
|
||||
if (parseInt(m)<60) {
|
||||
return m + 'm' + s + 's';
|
||||
} else {
|
||||
h = parseInt(m / 60);
|
||||
m = m % 60;
|
||||
return h + 'h' + m + 'm' + s + 's';
|
||||
}
|
||||
}
|
||||
}
|
||||
function uploadbuttonhide() {
|
||||
document.getElementById('upload_btns').style.display='none';
|
||||
/*document.getElementById('upload_submit').disabled='disabled';
|
||||
@@ -768,6 +813,9 @@
|
||||
document.getElementById('upload_submit').style.display='';
|
||||
document.getElementById('upload_file').style.display='';*/
|
||||
}
|
||||
var uploading = new Object();
|
||||
<!--UploadJsEnd-->
|
||||
<!--OnedriveUploadJsStart-->
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
@@ -780,7 +828,15 @@
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
var uploadList = setInterval(function(){
|
||||
if (i<files.length) {
|
||||
if (Object.keys(uploading).length<5) {
|
||||
getuplink(i);
|
||||
i++;
|
||||
}// else console.log(Object.keys(uploading).length);
|
||||
} else clearInterval(uploadList);
|
||||
}, 1000);
|
||||
//getuplink(i);
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var td1;
|
||||
@@ -793,7 +849,7 @@
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
@@ -806,10 +862,13 @@
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}
|
||||
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
uploading[upbigfilename] = i;
|
||||
var filemd5='';
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
strarry=str.split('.');
|
||||
if (strarry.length==1) return '';
|
||||
ext=strarry[strarry.length-1].toLowerCase();
|
||||
var reg = new RegExp(".","g");
|
||||
var a = str.replace(reg,"");
|
||||
@@ -837,29 +896,21 @@
|
||||
if (asize < file.size) {
|
||||
readblob(asize);
|
||||
} else {
|
||||
var filemd5 = spark.end();
|
||||
filemd5 = spark.end();
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
upbigfilename = filemd5+ext;
|
||||
<!--GuestEnd-->
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onprogress = function(e){
|
||||
td2.innerHTML+='.';
|
||||
}
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.status+xhr1.responseText);
|
||||
//console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==409) {
|
||||
// td2.innerHTML='nameAlreadyExists';
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
|
||||
<!--GuestStart-->
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
<!--GuestEnd-->
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" 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>';
|
||||
}
|
||||
if (xhr1.status==200) {
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
@@ -872,13 +923,27 @@
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file,html['uploadUrl'],timea+'_'+i, upbigfilename);
|
||||
}
|
||||
} else {
|
||||
if (xhr1.status==409) {
|
||||
// td2.innerHTML='nameAlreadyExists';
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
td2.innerHTML=html['error']['code']+': '+html['error']['message'];
|
||||
<!--GuestStart-->
|
||||
td2.innerHTML='md5: '+filemd5;
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'"><!--constStr@CopyUrl--></button></div>';
|
||||
<!--GuestEnd-->
|
||||
<!--AdminStart-->
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||file.name)+'" id="upfile_a1_'+tdnum+'"></a><!--constStr@UploadComplete--><button onclick="CopyAllDownloadUrl(\'#upfile_a1_'+tdnum+'\');" id="upfile_cpbt_'+tdnum+'" style="display:none"><!--constStr@CopyUrl--></button></div>';
|
||||
<!--AdminEnd-->
|
||||
}
|
||||
if (i<files.length-1) {
|
||||
/*if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}*/
|
||||
delete uploading[upbigfilename];
|
||||
}
|
||||
}
|
||||
xhr1.send(null);
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5);
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
@@ -886,24 +951,7 @@
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
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';
|
||||
}
|
||||
|
||||
function binupfile(file,url,tdnum,filename){
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
@@ -952,7 +1000,7 @@
|
||||
var tmptime = new Date();
|
||||
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
|
||||
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--> '+remaintime.toFixed(1)+'s';
|
||||
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));
|
||||
}
|
||||
}
|
||||
var C_starttime = new Date();
|
||||
@@ -961,6 +1009,7 @@
|
||||
var response=JSON.parse(xhr.responseText);
|
||||
if (response['size']>0) {
|
||||
// contain size, upload finish. 有size说明是最终返回,上传结束
|
||||
if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
@@ -968,6 +1017,7 @@
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
@@ -975,8 +1025,12 @@
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
document.getElementById('upfile_td1_'+tdnum).innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||response.name)+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+(file.webkitRelativePath||response.name)+'" 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>';
|
||||
delete uploading[filename];
|
||||
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>';
|
||||
label.innerHTML=StartStr+MiddleStr;
|
||||
label.style.color='green';
|
||||
|
||||
// uploadbuttonshow();
|
||||
<!--AdminStart-->
|
||||
response.name=file.webkitRelativePath||response.name;
|
||||
@@ -985,6 +1039,7 @@
|
||||
} else {
|
||||
if (!response['nextExpectedRanges']) {
|
||||
label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
|
||||
delete uploading[filename];
|
||||
} else {
|
||||
var a=response['nextExpectedRanges'][0];
|
||||
asize=Number( a.slice(0,a.indexOf("-")) );
|
||||
@@ -1000,12 +1055,332 @@
|
||||
} else {
|
||||
label.innerHTML='<font color="red">'+xhr2.responseText+'</font>';
|
||||
}
|
||||
delete uploading[filename];
|
||||
// uploadbuttonshow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--UploadJsEnd-->
|
||||
<!--OnedriveUploadJsEnd-->
|
||||
<!--AliyundriveUploadJsStart-->
|
||||
function preup() {
|
||||
uploadbuttonhide();
|
||||
var files=document.getElementById('upload_file').files;
|
||||
if (files.length<1) {
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
};
|
||||
var table1=document.createElement('table');
|
||||
document.getElementById('upload_div').appendChild(table1);
|
||||
table1.setAttribute('class','list-table');
|
||||
var timea=new Date().getTime();
|
||||
var i=0;
|
||||
var uploadList = setInterval(function(){
|
||||
if (i<files.length) {
|
||||
if (Object.keys(uploading).length<5) {
|
||||
getuplink(i);
|
||||
i++;
|
||||
}// else console.log(Object.keys(uploading).length);
|
||||
} else clearInterval(uploadList);
|
||||
}, 1000);
|
||||
//getuplink(i);
|
||||
function getuplink(i, r=0) {
|
||||
var file=files[i];
|
||||
var td1;
|
||||
var td2;
|
||||
if (r==0) {
|
||||
var tr1=document.createElement('tr');
|
||||
table1.appendChild(tr1);
|
||||
tr1.setAttribute('data-to',1);
|
||||
td1=document.createElement('td');
|
||||
tr1.appendChild(td1);
|
||||
td1.setAttribute('style','width:30%;word-break:break-word;');
|
||||
td1.setAttribute('id','upfile_td1_'+timea+'_'+i);
|
||||
td1.innerHTML=(file.webkitRelativePath||file.name)+'<br>'+size_format(file.size)+' ('+(i+1)+'/'+files.length+')';
|
||||
td2=document.createElement('td');
|
||||
tr1.appendChild(td2);
|
||||
td2.setAttribute('id','upfile_td2_'+timea+'_'+i);
|
||||
}
|
||||
var tdnum = timea+'_'+i;
|
||||
td1=document.getElementById('upfile_td1_'+tdnum);
|
||||
td2=document.getElementById('upfile_td2_'+tdnum);
|
||||
var chunksize=10*1024*1024; // 分块大小
|
||||
//var chunksize=100*1024; // 测试小块
|
||||
/*if (file.size>100*1024*1024*1024) {
|
||||
td2.innerHTML='<font color="red"><!--constStr@UpFileTooLarge--></font>';
|
||||
uploadbuttonshow();
|
||||
return;
|
||||
}*/
|
||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
uploading[upbigfilename] = [i];
|
||||
var spark = sha1.create();
|
||||
var reader = new FileReader();
|
||||
var chunksize=10*1024*1024;
|
||||
var asize = 0;
|
||||
var filesha1;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
|
||||
var binary = this.result;
|
||||
spark.update(binary);
|
||||
asize += chunksize;
|
||||
if (asize < file.size) {
|
||||
readblob(asize);
|
||||
} else {
|
||||
filesha1 = spark.hex();
|
||||
td2.innerHTML='SHA1: ' + filesha1;
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
let p = str.lastIndexOf('.');
|
||||
if (p===-1) return '';
|
||||
if (p===0) return '';
|
||||
return str.substr(p);
|
||||
}
|
||||
var ext = getext(file.webkitRelativePath||file.name);
|
||||
upbigfilename = filesha1 + ext;
|
||||
<!--GuestEnd-->
|
||||
//while (upbigfilename.indexOf('%2F')>0) upbigfilename = upbigfilename.replace('%2F', '/');
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var html = JSON.parse(localStorage.getItem(filesha1));
|
||||
//console.log(html);
|
||||
if (html!==null && ('part_info_list' in html)) {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
|
||||
} else {
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
//console.log(xhr1.status+xhr1.responseText);
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font>';
|
||||
if (xhr1.status==201) {
|
||||
if (xhr1.responseText=='') {
|
||||
getuplink(i,1);
|
||||
return;
|
||||
}
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//console.log(html);
|
||||
if (!html['part_info_list']) {
|
||||
if (html.name!='') {
|
||||
if (html.exist==true) td2.innerHTML=html.name+' 文件名已有';
|
||||
else if (html.rapid_upload==true) td2.innerHTML=html.name+' 秒传';
|
||||
else td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
td1.innerHTML='<div style="color:green"><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'?preview" id="upfile_a_'+tdnum+'" target="_blank">'+td1.innerHTML+'</a><br><a href="<!--base_disk_path--><!--Path-->'+upbigfilename+'" 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>';
|
||||
} else {
|
||||
td2.innerHTML='<font color="red">'+xhr1.responseText+'</font><br>';
|
||||
}
|
||||
delete uploading[upbigfilename];
|
||||
} else {
|
||||
td2.innerHTML='<!--constStr@UploadStart--> ...';
|
||||
//console.log(html);
|
||||
localStorage.setItem(filesha1, JSON.stringify(html));
|
||||
binupfile(file, html, timea+'_'+i, upbigfilename, filesha1, chunksize);
|
||||
}
|
||||
} else {
|
||||
delete uploading[upbigfilename];
|
||||
}
|
||||
/*if (i<files.length-1) {
|
||||
i++;
|
||||
getuplink(i);
|
||||
}*/
|
||||
}
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadbuttonshow();
|
||||
}
|
||||
function binupfile(file, res, tdnum, filename, filesha1, chunksize) {
|
||||
// xhr.getResponseHeader
|
||||
if (!('ETag' in res)) res['ETag'] = new Array();
|
||||
var fileid = res['file_id'];
|
||||
var uploadid = res['upload_id'];
|
||||
var label=document.getElementById('upfile_td2_'+tdnum);
|
||||
var reader = new FileReader();
|
||||
var StartStr='';
|
||||
var MiddleStr='';
|
||||
var StartTime;
|
||||
var EndTime;
|
||||
var newstartsize = 0;
|
||||
if(!!file){
|
||||
var chunknum = 0;
|
||||
var chunknumtotal = res['part_info_list'].length;
|
||||
var asize=0;
|
||||
var totalsize=file.size;
|
||||
var newstartsize=0;
|
||||
while (res['ETag'][chunknum]!=null) {
|
||||
chunknum++;
|
||||
newstartsize += chunksize;
|
||||
}
|
||||
StartTime = new Date();
|
||||
asize = newstartsize;
|
||||
if (newstartsize==0) {
|
||||
StartStr='<!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
} else {
|
||||
StartStr='<!--constStr@LastUpload-->'+size_format(newstartsize)+ '<br><!--constStr@ThisTime--><!--constStr@UploadStartAt-->:' +StartTime.toLocaleString()+'<br>' ;
|
||||
}
|
||||
//var chunksize=5*1024*1024; // chunk size, max 60M. 每小块上传大小
|
||||
//if (totalsize>200*1024*1024) chunksize=10*1024*1024;
|
||||
function readblob(start) {
|
||||
var end=start+chunksize;
|
||||
var blob = file.slice(start,end);
|
||||
reader.readAsArrayBuffer(blob);
|
||||
//reader.readAsArrayBuffer(file);
|
||||
}
|
||||
readblob(asize);
|
||||
|
||||
reader.onload = function(e){
|
||||
if (asize>totalsize) {
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.responseText+','+xhr1.status);
|
||||
if (xhr1.status==200) {
|
||||
localStorage.removeItem(filesha1);
|
||||
<!--AdminStart-->
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//response.name=file.webkitRelativePath||response.name;
|
||||
addelement(html);
|
||||
<!--AdminEnd-->
|
||||
/*if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}*/
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
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.style.color='green';
|
||||
} else {
|
||||
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
|
||||
localStorage.removeItem(filesha1);
|
||||
}
|
||||
delete uploading[filename];
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
} else {
|
||||
var binary = this.result;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", res['part_info_list'][chunknum]['upload_url'], true);
|
||||
//xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
bsize=asize+e.loaded-1;
|
||||
xhr.setRequestHeader('Content-Range', 'bytes ' + asize + '-' + bsize +'/'+ totalsize);
|
||||
xhr.upload.onprogress = function(e){
|
||||
if (e.lengthComputable) {
|
||||
var tmptime = new Date();
|
||||
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
|
||||
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));
|
||||
}
|
||||
}
|
||||
var C_starttime = new Date();
|
||||
xhr.onload = function(e){
|
||||
if (xhr.status<500) {
|
||||
//console.log(xhr.responseText);
|
||||
//console.log(xhr.getResponseHeader('ETag'));
|
||||
//var response=JSON.parse(xhr.responseText);
|
||||
if (xhr.responseText==''&&xhr.getResponseHeader('ETag')!='') {
|
||||
// 有ETag说明本段上传成功
|
||||
let etag = xhr.getResponseHeader('ETag');
|
||||
//if (etag.substr(0,1)=='"') etag = etag.substr(1);还就要引号!
|
||||
//if (etag.substr(-1)=='"') etag = etag.substr(0, etag.length-1);
|
||||
res['ETag'][chunknum] = etag;
|
||||
localStorage.setItem(filesha1, JSON.stringify(res));
|
||||
chunknum++;
|
||||
asize = bsize + 1;
|
||||
if (chunknum==chunknumtotal) {
|
||||
// 上传结束
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
//xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onload = function(e){
|
||||
console.log(xhr1.responseText+','+xhr1.status);
|
||||
if (xhr1.status==200) {
|
||||
localStorage.removeItem(filesha1);
|
||||
<!--AdminStart-->
|
||||
var html=JSON.parse(xhr1.responseText);
|
||||
//response.name=file.webkitRelativePath||response.name;
|
||||
addelement(html);
|
||||
<!--AdminEnd-->
|
||||
/*if (totalsize>10*1024*1024) {
|
||||
var xhr3 = new XMLHttpRequest();
|
||||
xhr3.open("GET", '?action=del_upload_cache&filelastModified='+file.lastModified+'&filesize='+file.size+'&filename='+filename);
|
||||
xhr3.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr3.send(null);
|
||||
xhr3.onload = function(e){
|
||||
console.log(xhr3.responseText+','+xhr3.status);
|
||||
}
|
||||
}*/
|
||||
EndTime=new Date();
|
||||
MiddleStr = '<!--constStr@EndAt-->:'+EndTime.toLocaleString()+'<br>';
|
||||
if (newstartsize==0) {
|
||||
MiddleStr += '<!--constStr@AverageSpeed-->:'+size_format(totalsize*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
} else {
|
||||
MiddleStr += '<!--constStr@ThisTime--><!--constStr@AverageSpeed-->:'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s<br>';
|
||||
}
|
||||
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.style.color='green';
|
||||
} else {
|
||||
label.innerHTML= '<font color="red">' + xhr1.status + ',' + xhr1.responseText + '</font>';
|
||||
localStorage.removeItem(filesha1);
|
||||
}
|
||||
delete uploading[filename];
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
// uploadbuttonshow();
|
||||
} else {
|
||||
readblob(asize);
|
||||
}
|
||||
} else {
|
||||
console.log(xhr.status+xhr.responseText);//<PartEtag>
|
||||
if (xhr.status==409) {
|
||||
let str = xhr.responseText;
|
||||
str = str.substr(str.indexOf('<PartEtag>')+10);
|
||||
str = str.substr(0, str.indexOf('</PartEtag>'));
|
||||
res['ETag'][chunknum] = str;
|
||||
localStorage.setItem(filesha1, JSON.stringify(res));
|
||||
chunknum++;
|
||||
asize += chunksize;
|
||||
readblob(asize);
|
||||
} else {
|
||||
delete uploading[filename];
|
||||
}
|
||||
//label.innerHTML='<font color="red">'+xhr.responseText+'</font><br>';
|
||||
} } else readblob(asize);
|
||||
}
|
||||
xhr.send(binary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<!--AliyundriveUploadJsEnd-->
|
||||
<!--GoogledriveUploadJsStart-->
|
||||
function preup() {
|
||||
alert("Stop!\nCan not upload form explorer without token.");
|
||||
}
|
||||
<!--GoogledriveUploadJsEnd-->
|
||||
<!--ListEnd-->
|
||||
function operatediv_close(operate) {
|
||||
document.getElementById(operate+'_div').style.display='none';
|
||||
@@ -1013,9 +1388,28 @@
|
||||
}
|
||||
<!--AdminStart-->
|
||||
function logout() {
|
||||
document.cookie = "admin=; path=/";
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie = "admin=; path=/; "+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
/*for some mobile browser*/
|
||||
function menu_click(e){
|
||||
var ee=document.getElementsByClassName("active");
|
||||
for(var i=0;i<ee.length;i++){
|
||||
ee[i].classList.remove("active");
|
||||
}
|
||||
if(e.type!="mouseout")this.classList.add("active");
|
||||
}
|
||||
(function(){
|
||||
var e=document.getElementsByClassName("operate");
|
||||
document.body.addEventListener("touchstart", menu_click);
|
||||
for(var i=0;i<e.length;i++){
|
||||
e[i].addEventListener("touchstart", menu_click);
|
||||
e[i].addEventListener("mouseout", menu_click);
|
||||
}
|
||||
})();
|
||||
<!--IsFolderStart-->
|
||||
function showdiv(event,action,num) {
|
||||
var $operatediv=document.getElementsByName('operatediv');
|
||||
@@ -1027,21 +1421,19 @@
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
if (num=='') {
|
||||
var str='';
|
||||
var fileid='';
|
||||
} else {
|
||||
var str=document.getElementById('file_a'+num).innerText;
|
||||
if (str=='') {
|
||||
str=document.getElementById('file_a'+num).getElementsByTagName("img")[0].alt;
|
||||
if (str=='') {
|
||||
alert('<!--constStr@GetFileNameFail-->');
|
||||
operatediv_close(action);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var str=decodeURIComponent(document.getElementById('file_a'+num).href);
|
||||
if (str.substr(-1)==' ') str=str.substr(0, str.length-1);
|
||||
if (str.substr(-1)=='/') str=str.substr(0, str.length-1);
|
||||
if (str.substr(-8)=='?preview') str=str.substr(0, str.length-8);
|
||||
if (str.lastIndexOf('/')>-1) str=str.substr(str.lastIndexOf('/')+1);
|
||||
var fileid=document.getElementById('file_a'+num).attributes['fileid'].nodeValue;
|
||||
}
|
||||
document.getElementById(action + '_div').style.display='';
|
||||
document.getElementById(action + '_label').innerText=str;//.replace(/&/,'&');
|
||||
document.getElementById(action + '_sid').value=num;
|
||||
document.getElementById(action + '_fileid').value=fileid;
|
||||
document.getElementById(action + '_hidden').value=str;
|
||||
if (action=='rename') document.getElementById(action + '_input').value=str;
|
||||
var $e = event || window.event;
|
||||
@@ -1070,9 +1462,9 @@
|
||||
function submit_operate(str) {
|
||||
var num=document.getElementById(str+'_sid').value;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", '?'+serializeForm(str+'_form'));
|
||||
xhr.open("POST", '');
|
||||
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
|
||||
xhr.send(null);
|
||||
xhr.onload = function(e){
|
||||
var html;
|
||||
if (xhr.status<300) {
|
||||
@@ -1088,10 +1480,12 @@
|
||||
html=JSON.parse(xhr.responseText);
|
||||
addelement(html);
|
||||
}
|
||||
//alert('success');
|
||||
} else alert(xhr.status+'\n'+xhr.responseText);
|
||||
document.getElementById(str+'_div').style.display='none';
|
||||
document.getElementById('mask').style.display='none';
|
||||
}
|
||||
xhr.send(serializeForm(str+'_form'));
|
||||
return false;
|
||||
}
|
||||
function addelement(html) {
|
||||
@@ -1105,15 +1499,16 @@
|
||||
a1.target='_blank';
|
||||
var td2=document.createElement('td');
|
||||
td2.setAttribute('class','updated_at');
|
||||
td2.innerText=html.lastModifiedDateTime.replace(/T/,' ').replace(/Z/,'');
|
||||
if (!!html.time) td2.innerText=html.time.replace(/T/,' ').replace(/Z/,'');
|
||||
var td3=document.createElement('td');
|
||||
td3.setAttribute('class','size');
|
||||
td3.innerText=size_format(html.size);
|
||||
if (!!html.folder) {
|
||||
if (!!html.size) td3.innerText=size_format(html.size);
|
||||
else td3.innerText='0 B';
|
||||
if (html.type=='folder') {
|
||||
a1.href+='/';
|
||||
document.getElementById('tr0').parentNode.insertBefore(tr1,document.getElementById('tr0').nextSibling);
|
||||
}
|
||||
if (!!html.file) {
|
||||
if (html.type=='file') {
|
||||
a1.href+='?preview';
|
||||
a1.name='filelist';
|
||||
document.getElementById('tr0').parentNode.appendChild(tr1);
|
||||
@@ -1187,18 +1582,11 @@
|
||||
}
|
||||
<!--IsFolderEnd-->
|
||||
<!--AdminEnd-->
|
||||
<!--LoginStart-->
|
||||
function login() {
|
||||
document.getElementById('mask').style.display='';
|
||||
//document.getElementById('mask').style.width=document.documentElement.scrollWidth+'px';
|
||||
document.getElementById('mask').style.height=document.documentElement.scrollHeight<window.innerHeight?window.innerHeight:document.documentElement.scrollHeight+'px';
|
||||
document.getElementById('login_div').style.display='';
|
||||
document.getElementById('login_div').style.left=(document.body.clientWidth-document.getElementById('login_div').offsetWidth)/2 +'px';
|
||||
document.getElementById('login_div').style.top=(window.innerHeight-document.getElementById('login_div').offsetHeight)/2+document.body.scrollTop +'px';
|
||||
document.getElementById('login_input').focus();
|
||||
}
|
||||
<!--LoginEnd-->
|
||||
<!--EncryptedStart-->
|
||||
document.getElementById('password1').focus();
|
||||
<!--EncryptedEnd-->
|
||||
</script>
|
||||
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/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-->
|
||||
<!--customScript-->
|
||||
</html>
|
||||
|
||||
+8
-7
@@ -3,9 +3,9 @@
|
||||
"music":"musical-notes",
|
||||
"video":"logo-youtube",
|
||||
"img":"image",
|
||||
"office":"paper",
|
||||
"office":"newspaper",
|
||||
"txt":"clipboard",
|
||||
"zip":"filing",
|
||||
"zip":"file-tray-full",
|
||||
"iso":"disc",
|
||||
"apk":"logo-android",
|
||||
"exe":"logo-windows",
|
||||
@@ -89,7 +89,7 @@
|
||||
<li class="operate"><ion-icon name="construct"></ion-icon><!--constStr@Operate--><ul>
|
||||
<!--IsFolderStart-->
|
||||
<li><a onclick="showdiv(event,'create','');"><ion-icon name="add-circle"></ion-icon><!--constStr@Create--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt','');"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a href="?RefreshCache"><ion-icon name="refresh"></ion-icon><!--constStr@RefreshCache--></a></li>
|
||||
<!--IsFolderEnd-->
|
||||
<li><a href="<!--IsPreview?-->setup"><ion-icon name="settings"></ion-icon><!--constStr@Setup--></a></li>
|
||||
@@ -240,7 +240,7 @@
|
||||
<!--AdminStart-->
|
||||
<li class="operate"><ion-icon name="construct"></ion-icon><a><!--constStr@Operate--></a>
|
||||
<ul>
|
||||
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event,'encrypt',<!--filenum-->);"><ion-icon name="lock-closed"></ion-icon><!--constStr@Encrypt--></a></li>
|
||||
<li><a onclick="showdiv(event, 'rename',<!--filenum-->);"><ion-icon name="create"></ion-icon><!--constStr@Rename--></a></li>
|
||||
<li><a onclick="showdiv(event, 'move',<!--filenum-->);"><ion-icon name="move"></ion-icon><!--constStr@Move--></a></li>
|
||||
<li><a onclick="showdiv(event, 'copy',<!--filenum-->);"><ion-icon name="copy"></ion-icon><!--constStr@Copy--></a></li>
|
||||
@@ -849,6 +849,7 @@
|
||||
return;
|
||||
}
|
||||
upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||
var filemd5='';
|
||||
<!--GuestStart-->
|
||||
function getext(str) {
|
||||
strarry=str.split('.');
|
||||
@@ -885,7 +886,7 @@
|
||||
<!--GuestEnd-->
|
||||
td2.innerHTML='<!--constStr@GetUploadLink--> ...';
|
||||
var xhr1 = new XMLHttpRequest();
|
||||
xhr1.open("GET", '?action=upbigfile&upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&lastModified='+ file.lastModified);
|
||||
xhr1.open("POST", '?action=upbigfile');
|
||||
xhr1.setRequestHeader('x-requested-with','XMLHttpRequest');
|
||||
xhr1.onprogress = function(e){
|
||||
td2.innerHTML+='.';
|
||||
@@ -920,7 +921,7 @@
|
||||
getuplink(i);
|
||||
}
|
||||
}
|
||||
xhr1.send(null);
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5);
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
@@ -1247,6 +1248,6 @@
|
||||
document.getElementById('password1').focus();
|
||||
<!--EncryptedEnd-->
|
||||
</script>
|
||||
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
||||
<!--customScript-->
|
||||
</html>
|
||||
|
||||
-1272
File diff suppressed because it is too large
Load Diff
+226
-80
@@ -1,18 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link rel="preconnect" href="https://renexmoe.vercel.app">
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||
<meta charset="utf-8" />
|
||||
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no" />
|
||||
<title>
|
||||
<!--Title-->
|
||||
</title>
|
||||
<meta name="description" content="A Onemanager-PHP site with Theme-renexmoe">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v0.5/css/app.css"><meta name="theme-color" content="#fff" />
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="<!--base_path-->favicon.ico"
|
||||
type="image/x-icon"
|
||||
/>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<title><!--Title--></title>
|
||||
<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" />
|
||||
<!--BackgroundStart-->
|
||||
<style>
|
||||
body {
|
||||
@@ -20,15 +24,36 @@
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-attachment: fixed;
|
||||
background-image: var(--bg)
|
||||
background-image: var(--bg);
|
||||
}
|
||||
|
||||
.mdui-shadow-3 {
|
||||
background: rgba(255, 255, 255, 0.5)
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
</style>
|
||||
<script>window.disableddarkmode = true;</script>
|
||||
<script>
|
||||
window.disableddarkmode = true;
|
||||
</script>
|
||||
<!--BackgroundEnd-->
|
||||
<!--BackgroundMStart-->
|
||||
<style>
|
||||
body {
|
||||
--bg: url("<!--BackgroundMUrl-->");
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-attachment: fixed;
|
||||
background-image: var(--bg);
|
||||
}
|
||||
|
||||
.mdui-shadow-3 {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.disableddarkmode = true;
|
||||
</script>
|
||||
<!--BackgroundMEnd-->
|
||||
|
||||
</head>
|
||||
<body
|
||||
class="mdui-appbar-with-toolbar mdui-theme-layout-auto mdui-loaded mdui-theme-accent-pink"
|
||||
@@ -39,13 +64,11 @@
|
||||
<div class="mdui-toolbar">
|
||||
<span
|
||||
class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white"
|
||||
mdui-tooltip="{content: '菜单'}"
|
||||
onclick='mdui.$("body").toggleClass("mdui-drawer-body-left");'
|
||||
id="toggle-drawer"
|
||||
><i class="mdui-icon material-icons">menu</i></span
|
||||
>
|
||||
<a
|
||||
mdui-tooltip="{content: '返回'}"
|
||||
class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white mdui-hidden-sm-up"
|
||||
onclick="window.history.back()"
|
||||
>
|
||||
@@ -65,7 +88,6 @@
|
||||
<!--AdminStart--><a
|
||||
href="javascript:;"
|
||||
class="mdui-btn mdui-btn-icon mdui-ripple mdui-hidden-sm-up refresh"
|
||||
mdui-tooltip="{content: '刷新缓存'}"
|
||||
><i class="mdui-icon material-icons">refresh</i></a
|
||||
>
|
||||
<!--AdminEnd-->
|
||||
@@ -76,19 +98,36 @@
|
||||
<div class="mdui-drawer mdui-drawer-close" id="main-drawer">
|
||||
<div class="mdui-list" mdui-collapse="{accordion: true}">
|
||||
<!--LoginStart-->
|
||||
<li class="mdui-list-item mdui-ripple" href="javascript:void(0);" mdui-dialog="{target: '#login_input'}"><a
|
||||
class="mdui-list-item-icon mdui-icon material-icons">account_circle</a><a
|
||||
class="mdui-list-item-content">登录</a></li>
|
||||
<li
|
||||
class="mdui-list-item mdui-ripple"
|
||||
href="javascript:void(0);"
|
||||
mdui-dialog="{target: '#login_input'}"
|
||||
>
|
||||
<a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a
|
||||
><a class="mdui-list-item-content">登录</a>
|
||||
</li>
|
||||
<!--LoginEnd-->
|
||||
<!--AdminStart-->
|
||||
<li class="mdui-list-item mdui-ripple" href="?setup"><a class="mdui-list-item-icon mdui-icon material-icons"
|
||||
href="?setup">account_circle</a><a class="mdui-list-item-content" href="?setup">管理</a></li>
|
||||
<li class="mdui-list-item mdui-ripple" onclick='document.cookie=null;window.location.reload();'><i
|
||||
class="mdui-icon material-icons mdui-list-item-icon">exit_to_app</i>
|
||||
<li class="mdui-list-item mdui-ripple" href="?setup">
|
||||
<a class="mdui-list-item-icon mdui-icon material-icons" href="?setup"
|
||||
>account_circle</a
|
||||
><a class="mdui-list-item-content" href="?setup">管理</a>
|
||||
</li>
|
||||
<li
|
||||
class="mdui-list-item mdui-ripple"
|
||||
onclick="document.cookie=``;window.location.reload();"
|
||||
id="logout"
|
||||
>
|
||||
<i class="mdui-icon material-icons mdui-list-item-icon">exit_to_app</i>
|
||||
<div class="mdui-list-item-content">退出登陆</div>
|
||||
</li>
|
||||
<!--AdminEnd-->
|
||||
<li class="mdui-list-item mdui-ripple" id="checkupdate">
|
||||
<i class="mdui-icon material-icons mdui-list-item-icon">update</i>
|
||||
<div class="mdui-list-item-content">检查主题更新</div>
|
||||
</li>
|
||||
<div class="mdui-divider"></div>
|
||||
<!--AdminEnd-->
|
||||
|
||||
<li
|
||||
class="mdui-list-item mdui-ripple"
|
||||
href="javascript:void(0);"
|
||||
@@ -102,29 +141,33 @@
|
||||
href="<!--base_path-->"
|
||||
class="mdui-list-item-icon mdui-icon material-icons"
|
||||
>home</a
|
||||
><a href="<!--base_path-->" class="mdui-list-item-content">
|
||||
><a href="<!--base_path-->" class="mdui-list-item-content" id="home">
|
||||
<!--constStr@Home--></a
|
||||
>
|
||||
</li>
|
||||
<!--MultiDiskAreaStart-->
|
||||
<div class="mdui-divider"></div>
|
||||
<!--MultiDisksStart--><a
|
||||
<!--MultiDisksStart-->
|
||||
<li class="mdui-list-item mdui-ripple">
|
||||
<a
|
||||
href="<!--MultiDisksUrl-->"
|
||||
class="mdui-list-item mdui-ripple"
|
||||
<!--MultiDisksNow--
|
||||
class="mdui-list-item-icon mdui-icon material-icons"
|
||||
>cloud</a
|
||||
>
|
||||
<a
|
||||
href="<!--MultiDisksUrl-->"
|
||||
class="mdui-list-item-content mdui-text-truncate disk_name"
|
||||
>
|
||||
><i class="mdui-list-item-icon mdui-icon material-icons">cloud</i>
|
||||
<div class="mdui-list-item-content">
|
||||
<!--MultiDisksName-->
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<!--MultiDisksEnd-->
|
||||
<div class="mdui-divider"></div>
|
||||
<!--MultiDiskAreaEnd-->
|
||||
|
||||
<a
|
||||
href="https://github.com/qkqpttgf/OneManager-php"
|
||||
class="mdui-list-item mdui-ripple mdui-hidden-sm-up"
|
||||
class="mdui-list-item mdui-ripple"
|
||||
><i class="mdui-list-item-icon mdui-icon material-icons">code</i>
|
||||
<div class="mdui-list-item-content">Github</div>
|
||||
</a>
|
||||
@@ -141,29 +184,74 @@
|
||||
|
||||
<div class="mdui-container">
|
||||
<ul class="mdui-menu" id="admin-menu">
|
||||
<li class="mdui-menu-item"><a href="javascript:;" class="mdui-ripple back"><i
|
||||
class="mdui-menu-item-icon mdui-icon material-icons">arrow_back</i>返回上一页</a></li>
|
||||
<li class="mdui-menu-item">
|
||||
<a href="javascript:;" class="mdui-ripple back"
|
||||
><i class="mdui-menu-item-icon mdui-icon material-icons">arrow_back</i
|
||||
>返回上一页</a
|
||||
>
|
||||
</li>
|
||||
<!--AdminStart-->
|
||||
<li class="mdui-menu-item"><a href="javascript:;" class="mdui-ripple refresh"><i
|
||||
class="mdui-menu-item-icon mdui-icon material-icons">refresh</i>刷新缓存</a></li>
|
||||
<li class="mdui-menu-item">
|
||||
<a href="javascript:;" class="mdui-ripple refresh"
|
||||
><i class="mdui-menu-item-icon mdui-icon material-icons">refresh</i
|
||||
>刷新缓存</a
|
||||
>
|
||||
</li>
|
||||
<!--AdminEnd-->
|
||||
</ul>
|
||||
<i id="mouseplace" style="position: absolute;"></i> <!--EncryptedStart-->
|
||||
<div class="mdui-col-md-6 mdui-col-offset-md-3"><br>
|
||||
<i id="mouseplace" style="position: absolute"></i>
|
||||
|
||||
<div class="mdui-dialog" id="login_input">
|
||||
<div class="mdui-dialog-title">登录</div>
|
||||
<div class="mdui-dialog-content" style="height: 108px">
|
||||
<div class="mdui-textfield mdui-textfield-floating-label">
|
||||
<i class="mdui-icon material-icons">lock</i
|
||||
><label class="mdui-textfield-label">密码</label
|
||||
><input
|
||||
class="mdui-textfield-input"
|
||||
name="password1"
|
||||
type="password"
|
||||
onkeydown="if(event.keyCode==13) document.querySelector('#login_btn').click();"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mdui-dialog-actions">
|
||||
<button class="mdui-btn mdui-ripple" mdui-dialog-close="" id="login_close">取消</button
|
||||
><button
|
||||
id="login_btn"
|
||||
class="mdui-btn mdui-ripple"
|
||||
type="submit"
|
||||
value="登录"
|
||||
>
|
||||
登录
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!--EncryptedStart-->
|
||||
<div class="mdui-col-md-6 mdui-col-offset-md-3">
|
||||
<br />
|
||||
<center>
|
||||
<div class="mdui-typo-title">这是一个受保护的文件夹,您需要提供访问密码才能查看。</div>
|
||||
<div class="mdui-typo-title">
|
||||
这是一个受保护的文件夹,您需要提供访问密码才能查看。
|
||||
</div>
|
||||
</center>
|
||||
<form action="" method="post">
|
||||
<div class="mdui-textfield mdui-textfield-floating-label"><i
|
||||
class="mdui-icon material-icons">https</i><label class="mdui-textfield-label">
|
||||
<!--constStr@InputPassword--></label><input name="password1" class="mdui-textfield-input"
|
||||
type="password" /></div><br><button type="submit"
|
||||
class="mdui-center mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme"><i
|
||||
class="mdui-icon material-icons">fingerprint</i>
|
||||
<!--constStr@Submit--></button>
|
||||
<div class="mdui-textfield mdui-textfield-floating-label">
|
||||
<i class="mdui-icon material-icons">https</i
|
||||
><label class="mdui-textfield-label"> <!--constStr@InputPassword--></label
|
||||
><input name="password1" class="mdui-textfield-input" type="password" />
|
||||
</div>
|
||||
<br /><button
|
||||
type="submit"
|
||||
class="mdui-center mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme"
|
||||
>
|
||||
<i class="mdui-icon material-icons">fingerprint</i>
|
||||
<!--constStr@Submit-->
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<!--EncryptedEnd-->
|
||||
|
||||
<!--IsFolderStart-->
|
||||
<!--HeadomfStart-->
|
||||
<div class="mdui-typo mdui-shadow-3" style="padding: 20px; margin: 20px 0">
|
||||
@@ -171,16 +259,22 @@
|
||||
</div>
|
||||
<!--HeadomfEnd-->
|
||||
<!--HeadmdStart-->
|
||||
<div class="mdui-chip mdui-ripple mdui-hidden-xs"><span class="mdui-chip-icon"><i
|
||||
class="mdui-icon material-icons">face</i></span><span class="mdui-chip-title">HEAD.md</span></div>
|
||||
<div class="mdui-typo mdui-shadow-3 markdown" style="padding: 20px;margin: 20px 0" id="head"><textarea
|
||||
id="head-md"><!--HeadmdContent--></textarea></div>
|
||||
<!--HeadmdEnd-->
|
||||
<div class="mdui-chip mdui-ripple mdui-hidden-xs">
|
||||
<span class="mdui-chip-icon"
|
||||
><i class="mdui-icon material-icons">face</i></span
|
||||
><span class="mdui-chip-title">HEAD.md</span>
|
||||
</div>
|
||||
<div
|
||||
class="mdui-row mdui-shadow-3"
|
||||
style="padding: 5px; margin: 20px 0; border-radius: 8px"
|
||||
class="mdui-typo mdui-shadow-3 markdown"
|
||||
style="padding: 20px; margin: 20px 0; overflow-x: scroll"
|
||||
id="head"
|
||||
>
|
||||
<ul class="mdui-list">
|
||||
<pre><code id="head-md"><!--HeadmdContent--></code></pre>
|
||||
</div>
|
||||
<!--HeadmdEnd-->
|
||||
|
||||
<div class="mdui-row mdui-shadow-3" style="margin: 20px 0; border-radius: 8px">
|
||||
<ul class="mdui-list" id="file-list">
|
||||
<li class="mdui-list-item mdui-ripple">
|
||||
<div class="mdui-row mdui-col-xs-12">
|
||||
<div class="mdui-col-xs-12 mdui-col-sm-7">
|
||||
@@ -210,7 +304,7 @@
|
||||
</div>
|
||||
</li>
|
||||
<!--BackArrowStart-->
|
||||
<li class="mdui-list-item mdui-ripple">
|
||||
<li class="mdui-list-item mdui-ripple back-page">
|
||||
<div class="mdui-row mdui-col-sm-12">
|
||||
<a href="<!--BackArrowUrl-->">
|
||||
<div class="mdui-col-xs-7">
|
||||
@@ -292,35 +386,71 @@
|
||||
</ul>
|
||||
</div>
|
||||
<!--ReadmemdStart-->
|
||||
<div class="mdui-chip mdui-ripple mdui-hidden-xs"><span class="mdui-chip-icon"><i
|
||||
class="mdui-icon material-icons">face</i></span><span class="mdui-chip-title">README.md</span></div>
|
||||
<div class="mdui-typo mdui-shadow-3 markdown" style="padding: 20px;margin: 20px 0" id="readme"><textarea
|
||||
id="readme-md"><!--ReadmemdContent--></textarea></div>
|
||||
<div class="mdui-chip mdui-ripple mdui-hidden-xs">
|
||||
<span class="mdui-chip-icon"
|
||||
><i class="mdui-icon material-icons">face</i></span
|
||||
><span class="mdui-chip-title">README.md</span>
|
||||
</div>
|
||||
<div
|
||||
class="mdui-typo mdui-shadow-3 markdown"
|
||||
style="padding: 20px; margin: 20px 0; overflow-x: scroll"
|
||||
id="readme"
|
||||
>
|
||||
<pre><code id="readme-md"><!--ReadmemdContent--></code></pre>
|
||||
</div>
|
||||
<!--ReadmemdEnd-->
|
||||
<!--FootomfStart-->
|
||||
<div class="mdui-typo mdui-shadow-3" style="padding: 20px; margin: 20px 0">
|
||||
<!--FootomfContent-->
|
||||
</div>
|
||||
<!--FootomfEnd-->
|
||||
|
||||
<script>
|
||||
document.querySelector("#admin-menu").innerHTML +=
|
||||
'<li class="mdui-menu-item"><a href="javascript:void(0);"class="mdui-ripple getalllink"><i class="mdui-menu-item-icon mdui-icon material-icons">link</i>批量链接</a></li>';
|
||||
</script>
|
||||
<script>
|
||||
window.MorePage = undefined;
|
||||
</script>
|
||||
<!--MorePageStart-->
|
||||
<script>
|
||||
window.MorePage = [
|
||||
<!--MorePageListNowStart-->
|
||||
<!--PageNum-->,
|
||||
<!--MorePageListNowEnd-->
|
||||
<!--MorePageListStart-->
|
||||
<!--PageNum-->,
|
||||
<!--MorePageListEnd-->
|
||||
];
|
||||
</script>
|
||||
<!--MorePageEnd-->
|
||||
|
||||
<!--IsFolderEnd-->
|
||||
<!--IsFileStart-->
|
||||
<div id="file">
|
||||
<div
|
||||
id="file"
|
||||
class="mdui-shadow-3"
|
||||
style="padding: 5px; margin: 20px 0px; padding: 20px; border-radius: 8px"
|
||||
>
|
||||
<!--IsimgFileStart-->
|
||||
<img class="mdui-img-fluid mdui-center mdui-m-t-5" src="<!--FileDownUrl-->" />
|
||||
<!--IsimgFileEnd-->
|
||||
|
||||
<!--IsmusicFileStart-->
|
||||
<audio
|
||||
class="mdui-center"
|
||||
src="<!--FileDownUrl-->"
|
||||
controls
|
||||
autoplay
|
||||
style="width: 100%; margin-top: 10%"
|
||||
style="width: 100%; margin-top: 10%; margin-bottom: 10%"
|
||||
></audio>
|
||||
<!--IsmusicFileEnd-->
|
||||
|
||||
<!--IsvideoFileStart-->
|
||||
<video class="mdui-video-fluid" controls style="margin-top: 20px">
|
||||
<video
|
||||
class="mdui-video-fluid"
|
||||
controls
|
||||
style="margin-top: 20px; margin-bottom: 20px"
|
||||
>
|
||||
<source src="<!--FileDownUrl-->" />
|
||||
<p>
|
||||
Your browser doesn't support HTML5 video. Here is a
|
||||
@@ -328,16 +458,17 @@ id="readme-md"><!--ReadmemdContent--></textarea></div>
|
||||
</p>
|
||||
</video>
|
||||
<!--IsvideoFileEnd-->
|
||||
|
||||
<!--IsofficeFileStart-->
|
||||
<iframe id="office-a" src="https://view.officeapps.live.com/op/view.aspx?src=<!--FileEncodeDownUrl-->"
|
||||
style="width: 100%;height: 800px" frameborder="0"></iframe>
|
||||
<iframe
|
||||
id="office-a"
|
||||
src="https://view.officeapps.live.com/op/view.aspx?src=<!--FileEncodeDownUrl-->"
|
||||
style="width: 100%; height: 800px"
|
||||
frameborder="0"
|
||||
></iframe>
|
||||
<!--IsofficeFileEnd-->
|
||||
|
||||
<!--IspdfFileStart-->
|
||||
<pre id="editor"
|
||||
style="white-space: pre-wrap;font-family: JetBrains Mono,Fira Code,Sarasa Mono SC,Cascadia Code,Menlo,Consolas,monaco,monospace;">
|
||||
PDF暂不支持 懂?
|
||||
</pre>
|
||||
<embed src="<!--FileEncodeReplaceUrl-->" type="application/pdf" />
|
||||
<!--IspdfFileEnd-->
|
||||
<!--IstxtFileStart-->
|
||||
<pre
|
||||
@@ -345,22 +476,38 @@ id="readme-md"><!--ReadmemdContent--></textarea></div>
|
||||
style="
|
||||
white-space: pre-wrap;
|
||||
font-family: JetBrains Mono, Fira Code, Sarasa Mono SC, Cascadia Code, Menlo,
|
||||
Consolas, monaco, monospace;
|
||||
Consolas, monaco, Noto Sans SC;
|
||||
"
|
||||
><!--TxtContent--></pre>
|
||||
><code id="code"><!--TxtContent--></code></pre>
|
||||
<script>
|
||||
document.querySelector("#admin-menu").innerHTML +=
|
||||
'<li class="mdui-menu-item"><a href="javascript:void(0);"class="mdui-ripple highlight"><i class="mdui-menu-item-icon mdui-icon material-icons">style</i>markdown解析</a></li>';
|
||||
document.querySelector(
|
||||
".mdui-toolbar"
|
||||
).innerHTML += `<a href="javascript:;" class="mdui-btn mdui-btn-icon mdui-ripple mdui-hidden-sm-up highlight"><i class="mdui-icon material-icons">style</i></a>`;
|
||||
</script>
|
||||
|
||||
<!--IstxtFileEnd-->
|
||||
|
||||
<!--IsOtherFileStart-->
|
||||
<!--constStr@FileNotSupport-->
|
||||
<!--IsOtherFileEnd-->
|
||||
</div><a href="<!--FileEncodeReplaceUrl-->" target="_blank"
|
||||
class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i
|
||||
class="mdui-icon material-icons">file_download</i></a>
|
||||
</div>
|
||||
<a
|
||||
href="<!--FileEncodeReplaceUrl-->"
|
||||
target="_blank"
|
||||
class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"
|
||||
><i class="mdui-icon material-icons">file_download</i></a
|
||||
>
|
||||
<script>
|
||||
document.querySelector("#admin-menu").innerHTML += '<li class="mdui-menu-item"><a href="javascript:void(0);"class="mdui-ripple downloadurl"><i class="mdui-menu-item-icon mdui-icon material-icons">cloud_download</i>下载链接</a></li>';
|
||||
document.querySelector('.mdui-toolbar').innerHTML += `<a href="javascript:;" class="mdui-btn mdui-btn-icon mdui-ripple mdui-hidden-sm-up downloadurl" mdui-tooltip="{content: '下载链接'}"><i class="mdui-icon material-icons">cloud_download</i></a>`;
|
||||
document.querySelector("#admin-menu").innerHTML +=
|
||||
'<li class="mdui-menu-item"><a href="javascript:void(0);"class="mdui-ripple downloadurl"><i class="mdui-menu-item-icon mdui-icon material-icons">cloud_download</i>下载链接</a></li>';
|
||||
document.querySelector(
|
||||
".mdui-toolbar"
|
||||
).innerHTML += `<a href="javascript:;" class="mdui-btn mdui-btn-icon mdui-ripple mdui-hidden-sm-up downloadurl"><i class="mdui-icon material-icons">cloud_download</i></a>`;
|
||||
</script>
|
||||
<!--IsFileEnd-->
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
@@ -368,6 +515,5 @@ id="readme-md"><!--ReadmemdContent--></textarea></div>
|
||||
{ "music":"audiotrack", "video":"ondemand_video", "img":"image",
|
||||
"pdf":"picture_as_pdf", "default":"insert_drive_file"}
|
||||
<!--IconValuesEnd-->
|
||||
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v0.5/js/webpack-runtime.379a2fcc01ccf12b5342.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v0.5/js/app.0a2b4a0f9fd0828393f6.js"></script>
|
||||
<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>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1812
File diff suppressed because one or more lines are too long
-1296
File diff suppressed because it is too large
Load Diff
-1296
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,40 @@
|
||||
20210817-2030.39
|
||||
fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
|
||||
修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
|
||||
|
||||
20210804-1535.38
|
||||
try fix "&"/"&" in filename. try show an img too height. change upload chunk size when upload speed>10M/s. fix forceHttps when custom domain in Glitch. fix ionicons svg lost.try use file id when rename. background (or other) based on width/height not only width. fix some bugs. Pre-Add platform Vercel, just wait bugs fixed.
|
||||
尝试修复文件名含 "&"/"&"。尝试在一屏内显示过长的图片。上传时分割的块大小随着上传速度改变。修复Glitch中使用自定义域名时forceHttps问题。修复ionicons图标失踪。尝试在重命名时使用file id来操作。背景(或其它)基于长宽来看是竖屏还是横屏,不再只看宽度。修复其它bug。预加入Vercel平台,等修复bugs。
|
||||
20210512-1648.37
|
||||
add setting "forceHttps", can force 302 jump to https. fix preview office files. fix manage in safari.fix disktag can be "home". fix some bugs.
|
||||
新增一个设置,可以强制跳转https。修复office文档预览。修复safari上点不了管理。盘的标签可以是home了,随便命名了。修复一些其它问题。
|
||||
20210331-1530.36
|
||||
admin can only use classic theme after admin login, and guest can not change theme now. fix: Sharelink can not work in php8. show disk space. limit 5 files in uploading. do with activityLimitReached. fix some bugs.
|
||||
暂时解决昨天阿里云盘最新防盗链。管理登录后只能用classic主题,游客不能再切换主题了。修复Sharelink在php8下不能正常工作。显示盘空间。同时上传文件数限制5个。对activityLimitReached稍微处理。修复一些bug。
|
||||
20210313-1352.35
|
||||
use driveId, after update, <font color="red">Aliyundrive and Googledrive please click the Change link after Driver type</font>. try fix: php8 will run error 500. change layout in settup. fix: uploading non-englist file name. try fix: sha1 a big file.
|
||||
换用driveId,更新后<font color="red">Aliyundrive与Googledrive请点一下那个切换链接</font>。尝试修复php8的500 ERROR。改变设置页面的布局。修复上传中文名文件时最终文件以url代码命名。阿里云盘上传时可以sha1大文件了。
|
||||
20210311-2004.34
|
||||
try fix: can not login, sha1.js not loaded(changed a cdn), show error log.
|
||||
尝试修复登录不了的情况:可能sha1.js没有载入(换了源),在登录页显示出错信息。
|
||||
20210309-1718.33
|
||||
Googledrive can operate now, but the uploading can not done on explorer without token. Onedrive try deal with activeLimit. Can change admin password now. Admin password will sha1 when submitting. Fix some bugs.
|
||||
Googledrive可以管理操作了,但因为没法在浏览器端不带token上传,所以上传操作作罢。Onedrive尝试处理activeLimit。可以修改admin密码了。登录等提交admin密码时,会sha1加密再提交。修复一些bug。
|
||||
20210301-1745.32
|
||||
Onedrive client secret extend. export&import config. adding Googledrive. add reffer: only listing domains can refer. add diskDescription: tips of disk. Heroku change function_name to HerokuappId. try fix domainforproxy. fix create in Aliyundrive. fix other bugs.
|
||||
Onedrive 的client延期。可以导入导出配置了。初步添加Googledrive。添加reffer:只有指定域名能引用。添加diskDescription:可以对盘备注了。Heroku中将function_name改为使用HerokuappId。尝试修复domainforproxy在个人帐号时的问题。修复阿里云盘不能新建与加密。修复其它bug。
|
||||
20210118-1600.31
|
||||
can change Ondrive to Sharepoint, can copy a disk. fix a bug that 500 error in setup.
|
||||
Onedrive跟Sharepoint可以切换了,可以复制一个盘。修复bug。
|
||||
20210115-1111.30
|
||||
<font color=red>v3, after update, please AddDisk again, please set passfile again.</font> themes of php deleted, or you can use branch v2_last.
|
||||
<font color=red>v3,一键升级后请重新添加盘,passfile失效,重新设置。</font>php主题删掉了,要么就用v2_last分支。
|
||||
20201229.29
|
||||
Modify tags, change sequence of disk.
|
||||
可以修改标签,移动标签顺序。
|
||||
20201215-1400.28
|
||||
fix: hackers can upload files to ANY folder (or create a new folder) in your Onedrive. add language zh-tw. now, on heroku, xhr can post. fix: 2 or more space in file name cause bugs.
|
||||
修复:构造代码后可以上传文件到你Onedrive的任意目录(甚至创建新目录)。新增zh-tw语言。xhr的post在heroku会接收了,改回post。修复:文件名有多个空格相连时造成bug。
|
||||
|
||||
20201106-1730.27
|
||||
Add theme. A code used in CloudFlare Workers. Admin not need password in folder. Add caddy2 rewrite rule. Add new platform Glitch. <font color=red>web hosting and VPS user should backup your config.php, after update, copy it to .data foloder.</font>
|
||||
添加主题。添加一段用于CF workers的代码。加密目录管理员不需要密码了。添加caddy2伪静态。新增Glitch平台。<font color=red>虚拟主机与VPS用户请备份config.php,升级后,手动将它覆盖到.data目录。</font>
|
||||
|
||||
Reference in New Issue
Block a user