This commit is contained in:
Zuzanna 2025-11-18 12:05:18 +01:00
parent db9130ba84
commit d49b656d8c
3 changed files with 2 additions and 34 deletions

View File

@ -161,8 +161,7 @@ const factory = (UserObject, Util, Hash,
var userObjects = _getUserObjects(Env);
var userObject = Env.user.userObject;
userObjects.some(function (uo) {
console.log("hello2")
if (Object.keys(uo.getFileData(id, true)).length) {
if (Object.keys(uo.getFileData(id)).length) {
userObject = uo;
return true;
}
@ -188,8 +187,6 @@ const factory = (UserObject, Util, Hash,
var data = Env.user.proxy[UserObject.SHARED_FOLDERS][id];
if (data && !editable) { data = JSON.parse(JSON.stringify(data)); }
// If it's not a shared folder, check the pads
console.log("hello3")
if (!data) { data = Env.user.userObject.getFileData(id, editable); }
ret.push({
id: id,
@ -199,8 +196,6 @@ const factory = (UserObject, Util, Hash,
});
Object.keys(Env.folders).forEach(function (fId) {
Env.folders[fId].userObject.findChannels([channel]).forEach(function (id) {
console.log("hello4")
ret.push({
id: id,
fId: fId,
@ -217,8 +212,6 @@ const factory = (UserObject, Util, Hash,
var findHref = function (Env, href) {
var ret = [];
var id = Env.user.userObject.getIdFromHref(href);
console.log("hello5")
if (id) {
ret.push({
data: Env.user.userObject.getFileData(id),
@ -228,8 +221,6 @@ const factory = (UserObject, Util, Hash,
Object.keys(Env.folders).forEach(function (fId) {
var id = Env.folders[fId].userObject.getIdFromHref(href);
if (!id) { return; }
console.log("hello6")
ret.push({
fId: fId,
data: Env.folders[fId].userObject.getFileData(id),
@ -425,8 +416,6 @@ const factory = (UserObject, Util, Hash,
var _isDuplicateOwned = function (Env, path, id) {
// if (path && _isInSharedFolder(Env, path)) { console.log ("beep!!")
// return true; }
console.log("hello7")
var data = _getFileData(Env, id || Env.user.userObject.find(path));
if (!data) { return; }
if (!_ownedByMe(Env, data.owners)) { return; }

View File

@ -123,7 +123,6 @@ const factory = (Util, Hash,
exp.cryptor = createCryptor(config.editKey);
exp.setReadOnly = function (state, key) {
console.log("here!", state, key)
config.editKey = key;
exp.cryptor = createCryptor(key);
exp.cryptor.k = Math.random();
@ -322,10 +321,8 @@ const factory = (Util, Hash,
var getFileData = exp.getFileData = function (file, editable, edPub) {
if (!file) { return; }
var link;
// editable = true
try {
link = (files[STATIC_DATA] || {})[file];
// console.log("hello# 1", link)
} catch (err) {
console.error(err);
}
@ -337,28 +334,20 @@ const factory = (Util, Hash,
var data;
try {
data = files[FILES_DATA][file] || {};
// console.log("hello# 2")
} catch (err) {
console.error(err);
data = {};
}
// console.log("hello#", files[FILES_DATA], file)
// for
if (data.owners) {
// console.log("blorp!", data.owners, edPub)
var owner = data?.owners.includes(edPub)
editable = owner ? true : editable
// console.log("boink?", owner, editable)
}
if (!editable) {
// console.log("boink@", owner, editable)
data = JSON.parse(JSON.stringify(data));
// console.log("hello", data)
// console.log("hello", files)
if (data.href && data.href.indexOf('#') === -1) {
// Encrypted href: decrypt it if we can, otherwise remove it

View File

@ -101,8 +101,6 @@ const factory = (Hash, Util, UserObject, Cache,
// If we try to load an existing shared folder (isNew === false) but this folder
// doesn't exist in the database, abort and cb
nThen(function (waitFor) {
console.log("here5")
// If we're in onCacheReady, make sure we have a cache for this shared folder
if (config.cache) {
Cache.getChannelCache(secret.channel, waitFor(function (err) {
@ -114,8 +112,6 @@ const factory = (Hash, Util, UserObject, Cache,
}));
}
}).nThen(function (waitFor) {
console.log("here4")
isNewChannel(null, { channel: secret.channel }, waitFor(function (obj) {
if (obj.isNew && !isNew) {
store.manager.deprecateProxy(id, secret.channel, obj.reason);
@ -124,8 +120,6 @@ const factory = (Hash, Util, UserObject, Cache,
}
}));
}).nThen(function () {
console.log("here3")
var sf = allSharedFolders[secret.channel];
if (sf && sf.readOnly && secondaryKey) {
// We were in readOnly mode and now we know the edit keys!
@ -275,8 +269,6 @@ const factory = (Hash, Util, UserObject, Cache,
SF.upgrade = function (channel, secret) {
console.log("here2")
var sf = allSharedFolders[channel];
if (!sf || !sf.readOnly) { return; }
if (!sf.rt.setReadOnly) { return; }
@ -289,8 +281,6 @@ const factory = (Hash, Util, UserObject, Cache,
};
SF.leave = function (channel, teamId) {
console.log("here1")
var sf = allSharedFolders[channel];
if (!sf) { return; }
var clients = sf.teams;