diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..b58b603
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/Webengineering-Filemanager.iml b/.idea/Webengineering-Filemanager.iml
new file mode 100644
index 0000000..0c8867d
--- /dev/null
+++ b/.idea/Webengineering-Filemanager.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/discord.xml b/.idea/discord.xml
new file mode 100644
index 0000000..cd711a0
--- /dev/null
+++ b/.idea/discord.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..27c39b5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Frontend/index.html b/Frontend/index.html
index a25fb47..3e0c3e7 100644
--- a/Frontend/index.html
+++ b/Frontend/index.html
@@ -2,6 +2,8 @@
- `
+
`;
document.body.appendChild(div.firstChild);
}
diff --git a/Frontend/static/js/tools.js b/Frontend/static/js/tools.js
index 83f82d7..89e15ed 100644
--- a/Frontend/static/js/tools.js
+++ b/Frontend/static/js/tools.js
@@ -2,6 +2,10 @@ function httpGetAsync(url, data, callback) {
const xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (this.readyState === 4) {
+ if (this.status !== 401) {
+ clearTimeout(timeout);
+ timeout = startTimeout();
+ }
callback(xmlHttp.responseText, xmlHttp.status);
}
}
@@ -25,6 +29,26 @@ function httpPostAsync(url, data, callback) {
xmlHttp.send(data);
}
+function httpUploadAsync(url, data, callback) {
+ const xmlHttp = new XMLHttpRequest();
+ xmlHttp.onreadystatechange = function () {
+ if (this.readyState === 4) {
+ callback(xmlHttp.responseText, xmlHttp.status);
+ }
+ }
+
+ xmlHttp.upload.addEventListener("progress",function(event){
+ let progressBar = document.getElementById("upload_progress");
+ let progress = (event.loaded/event.total)*100;
+ progressBar.value = progress;
+ console.log(progress)
+ });
+
+ xmlHttp.open("POST", url, true);
+ xmlHttp.setRequestHeader('Authorization', 'Basic ' + sessionStorage.getItem('authorization'));
+ xmlHttp.send(data);
+}
+
function httpDeleteAsync(url, data, callback) {
const xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
@@ -38,6 +62,15 @@ function httpDeleteAsync(url, data, callback) {
xmlHttp.send();
}
+function startTimeout() {
+ return setTimeout(function () {
+ sessionStorage.removeItem('authorization');
+ document.getElementById('logout').remove();
+ document.getElementById('context_menu').parentElement.remove();
+ create_login_view();
+ }, 600000);
+}
+
function findGetParameter(parameterName) {
let result = null,
tmp = [];
diff --git a/Frontend/static/js/views.js b/Frontend/static/js/views.js
index 64efe20..c901d18 100644
--- a/Frontend/static/js/views.js
+++ b/Frontend/static/js/views.js
@@ -118,7 +118,13 @@ function create_main_view(data) {
for (let i = 0; i < data.length; i++) {
if (data[i]['Type'] === 'dir') {
files.getElementsByTagName('tbody')[0].appendChild(add_table_row("folder", data[i]['Name'], "directory", curr_dir, true, function () {
- window.history.pushState('index', 'Filemanager', 'index.html?path=' + curr_dir + '/' + data[i]['Name']);
+ let url = ''
+ if (curr_dir === '/') {
+ url = 'index.html?path=' + curr_dir + data[i]['Name'];
+ } else {
+ url = 'index.html?path=' + curr_dir + '/' + data[i]['Name'];
+ }
+ window.history.pushState('index', 'Filemanager', url);
path_changed();
}));
}
@@ -128,7 +134,13 @@ function create_main_view(data) {
for (let i = 0; i < data.length; i++) {
if (data[i]['Type'] !== 'dir') {
files.getElementsByTagName('tbody')[0].appendChild(add_table_row(get_icon(data[i]['Type']), data[i]['Name'], data[i]['Type'], curr_dir, true, function () {
- show_file_view(curr_dir + '/' + data[i]['Name'], data[i]['Type']);
+ let url = ''
+ if (curr_dir === '/') {
+ url = '/' + data[i]['Name'];
+ } else {
+ url = curr_dir + '/' + data[i]['Name'];
+ }
+ show_file_view(url, data[i]['Type']);
}));
}
}
@@ -192,17 +204,17 @@ function show_file_view(data, type) {
create_modal(`File:
${data}`, ``);
httpGetAsync(base_url + data + '?format=base64', null, function (response, code) {
if (code === 200) {
- change_modal_content(`
`);
+ change_modal_content(`
`); /* TODO */
} else {
try_to_parse_error(response);
}
});
break;
case 'text':
- create_modal(`File:
${data}`, ``);
+ create_modal(`File:
${data}`, ``, `
`);
httpGetAsync(base_url + data, null, function (response, code) {
if (code === 200) {
- change_modal_content(`
`);
+ change_modal_content(`
`);
} else {
try_to_parse_error(response);
}
@@ -212,7 +224,7 @@ function show_file_view(data, type) {
create_modal(`File:
${data}`, ``);
httpGetAsync(base_url + data + '?format=base64', null, function (response, code) {
if (code === 200) {
- change_modal_content(`
`);
+ change_modal_content(`
`);
} else {
try_to_parse_error(response);
}
diff --git a/WebService/auth.db b/WebService/auth.db
new file mode 100644
index 0000000..702df64
Binary files /dev/null and b/WebService/auth.db differ