remove deprecated sharing endpoints and event handlers

This commit is contained in:
Nariman Jelveh
2024-03-29 20:49:53 -07:00
parent fe0cd891e1
commit b4be6aa4a6
3 changed files with 1 additions and 107 deletions
+1 -55
View File
@@ -169,24 +169,6 @@ async function UIWindowItemProperties(item_name, item_path, item_uid, left, top,
$(el_window).find('.item-props-version-list').append('-');
}
// owner
$(el_window).find('.item-prop-val-permissions').append(`<p class="item-prop-perm-entry" style="margin-bottom:5px; margin-top:5px;">${(fsentry.owner.email === undefined || fsentry.owner.email === null) ? fsentry.owner.username : fsentry.owner.email} (owner)</p>`);
// other users with access
if(fsentry.permissions && fsentry.permissions.length > 0 ){
fsentry.permissions.forEach(perm => {
let h = ``;
// username/email
h += `<p class="item-prop-perm-entry" data-perm-uid="${perm.uid}" style="margin-bottom:5px; margin-top:5px;">${perm.email ?? perm.username} `;
// remove
h += `(<span class="remove-permission-link" data-perm-uid="${perm.uid}">remove</span>)`;
$(el_window).find('.item-prop-val-permissions').append(h);
});
}
else{
$(el_window).find('.item-prop-val-permissions').append('-');
}
$(el_window).find(`.disassociate-website-link`).on('click', function(e){
puter.hosting.update(
$(e.target).attr('data-subdomain'),
@@ -199,43 +181,7 @@ async function UIWindowItemProperties(item_name, item_path, item_uid, left, top,
}
}
)
})
$(el_window).find('.remove-permission-link').on('click', function(e){
const el_remove_perm_link= this;
const perm_uid = $(el_remove_perm_link).attr('data-perm-uid');
$.ajax({
url: api_origin + "/remove-perm",
type: 'POST',
async: true,
contentType: "application/json",
data: JSON.stringify({
uid: perm_uid,
}),
headers: {
"Authorization": "Bearer "+auth_token
},
statusCode: {
401: function () {
logout();
},
},
success: async function (res){
$(el_window).find(`.item-prop-perm-entry[data-perm-uid="${perm_uid}"]`).remove();
if($(el_window).find(`.item-prop-perm-entry`).length === 0){
$(el_window).find(`.item-prop-val-permissions`).html('-');
// todo is it better to combine the following two queriesinto one css selector?
$(`.item[data-uid="${item_uid}"]`).find(`.item-is-shared`).fadeOut(200);
// todo optim do this only if item is a directory
// todo this has to be case-insensitive but the `i` selector doesn't work on ^=
$(`.item[data-path^="${item_path}/"]`).find(`.item-is-shared`).fadeOut(200);
}
},
complete: function(){
}
})
})
})
}
})
}
-23
View File
@@ -2476,29 +2476,6 @@ window.move_items = async function(el_items, dest_path, is_undo = false){
success: function (){
}
})
// remove all associated permissions
// todo, some client-side check to see if this dir has an FR associated with it before sending a whole ajax req
$.ajax({
url: api_origin + "/remove-item-perms",
type: 'POST',
data: JSON.stringify({
uid: $(el_item).attr('data-uid'),
}),
async: true,
contentType: "application/json",
headers: {
"Authorization": "Bearer "+auth_token
},
statusCode: {
401: function () {
logout();
},
},
success: function (){
}
})
$(`.item[data-uid="${$(el_item).attr('data-uid')}"]`).find('.item-is-shared').fadeOut(300);
// if trashing dir...
if($(el_item).attr('data-is_dir') === '1'){
// disassociate all its websites
-29
View File
@@ -1697,35 +1697,6 @@ window.initgui = async function(){
}
});
$(document).on('click', '.remove-permission-link', async function(e){
const el_remove_perm_link= this;
const perm_uid = $(el_remove_perm_link).attr('data-perm-uid');
$.ajax({
url: api_origin + "/remove-perm",
type: 'POST',
async: true,
contentType: "application/json",
data: JSON.stringify({
uid: perm_uid,
}),
headers: {
"Authorization": "Bearer "+auth_token
},
statusCode: {
401: function () {
logout();
},
},
success: async function (res){
$(`[data-perm-uid="${perm_uid}"]`).hide("slide", { direction: "right" }, 300, function(e){
$(this).remove();
});
},
complete: function(){
}
})
})
// update mouse position coordinates
$(document).mousemove(function(event){
mouseX = event.clientX;