From 93c70319410d69fb4c724fcb7ea3df8d8fa81443 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 19 Mar 2020 15:05:57 +0800
Subject: [PATCH 01/10] in upload, not open new window, add copy button
---
theme/classic.php | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/theme/classic.php b/theme/classic.php
index f1e00b8..f59ae1d 100644
--- a/theme/classic.php
+++ b/theme/classic.php
@@ -209,7 +209,7 @@
else $filenum = 0; ?>
- |
+ |
|
|
@@ -712,17 +712,18 @@
} else console.log(xhr.status+'\n'+xhr.responseText);
}
}
- function CopyAllDownloadUrl() {
+ function CopyAllDownloadUrl(str) {
var tmptextarea=document.createElement('textarea');
document.body.appendChild(tmptextarea);
tmptextarea.setAttribute('style','position:absolute;left:-100px;width:0px;height:0px;');
- document.querySelectorAll('.download').forEach(function (e) {
+ document.querySelectorAll(str).forEach(function (e) {
tmptextarea.innerHTML+=e.href+"\r\n";
});
tmptextarea.select();
tmptextarea.setSelectionRange(0, tmptextarea.value.length);
document.execCommand("copy");
alert(tmptextarea.innerHTML);
+ //alert('Success');
}
var sort=0;
function sortby(string) {
@@ -1001,8 +1002,9 @@
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.name.substr(file.name.indexOf('.'));
+ //if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name'];
+ //if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.'));
+ filename = JSON.parse(xhr4.responseText)['name'];
if (filename=='') {
alert('');
uploadbuttonshow();
@@ -1011,8 +1013,9 @@
var lasturl = location.href;
if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/';
lasturl += filename + '?preview';
- //alert(lasturl);
- window.open(lasturl);
+ //window.open(lasturl);
+ document.getElementById('upfile_a_'+tdnum).href = lasturl;
+ document.getElementById('upfile_a1_'+tdnum).href = filename;
}
EndTime=new Date();
@@ -1022,7 +1025,7 @@
} else {
MiddleStr += ':'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s
';
}
- document.getElementById('upfile_td1_'+tdnum).innerHTML=''+filemd5+'
'+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
';
+ document.getElementById('upfile_td1_'+tdnum).innerHTML='';
label.innerHTML=StartStr+MiddleStr;
uploadbuttonshow();
From 0fad2cb0fc1268fcd565b50c7b1297d31b6f0868 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 19 Mar 2020 15:06:47 +0800
Subject: [PATCH 02/10] in upload, not open new window, add copy button
---
conststr.php | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/conststr.php b/conststr.php
index 65a3dea..2afa21c 100644
--- a/conststr.php
+++ b/conststr.php
@@ -688,7 +688,14 @@ $constStr = [
'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오.',
'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.',
],
-
+ 'CopyUrl' => [
+ 'en-us' => 'Copy URL',
+ 'zh-cn' => '复制链接',
+ ],
+ 'Success' => [
+ 'en-us' => 'Success',
+ 'zh-cn' => '成功',
+ ],
'Refresh' => [
'en-us' => 'Refresh',
'zh-cn' => '刷新',
From 3f4eab57cd59f0ba34637041323184e501185b95 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 19 Mar 2020 15:08:02 +0800
Subject: [PATCH 03/10] in upload, not open new window, add copy button
---
function/common.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/function/common.php b/function/common.php
index 1430b79..cc5dc0a 100644
--- a/function/common.php
+++ b/function/common.php
@@ -608,7 +608,12 @@ function main($path)
$data = '{"name":"' . $_GET['filemd5'] . $ext . '"}';
//echo $oldname .'
'. $data;
$tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']);
- if ($tmp['stat']==409) MSAPI('DELETE',$oldname,'',$_SERVER['access_token'])['body'];
+ if ($tmp['stat']==409) {
+ MSAPI('DELETE',$oldname,'',$_SERVER['access_token']);
+ $tmpbody = json_decode($tmp['body'], true);
+ $tmpbody['name'] = $_GET['filemd5'] . $ext;
+ $tmp['body'] = json_encode($tmpbody);
+ }
$path1 = path_format($_SERVER['list_path'] . path_format($path));
savecache('path_' . $path1, json_decode('{}',true), 1);
return output($tmp['body'],$tmp['stat']);
From 283b046b8038471617225b954cbc4ac16cc30d2e Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 19 Mar 2020 18:46:53 +0800
Subject: [PATCH 04/10] remove empty config
---
function/heroku.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/function/heroku.php b/function/heroku.php
index 6c4e2dc..ba91f84 100644
--- a/function/heroku.php
+++ b/function/heroku.php
@@ -93,6 +93,7 @@ function setConfig($arr, $disktag = '')
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
else $tmp['disktag'] = '';
}
+ 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'));
From 385b5e2c1c7137abdd68220e5942563c5e3d53a8 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 19 Mar 2020 23:11:55 +0800
Subject: [PATCH 05/10] change install
---
function/scf.php | 51 ++++++++++++++++++++++++++++++------------------
1 file changed, 32 insertions(+), 19 deletions(-)
diff --git a/function/scf.php b/function/scf.php
index fb98be5..978eaac 100644
--- a/function/scf.php
+++ b/function/scf.php
@@ -112,7 +112,9 @@ function setConfig($arr, $disktag = '')
}
// echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).'
//';
- return updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
+ $response = updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey'));
+ WaitSCFStat();
+ return $response;
}
function WaitSCFStat()
@@ -125,9 +127,17 @@ function WaitSCFStat()
function install()
{
global $constStr;
+ if ($_GET['install2']) {
+ $tmp['admin'] = $_POST['admin'];
+ setConfig($tmp);
+ if (needUpdate()) {
+ updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey);
+ return message('update to github version, reinstall.', 'Program updating', 201);
+ }
+ return output('Jump', 302);
+ }
if ($_GET['install1']) {
- if ($_POST['admin']!='') {
- $tmp['admin'] = $_POST['admin'];
+ //if ($_POST['admin']!='') {
$tmp['language'] = $_POST['language'];
$SecretId = getConfig('SecretId');
if ($SecretId=='') {
@@ -145,18 +155,27 @@ function install()
$html .= '
';
$title = 'Error';
+ return message($html, $title, 201);
} else {
- $trynum = 0;
- while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo '
-'.++$trynum;
- if (needUpdate()) {
- updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey);
- return message('update to github version, reinstall.', 'Program updating', 201);
- }
- return output('Jump', 302);
+ $html .= '
+
+ ';
+ $title = getconstStr('SetAdminPassword');
+ return message($html, $title, 201);
+ }
+ //}
}
if ($_GET['install0']) {
$html .= '
@@ -171,8 +190,6 @@ language:
';
';
$html .= '
-
';
- $html .= '
-