Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 3 additions & 37 deletions webui-src/app/config/config_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SharedDirectories = () => {
const DownloadDirectory = () => {
let dlDir = '';
const setDir = () => {
rs.rsJsonApiRequest('rsFiles/setDownloadDirectory', {
rs.rsJsonApiRequest('/rsFiles/setDownloadDirectory', {
path: dlDir,
});
};
Expand All @@ -48,7 +48,7 @@ const PartialsDirectory = () => {
const setDir = () => {
// const path = document.getElementById('partial-dir-input').value; // unused?

rs.rsJsonApiRequest('rsFiles/setPartialsDirectory', {
rs.rsJsonApiRequest('/rsFiles/setPartialsDirectory', {
path: partialsDir,
});
};
Expand Down Expand Up @@ -76,7 +76,6 @@ const TransferOptions = () => {
let maxUploadSlots = undefined;
let strategy = undefined;
let diskLimit = undefined;
let encryptionPolicy = undefined;
let directDLPerm = undefined;
const setMaxSimultaneousDownloads = () =>
rs.rsJsonApiRequest('/rsFiles/setQueueSize', {
Expand All @@ -94,11 +93,6 @@ const TransferOptions = () => {
rs.rsJsonApiRequest('/rsFiles/setFreeDiskSpaceLimit', {
minimumFreeMB: parseInt(diskLimit),
});
const setDefaultEncryption = () => {
rs.rsJsonApiRequest('/rsFiles/setDefaultEncryptionPolicy', {
policy: parseInt(encryptionPolicy),
});
};
const setDirectDLPerm = () => {
rs.rsJsonApiRequest('/rsFiles/setFilePermDirectDL', {
perm: parseInt(directDLPerm),
Expand All @@ -112,9 +106,6 @@ const TransferOptions = () => {
(res) => (maxUploadSlots = res.body.retval)
);
rs.rsJsonApiRequest('/rsFiles/freeDiskSpaceLimit', {}, (data) => (diskLimit = data.retval));
rs.rsJsonApiRequest('/rsFiles/defaultEncryptionPolicy').then(
(res) => (encryptionPolicy = res.body.retval)
);
rs.rsJsonApiRequest('/rsFiles/filePermDirectDL').then(
(res) => (directDLPerm = res.body.retval)
);
Expand Down Expand Up @@ -153,31 +144,6 @@ const TransferOptions = () => {
oninput: (e) => (diskLimit = e.target.value),
onchange: setFreeLimit,
}),
m('p', 'End-to-end encryption:'),
m(
'select',
{
value: encryptionPolicy,
oninput: (e) => (encryptionPolicy = e.target.value),
onchange: setDefaultEncryption,
},
[
m(
'option',
{
value: util.RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT,
},
'Enforced'
),
m(
'option',
{
value: util.RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE,
},
'Accepted'
),
]
),
m('p', 'Allow Direct Download:'),
m(
'select',
Expand Down Expand Up @@ -230,4 +196,4 @@ const Layout = () => {
};
};

module.exports = Layout;
module.exports = Layout;
6 changes: 3 additions & 3 deletions webui-src/app/config/config_people.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Reputation = () => {
}),
m('p', 'Difference in votes (+/-) to rate an ID positively:'),
m('input[type=number]', {
oninput: (e) => (positiveThreshold = e.target.value),
oninput: (e) => (positiveThreshold = parseInt(e.target.value)),
value: positiveThreshold,
onchange: () =>
rs.rsJsonApiRequest(
Expand All @@ -84,7 +84,7 @@ const Reputation = () => {
}),
m('p', 'Difference in votes (+/-) to rate an ID negatively:'),
m('input[type=number]', {
oninput: (e) => (negativeThreshold = e.target.value),
oninput: (e) => (negativeThreshold = parseInt(e.target.value)),
value: negativeThreshold,
onchange: () =>
rs.rsJsonApiRequest(
Expand All @@ -97,7 +97,7 @@ const Reputation = () => {
}),
m('p', 'Delete banned identities after(in days, 0 means indefinitely):'),
m('input[type=number]', {
oninput: (e) => (deleteBannedAfter = e.target.value),
oninput: (e) => (deleteBannedAfter = parseInt(e.target.value)),
value: deleteBannedAfter,
onchange: () =>
rs.rsJsonApiRequest(
Expand Down
6 changes: 5 additions & 1 deletion webui-src/app/files/files_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function loadSharedDirectories() {
rs.events[rs.RsEventsType.SHARED_DIRECTORIES] = {
handler: (event) => {
console.log('Shared Directories Event: ', event);
loadSharedDirectories();
switch(event.mEventCode) {
case futil.RsSharedDirectoriesEventCode.SHARED_DIRS_LIST_CHANGED:
loadSharedDirectories();
break;
}
},
};

Expand Down
17 changes: 17 additions & 0 deletions webui-src/app/files/files_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ const DIR_FLAGS_ANONYMOUS_SEARCH = 0x0800;
const DIR_FLAGS_ANONYMOUS_DOWNLOAD = 0x0080;
const DIR_FLAGS_BROWSABLE = 0x0400;

const RsSharedDirectoriesEventCode = {
UNKNOWN : 0x00,
HASHING_PROCESS_STARTED : 0x01,
HASHING_PROCESS_PAUSED : 0x02,
HASHING_PROCESS_RESUMED : 0x04,
HASHING_PROCESS_FINISHED : 0x05,
HASHING_FILE : 0x06,
SAVING_FILE_INDEX : 0x07,
EXTRA_LIST_FILE_ADDED : 0x08,
EXTRA_LIST_FILE_REMOVED : 0x09,
SHARED_DIRS_LIST_CHANGED : 0x0a,
FRIEND_DIR_LIST_UPDATED : 0x0b,
OWN_DIR_LIST_UPDATED : 0x0c,
OWN_DIR_LIST_PROCESSING : 0x0d,
};

/* eslint-disable no-unused-vars */

// Access Permission calculated by performing OR operation on the above three flags.
Expand Down Expand Up @@ -332,6 +348,7 @@ module.exports = {
DIR_FLAGS_ANONYMOUS_SEARCH,
DIR_FLAGS_ANONYMOUS_DOWNLOAD,
DIR_FLAGS_BROWSABLE,
RsSharedDirectoriesEventCode,
RsNodeGroupId,
loadRsNodeGroupId,
File,
Expand Down
3 changes: 2 additions & 1 deletion webui-src/app/rswebui.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ function rsJsonApiRequest(
if (result.status === 200) {
callback(result.body, true);
} else {
loginKey.isVerified = false;
if(result.status === 403 || result.status === 401)
loginKey.isVerified = false;
callback(result, false);
m.route.set('/');
}
Expand Down