Add correct file hints for uploads

This commit is contained in:
rottencandy 2019-08-08 11:43:08 +05:30
parent f18e6a1007
commit 2b684a48af
2 changed files with 6 additions and 6 deletions

View File

@ -3,11 +3,11 @@ let rs = require('rswebui');
let util = require('files_util')
function setHashDetail(hash, isNew = false) {
function updateFileDetail(hash, isNew = false) {
rs.rsJsonApiRequest(
'/rsFiles/FileDetails', {
hash,
hintflags: 16, // RS_FILE_HINTS_DOWNLOAD
hintflags: 32, // RS_FILE_HINTS_UPLOAD
},
(fileStat) => {
if(!fileStat.retval) {
@ -41,7 +41,7 @@ let Uploads = {
if(Uploads.hashes.length > fileKeys.length) {
let newHashes = util.compareArrays(Uploads.hashes, fileKeys);
for(let hash of newHashes) {
setHashDetail(hash, true);
updateFileDetail(hash, true);
}
}
// Existing file removed
@ -53,7 +53,7 @@ let Uploads = {
}
}
for(let hash in Uploads.statusMap) {
setHashDetail(hash);
updateFileDetail(hash);
}
},
};

View File

@ -27,8 +27,8 @@ function rsJsonApiRequest(path, data, callback, async = true,
'Basic ' + btoa(loginKey.username + ':' + loginKey.passwd);
}
console.info('Sending request: \nPath: ' + path + '\nData: ' + data +
'\nHeaders:' + headers);
console.info('Sending request: \nPath: ', path, '\nData: ', data,
'\nHeaders:', headers);
// TODO: Properly handle types of fail situtations
// Eg. Retroshare switched off, wrong path, incorrect data, etc.
return m.request({