Skip to content

Commit a4a3507

Browse files
committed
File Manager
1 parent 256af93 commit a4a3507

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

dist/easycoder-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/easycoder.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5629,7 +5629,9 @@ const EasyCoder_Browser = {
56295629
const response = event.target.responseText;
56305630
setProgress(0);
56315631
setStatus(``);
5632-
console.log(response);
5632+
if (response) {
5633+
console.log(response);
5634+
}
56335635
}, false);
56345636
ajax.addEventListener(`error`, function () {
56355637
setStatus(`Upload failed`);

iwsy/resources/ecs/fileman.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,16 @@ Show:
116116
set style `display` of Container to `block`
117117

118118
get UserRecord from storage as `.user`
119+
put property `email` of UserRecord into Email
120+
get Password from storage as `password`
119121
put property `home` of UserRecord into Home
122+
put Home cat `/` cat property `id` of UserRecord into Home
120123
put `users/` cat Home cat `/images` into Home
121124
put Home into CurrentPath
122125

123126
! Build the list
124127
Browser:
125-
rest get Content from `ulist/` cat Email can `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
128+
rest get Content from `ulist/` cat Email cat `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
126129
or begin
127130
alert `Failed to list files.`
128131
stop
@@ -186,15 +189,13 @@ Browser:
186189
if FileCount is 0
187190
begin
188191
put Path into CurrentPath
189-
rest post to `delete/` cat CurrentPath or
192+
rest post to `udelete/` cat Email cat `/` cat Password cat `/` cat CurrentPath or
190193
begin
191194
alert `Failed to delete a file.`
192195
stop
193196
end
194-
put the position of the last `~` in CurrentPath into N
195-
if N is less than 0 put the position of the last `/` in CurrentPath into N
197+
put the position of the last `/` in CurrentPath into N
196198
put left N of CurrentPath into CurrentPath
197-
alert `Returning to ` cat CurrentPath
198199
go to Browser
199200
end
200201
else
@@ -210,7 +211,7 @@ SelectFile:
210211
put property `type` of File into Type
211212
if Type is `dir`
212213
begin
213-
put CurrentPath cat `~` cat the content of FileName into CurrentPath
214+
put CurrentPath cat `/` cat the content of FileName into CurrentPath
214215
goto Browser
215216
end
216217
if Type is `img`
@@ -226,12 +227,11 @@ SelectFile:
226227
put CurrentPath cat `/` cat property `name` of File into FilePath
227228
set attribute `src` of Image to `/resources/` cat FilePath cat `?v=` cat now
228229
on click CloseButton go to CloseMedia
229-
set the text of URL to `/resources/` cat FilePath
230+
set the text of URL to `resources/` cat FilePath
230231
! highlight URL
231232
on click DeleteButton
232233
begin
233-
put `upload` cat FilePath into FilePath
234-
rest post to `delete/` cat FilePath or
234+
rest post to `udelete/` cat Email cat `/` cat Password cat `/` cat FilePath or
235235
begin
236236
alert `Failed to delete the image.`
237237
stop
@@ -258,7 +258,7 @@ Upload:
258258
else
259259
begin
260260
put CurrentPath into Path
261-
put `upload/` cat Path into Path
261+
put `upload/` cat Email cat `/` cat Password cat `/` cat Path into Path
262262
upload UploadFile to Path with UploadProgress and UploadStatus
263263
goto Browser
264264
end

iwsy/rest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,8 @@ function post($conn, $props, $action, $request) {
378378
$email = array_shift($request);
379379
$password = array_shift($request);
380380
checkUserPassword($conn, $email, $password);
381-
$path = $_POST['path'];
382-
$path = explode("/", $path);
383-
array_shift($path);
384-
$path = 'resources/' . join('/', $path);
381+
$path = 'resources/' . join('/', $request);
385382
mkdir($path, 0777, true);
386-
logger("path: $path");
387383
$fileName = $_FILES['source']['name'];
388384
$tempName = $_FILES['source']['tmp_name'];
389385
$fileType = $_FILES['source']['type'];
@@ -398,10 +394,11 @@ function post($conn, $props, $action, $request) {
398394
$size = getimagesize("$path/$fileName");
399395
logger("$path/$fileName: width:".$size[0].", height:".$size[1]);
400396
if ($size[0] > 1024) {
401-
logger("mogrify -resize 1024x1024 $path/$fileName");
402-
system("mogrify -resize 1024x1024 $path/$fileName");
397+
logger("mogrify -resize 1280x1280 $path/$fileName");
398+
system("mogrify -resize 1280x1280 $path/$fileName");
403399
}
404400
}
401+
exit;
405402

406403
default:
407404
http_response_code(400);
@@ -433,6 +430,7 @@ function checkUserPassword($conn, $email, $password)
433430
return;
434431
}
435432
}
433+
logger("User password check failed");
436434
http_response_code(403);
437435
print "{\"message\":\"REST: Bad password.\"}";
438436
exit;

js/easycoder/Browser.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2561,7 +2561,9 @@ const EasyCoder_Browser = {
25612561
const response = event.target.responseText;
25622562
setProgress(0);
25632563
setStatus(``);
2564-
console.log(response);
2564+
if (response) {
2565+
console.log(response);
2566+
}
25652567
}, false);
25662568
ajax.addEventListener(`error`, function () {
25672569
setStatus(`Upload failed`);

0 commit comments

Comments
 (0)