@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
107 lines (106 loc) • 4.96 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "LinksController", {
enumerable: true,
get: function() {
return LinksController;
}
});
const _common = require("@nestjs/common");
const _fastify = require("fastify");
const _authtokenoptionaldecorator = require("../../authentication/decorators/auth-token-optional.decorator");
const _userdecorator = require("../users/decorators/user.decorator");
const _userpassworddto = require("../users/dto/user-password.dto");
const _usermodel = require("../users/models/user.model");
const _routes = require("./constants/routes");
const _linksmanagerservice = require("./services/links-manager.service");
function _ts_decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function _ts_metadata(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}
function _ts_param(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
}
let LinksController = class LinksController {
linkValidation(user, uuid) {
return this.linksPublicManager.linkValidation(user, uuid);
}
linkAccess(user, uuid, req, res) {
return this.linksPublicManager.linkAccess(user, uuid, req, res);
}
linkAuthentication(user, uuid, linkPasswordDto, req, res) {
return this.linksPublicManager.linkAuthentication(user, uuid, linkPasswordDto, req, res);
}
constructor(linksPublicManager){
this.linksPublicManager = linksPublicManager;
}
};
_ts_decorate([
(0, _common.Get)(`${_routes.PUBLIC_LINKS_ROUTE.VALIDATION}/:uuid`),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_param(1, (0, _common.Param)('uuid')),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof _usermodel.UserModel === "undefined" ? Object : _usermodel.UserModel,
String
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], LinksController.prototype, "linkValidation", null);
_ts_decorate([
(0, _common.Get)(`${_routes.PUBLIC_LINKS_ROUTE.ACCESS}/:uuid`),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_param(1, (0, _common.Param)('uuid')),
_ts_param(2, (0, _common.Req)()),
_ts_param(3, (0, _common.Res)({
passthrough: true
})),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof _usermodel.UserModel === "undefined" ? Object : _usermodel.UserModel,
String,
typeof _fastify.FastifyRequest === "undefined" ? Object : _fastify.FastifyRequest,
typeof _fastify.FastifyReply === "undefined" ? Object : _fastify.FastifyReply
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], LinksController.prototype, "linkAccess", null);
_ts_decorate([
(0, _common.Post)(`${_routes.PUBLIC_LINKS_ROUTE.AUTH}/:uuid`),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_param(1, (0, _common.Param)('uuid')),
_ts_param(2, (0, _common.Body)()),
_ts_param(3, (0, _common.Req)()),
_ts_param(4, (0, _common.Res)({
passthrough: true
})),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof _usermodel.UserModel === "undefined" ? Object : _usermodel.UserModel,
String,
typeof _userpassworddto.UserPasswordDto === "undefined" ? Object : _userpassworddto.UserPasswordDto,
typeof _fastify.FastifyRequest === "undefined" ? Object : _fastify.FastifyRequest,
typeof _fastify.FastifyReply === "undefined" ? Object : _fastify.FastifyReply
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], LinksController.prototype, "linkAuthentication", null);
LinksController = _ts_decorate([
(0, _common.Controller)(_routes.PUBLIC_LINKS_ROUTE.BASE),
(0, _authtokenoptionaldecorator.AuthTokenOptional)(),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof _linksmanagerservice.LinksManager === "undefined" ? Object : _linksmanagerservice.LinksManager
])
], LinksController);
//# sourceMappingURL=links.controller.js.map