forked from flashii/eeprom
Removed debug-pages.
This commit is contained in:
parent
820efdcf41
commit
1422ddb526
3 changed files with 0 additions and 122 deletions
|
@ -1,112 +0,0 @@
|
|||
<!doctype html>
|
||||
<input type="file" id="-eeprom-file"/> <button id="-eeprom-abort">Abort</button> <progress id="-eeprom-progress" min="0" max="100" value="0"></progress> <span id="-eeprom-progress-done"></span> <span id="-eeprom-progress-total"></span><br/>
|
||||
<div id="-eeprom-history"></div>
|
||||
<script src="/js/eeprom-v1.0.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var eFile = document.getElementById('-eeprom-file'),
|
||||
eAbort = document.getElementById('-eeprom-abort'),
|
||||
eProgress = document.getElementById('-eeprom-progress'),
|
||||
eProgressD = document.getElementById('-eeprom-progress-done'),
|
||||
eProgressT = document.getElementById('-eeprom-progress-total'),
|
||||
eHistory = document.getElementById('-eeprom-history'),
|
||||
eTask = undefined;
|
||||
|
||||
eAbort.onclick = function() {
|
||||
if(eTask)
|
||||
eTask.abort();
|
||||
};
|
||||
|
||||
var eClient = new EEPROM(1, '/uploads', 'Misuzu :cookie');
|
||||
|
||||
eFile.onchange = function() {
|
||||
var task = eTask = eClient.createUpload(this.files[0]);
|
||||
|
||||
task.onProgress = function(progressInfo) {
|
||||
eProgress.value = progressInfo.progress;
|
||||
eProgressD.textContent = progressInfo.loaded;
|
||||
eProgressT.textContent = progressInfo.total;
|
||||
};
|
||||
|
||||
task.onFailure = function(errorInfo) {
|
||||
if(!errorInfo.userAborted) {
|
||||
var errorText = 'Was unable to upload file.';
|
||||
|
||||
switch(errorInfo.error) {
|
||||
case EEPROM.ERR_INVALID:
|
||||
errorText = 'Upload request was invalid.';
|
||||
break;
|
||||
case EEPROM.ERR_AUTH:
|
||||
errorText = 'Upload authentication failed, refresh and try again.';
|
||||
break;
|
||||
case EEPROM.ERR_ACCESS:
|
||||
errorText = 'You\'re not allowed to upload files.';
|
||||
break;
|
||||
case EEPROM.ERR_GONE:
|
||||
errorText = 'Upload client has a configuration error or the server is gone.';
|
||||
break;
|
||||
case EEPROM.ERR_DMCA:
|
||||
errorText = 'This file has been uploaded before and was removed for copyright reasons, you cannot upload this file.';
|
||||
break;
|
||||
case EEPROM.ERR_SERVER:
|
||||
errorText = 'Upload server returned a critical error, try again later.';
|
||||
break;
|
||||
case EEPROM.ERR_SIZE:
|
||||
if(errorInfo.maxSize < 1)
|
||||
errorText = 'Selected file is too large.';
|
||||
else {
|
||||
var _t = ['bytes', 'KB', 'MB', 'GB', 'TB'],
|
||||
_i = parseInt(Math.floor(Math.log(errorInfo.maxSize) / Math.log(1024))),
|
||||
_s = Math.round(errorInfo.maxSize / Math.pow(1024, _i), 2);
|
||||
|
||||
errorText = 'Upload may not be larger than %1 %2.'.replace('%1', _s).replace('%2', _t[_i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
alert(errorText);
|
||||
}
|
||||
};
|
||||
|
||||
task.onComplete = function(fileInfo) {
|
||||
eTask = undefined;
|
||||
|
||||
var elem = document.createElement('div');
|
||||
elem.id = fileInfo.id;
|
||||
|
||||
var link = document.createElement('a');
|
||||
link.textContent = fileInfo.id;
|
||||
link.href = fileInfo.url;
|
||||
link.target = '_blank';
|
||||
elem.appendChild(link);
|
||||
|
||||
elem.appendChild(document.createTextNode(' '));
|
||||
|
||||
var del = document.createElement('button');
|
||||
del.textContent = 'Delete';
|
||||
del.onclick = function() {
|
||||
var dTask = eClient.deleteUpload(fileInfo);
|
||||
|
||||
dTask.onFailure = function(reason) {
|
||||
alert('Delete failed: ' + reason);
|
||||
};
|
||||
|
||||
dTask.onSuccess = function() {
|
||||
eHistory.removeChild(elem);
|
||||
};
|
||||
|
||||
dTask.start();
|
||||
};
|
||||
elem.appendChild(del);
|
||||
|
||||
elem.appendChild(document.createTextNode(' '));
|
||||
|
||||
var json = document.createElement('code');
|
||||
json.textContent = JSON.stringify(fileInfo);
|
||||
elem.appendChild(json);
|
||||
|
||||
eHistory.appendChild(elem);
|
||||
};
|
||||
|
||||
task.start();
|
||||
};
|
||||
</script>
|
|
@ -12,7 +12,6 @@ define('PRM_DEBUG', is_file(PRM_ROOT . '/.debug'));
|
|||
define('PRM_PUBLIC', PRM_ROOT . '/public');
|
||||
define('PRM_SOURCE', PRM_ROOT . '/src');
|
||||
define('PRM_MIGRATIONS', PRM_ROOT . '/database');
|
||||
define('PRM_DEBUG_PAGES', PRM_ROOT . '/debug-pages');
|
||||
define('PRM_UPLOADS', PRM_PUBLIC . '/data');
|
||||
define('PRM_THUMBS', PRM_PUBLIC . '/thumb');
|
||||
|
||||
|
|
|
@ -299,15 +299,6 @@ if($isApiDomain) {
|
|||
$response->setContentType($contentType);
|
||||
$response->setFileName(addslashes($fileName));
|
||||
});
|
||||
|
||||
if(PRM_DEBUG) {
|
||||
$router->get('/test-v1.0.html', function($response) {
|
||||
$response->setContentType('text/html; charset=utf-8');
|
||||
return strtr(file_get_contents(PRM_DEBUG_PAGES . '/test-v1.0.html'), [
|
||||
':cookie' => htmlspecialchars((string)filter_input(INPUT_COOKIE, 'msz_auth')),
|
||||
]);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$router->use('/', function($response, $request) {
|
||||
if($request->getMethod() === 'OPTIONS') {
|
||||
|
|
Loading…
Reference in a new issue