mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
Apply various small fixes
This commit is contained in:
parent
6061c81c36
commit
dbcd627815
@ -24,7 +24,7 @@ const { HLFilesystemOperation } = require("./definitions");
|
||||
|
||||
class HLReadDir extends HLFilesystemOperation {
|
||||
async _run () {
|
||||
const { subject, user, no_thumbs, no_assocs } = this.values;
|
||||
const { subject, user, no_thumbs, no_assocs, actor } = this.values;
|
||||
|
||||
if ( ! await subject.exists() ) {
|
||||
throw APIError.create('subject_does_not_exist');
|
||||
|
@ -17,9 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
const APIError = require("../../api/APIError");
|
||||
const { chkperm, get_descendants } = require("../../helpers");
|
||||
const { TYPE_DIRECTORY } = require("../FSNodeContext");
|
||||
const { NodeUIDSelector, NodeRawEntrySelector } = require("../node/selectors");
|
||||
const { RootNodeSelector } = require("../node/selectors");
|
||||
const { NodeUIDSelector, NodeChildSelector } = require("../node/selectors");
|
||||
const { LLFilesystemOperation } = require("./definitions");
|
||||
|
||||
class LLReadDir extends LLFilesystemOperation {
|
||||
@ -42,27 +41,14 @@ class LLReadDir extends LLFilesystemOperation {
|
||||
const svc_fsentry = svc.get('fsEntryService');
|
||||
const svc_fs = svc.get('filesystem');
|
||||
|
||||
if (
|
||||
subject.isRoot ||
|
||||
(await subject.isUserDirectory() && subject.name !== user.username)
|
||||
) {
|
||||
this.checkpoint('before call to get_descendants')
|
||||
const entries = await get_descendants(
|
||||
await subject.get('path'),
|
||||
user,
|
||||
1, true,
|
||||
)
|
||||
this.checkpoint('after call to get_descendants')
|
||||
|
||||
const children = await Promise.all(entries.map(async entry => {
|
||||
const node = await svc_fs.node(new NodeRawEntrySelector(entry));
|
||||
node.found_thumbnail = false;
|
||||
return node;
|
||||
}))
|
||||
|
||||
this.checkpoint('after get children (2)');
|
||||
|
||||
return children;
|
||||
if ( subject.isRoot ) {
|
||||
if ( ! actor.type.user ) return [];
|
||||
return [
|
||||
await svc_fs.node(new NodeChildSelector(
|
||||
new RootNodeSelector(),
|
||||
actor.type.user.username,
|
||||
))
|
||||
];
|
||||
}
|
||||
|
||||
this.checkpoint('before get direct descendants')
|
||||
|
@ -1147,7 +1147,7 @@ async function jwt_auth(req){
|
||||
else if(req.handshake && req.handshake.query && req.handshake.query.auth_token)
|
||||
token = req.handshake.query.auth_token;
|
||||
|
||||
if(!token)
|
||||
if(!token || token === 'null')
|
||||
throw('No auth token found');
|
||||
else if (typeof token !== 'string')
|
||||
throw('token must be a string.')
|
||||
|
@ -98,6 +98,7 @@ module.exports = eggspress('/readdir', {
|
||||
no_thumbs,
|
||||
no_assocs,
|
||||
user: req.user,
|
||||
actor: req.actor,
|
||||
});
|
||||
|
||||
// check for duplicate names
|
||||
|
@ -1,3 +1,4 @@
|
||||
const { invalidate_cached_user } = require("../helpers");
|
||||
const { asyncSafeSetInterval } = require("../util/promise");
|
||||
const { MINUTE, SECOND } = require("../util/time");
|
||||
const BaseService = require("./BaseService");
|
||||
@ -152,6 +153,10 @@ class SessionService extends BaseService {
|
||||
'WHERE `id` = ? LIMIT 1',
|
||||
[sql_ts, user_id],
|
||||
);
|
||||
const user = kv.get('users:id:' + user_id);
|
||||
if ( user ) {
|
||||
user.last_activity_ts = sql_ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user