Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hexbee
Cloudreve
提交
65dcedb3
C
Cloudreve
项目概览
hexbee
/
Cloudreve
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cloudreve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
65dcedb3
编写于
3月 05, 2019
作者:
H
HFO4
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: blocking while get uptoken
上级
422f9d8d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
61 deletion
+72
-61
application/index/controller/File.php
application/index/controller/File.php
+1
-1
application/index/model/FileManage.php
application/index/model/FileManage.php
+3
-1
application/index/model/LocalAdapter.php
application/index/model/LocalAdapter.php
+9
-9
application/index/view/home/home.html
application/index/view/home/home.html
+4
-1
static/js/uploader/qiniu.js
static/js/uploader/qiniu.js
+55
-49
未找到文件。
application/index/controller/File.php
浏览文件 @
65dcedb3
...
...
@@ -170,6 +170,6 @@ class File extends Controller{
}
}
return
FileManage
::
createFolder
(
$dirName
,
$dirPosition
,
$this
->
userObj
->
uid
);
return
json
(
FileManage
::
createFolder
(
$dirName
,
$dirPosition
,
$this
->
userObj
->
uid
)
);
}
}
\ No newline at end of file
application/index/model/FileManage.php
浏览文件 @
65dcedb3
...
...
@@ -543,7 +543,9 @@ class FileManage extends Model{
$fileList
=
Db
::
name
(
'files'
)
->
where
(
'upload_user'
,
$uid
)
->
where
(
'dir'
,
$path
)
->
select
();
$dirList
=
Db
::
name
(
'folders'
)
->
where
(
'owner'
,
$uid
)
->
where
(
'position'
,
$path
)
->
select
();
$count
=
0
;
$fileListData
=
[];
$fileListData
=
[
"result"
=>
[],
];
foreach
(
$dirList
as
$key
=>
$value
)
{
$fileListData
[
'result'
][
$count
][
'name'
]
=
$value
[
'folder_name'
];
$fileListData
[
'result'
][
$count
][
'rights'
]
=
"drwxr-xr-x"
;
...
...
application/index/model/LocalAdapter.php
浏览文件 @
65dcedb3
...
...
@@ -301,15 +301,15 @@ class LocalAdapter extends Model{
* @return array
*/
static
function
getThumbSize
(
$width
,
$height
){
$rate
=
$width
/
$height
;
$maxWidth
=
9
0
;
$maxHeight
=
39
;
$changeWidth
=
39
*
$rate
;
$changeHeight
=
9
0
/
$rate
;
if
(
$changeWidth
>=
$maxWidth
){
return
[(
int
)
$changeHeight
,
9
0
];
}
return
[
39
,(
int
)
$changeWidth
];
//
$rate = $width/$height;
// $maxWidth = 28
0;
// $maxHeight = 150
;
// $changeWidth = 150
*$rate;
// $changeHeight = 28
0/$rate;
//
if($changeWidth>=$maxWidth){
// return [(int)$changeHeight,28
0];
//
}
return
[
230
,
200
];
}
/**
...
...
application/index/view/home/home.html
浏览文件 @
65dcedb3
...
...
@@ -31,7 +31,10 @@
allowShare
:
"
{$groupData.allow_share}
"
,
allowRemoteDownload
:
"
{:explode(
"
,
"
,$groupData.aria2)[0]}
"
,
allowTorrentDownload
:
"
{:explode(
"
,
"
,$groupData.aria2)[1]}
"
,
};
};
apiURL
=
{
imgThumb
:
"
/File/Thumb
"
};
</script>
</head>
<body>
...
...
static/js/uploader/qiniu.js
浏览文件 @
65dcedb3
...
...
@@ -714,7 +714,7 @@ function QiniuJsSDK() {
logger
.
debug
(
"
get uptoken from:
"
,
that
.
uptoken_url
);
// TODO: use mOxie
var
ajax
=
that
.
createAjax
();
ajax
.
open
(
'
GET
'
,
that
.
uptoken_url
,
fals
e
);
ajax
.
open
(
'
GET
'
,
that
.
uptoken_url
,
tru
e
);
ajax
.
setRequestHeader
(
"
If-Modified-Since
"
,
"
0
"
);
// ajax.onreadystatechange = function() {
// if (ajax.readyState === 4 && ajax.status === 200) {
...
...
@@ -723,58 +723,64 @@ function QiniuJsSDK() {
// }
// };
ajax
.
send
();
if
(
ajax
.
status
===
200
)
{
var
res
=
that
.
parseJSON
(
ajax
.
responseText
);
that
.
token
=
res
.
uptoken
;
if
(
uploadConfig
.
saveType
==
"
oss
"
){
var
putPolicy
=
that
.
token
;
that
.
sign
=
res
.
sign
;
that
.
access
=
res
.
id
;
that
.
file_name
=
res
.
key
;
that
.
callback
=
res
.
callback
;
}
else
if
(
uploadConfig
.
saveType
==
"
s3
"
){
var
putPolicy
=
that
.
token
;
that
.
sign
=
res
.
sign
;
that
.
policy
=
res
.
policy
;
that
.
file_name
=
res
.
key
;
that
.
credential
=
res
.
credential
;
that
.
x_amz_date
=
res
.
x_amz_date
;
that
.
surl
=
res
.
siteUrl
;
that
.
callbackKey
=
res
.
callBackKey
;
}
else
if
(
uploadConfig
.
saveType
==
"
upyun
"
){
var
putPolicy
=
that
.
token
;
that
.
token
=
res
.
token
;
that
.
policy
=
res
.
policy
;
}
else
if
(
uploadConfig
.
saveType
==
"
remote
"
){
var
putPolicy
=
that
.
token
;
that
.
policy
=
res
.
uptoken
;
}
else
{
var
segments
=
that
.
token
.
split
(
"
:
"
);
var
putPolicy
=
that
.
parseJSON
(
that
.
URLSafeBase64Decode
(
segments
[
2
]));
if
(
!
that
.
tokenMap
)
{
that
.
tokenMap
=
{};
}
var
getTimestamp
=
function
(
time
)
{
return
Math
.
ceil
(
time
.
getTime
()
/
1000
);
};
var
serverTime
=
getTimestamp
(
new
Date
(
ajax
.
getResponseHeader
(
"
date
"
)));
var
clientTime
=
getTimestamp
(
new
Date
());
that
.
tokenInfo
=
{
serverDelay
:
clientTime
-
serverTime
,
deadline
:
putPolicy
.
deadline
,
isExpired
:
function
()
{
var
leftTime
=
this
.
deadline
-
getTimestamp
(
new
Date
())
+
this
.
serverDelay
;
return
leftTime
<
600
;
ajax
.
onload
=
function
(
e
){
if
(
ajax
.
status
===
200
)
{
var
res
=
that
.
parseJSON
(
ajax
.
responseText
);
that
.
token
=
res
.
uptoken
;
if
(
uploadConfig
.
saveType
==
"
oss
"
){
var
putPolicy
=
that
.
token
;
that
.
sign
=
res
.
sign
;
that
.
access
=
res
.
id
;
that
.
file_name
=
res
.
key
;
that
.
callback
=
res
.
callback
;
}
else
if
(
uploadConfig
.
saveType
==
"
s3
"
){
var
putPolicy
=
that
.
token
;
that
.
sign
=
res
.
sign
;
that
.
policy
=
res
.
policy
;
that
.
file_name
=
res
.
key
;
that
.
credential
=
res
.
credential
;
that
.
x_amz_date
=
res
.
x_amz_date
;
that
.
surl
=
res
.
siteUrl
;
that
.
callbackKey
=
res
.
callBackKey
;
}
else
if
(
uploadConfig
.
saveType
==
"
upyun
"
){
var
putPolicy
=
that
.
token
;
that
.
token
=
res
.
token
;
that
.
policy
=
res
.
policy
;
}
else
if
(
uploadConfig
.
saveType
==
"
remote
"
){
var
putPolicy
=
that
.
token
;
that
.
policy
=
res
.
uptoken
;
}
else
{
var
segments
=
that
.
token
.
split
(
"
:
"
);
var
putPolicy
=
that
.
parseJSON
(
that
.
URLSafeBase64Decode
(
segments
[
2
]));
if
(
!
that
.
tokenMap
)
{
that
.
tokenMap
=
{};
}
};
logger
.
debug
(
"
get token info:
"
,
that
.
tokenInfo
);
var
getTimestamp
=
function
(
time
)
{
return
Math
.
ceil
(
time
.
getTime
()
/
1000
);
};
var
serverTime
=
getTimestamp
(
new
Date
(
ajax
.
getResponseHeader
(
"
date
"
)));
var
clientTime
=
getTimestamp
(
new
Date
());
that
.
tokenInfo
=
{
serverDelay
:
clientTime
-
serverTime
,
deadline
:
putPolicy
.
deadline
,
isExpired
:
function
()
{
var
leftTime
=
this
.
deadline
-
getTimestamp
(
new
Date
())
+
this
.
serverDelay
;
return
leftTime
<
600
;
}
};
logger
.
debug
(
"
get token info:
"
,
that
.
tokenInfo
);
}
logger
.
debug
(
"
get new uptoken:
"
,
that
.
token
);
}
else
{
logger
.
error
(
"
get uptoken error:
"
,
ajax
.
responseText
);
}
logger
.
debug
(
"
get new uptoken:
"
,
that
.
token
);
}
else
{
}
ajax
.
onerror
=
function
(
e
){
logger
.
error
(
"
get uptoken error:
"
,
ajax
.
responseText
);
}
}
else
if
(
op
.
uptoken_func
)
{
logger
.
debug
(
"
get uptoken from uptoken_func
"
);
that
.
token
=
op
.
uptoken_func
(
file
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录