@ozdao/martyrs 0.2.473 → 0.2.474
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Media-DW8RLbfM.js → Media-_vz04tII.js} +1 -1
- package/dist/{Media-y_TX6us_.mjs → Media-sGk7Bp9b.mjs} +1 -1
- package/dist/auth.server.js +6 -2
- package/dist/auth.server.mjs +6 -2
- package/dist/authJwt-CELQKF2s.js +82 -0
- package/dist/authJwt-DnXu3BFq.mjs +83 -0
- package/dist/builder.js +7 -4
- package/dist/builder.mjs +7 -4
- package/dist/chats.server.js +1 -1
- package/dist/chats.server.mjs +1 -1
- package/dist/community.server.js +4 -4
- package/dist/community.server.mjs +4 -4
- package/dist/events.server.js +4 -4
- package/dist/events.server.mjs +4 -4
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +3 -3
- package/dist/gallery.server.mjs +3 -3
- package/dist/{globals.abac-DT0VjfaZ.js → globals.abac-Bn-4tbX8.js} +110 -16
- package/dist/{globals.abac-CvmZM8XG.mjs → globals.abac-DZpTRxKR.mjs} +110 -16
- package/dist/globals.server.js +70 -10
- package/dist/globals.server.mjs +70 -10
- package/dist/{globals.verifier-C_VZYebB.mjs → globals.verifier-BdJxc8-8.mjs} +34 -0
- package/dist/{globals.verifier-ChDpCdy_.js → globals.verifier-CKYpYfQl.js} +34 -0
- package/dist/{index-CVXl1rB5.js → index-BOmxJQ5W.js} +7 -86
- package/dist/{index-Df8vtZx7.mjs → index-C_Fw0Umg.mjs} +7 -86
- package/dist/{main-CgmHzhq5.mjs → main-CqMtW7Hq.mjs} +274 -276
- package/dist/{main-CCfQH-Dd.js → main-CsGkbSyK.js} +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.cjs +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Select/Select.vue.js +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/community.client.js +27 -27
- package/dist/martyrs/src/modules/community/community.client.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +2 -3
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +2 -3
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +88 -27
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +89 -28
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.js +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +19 -0
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +19 -0
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.cjs +2 -0
- package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.js +2 -0
- package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +30 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +30 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/spots/store/spots.cjs +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.js +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +1 -1
- package/dist/notifications.server.mjs +1 -1
- package/dist/orders.server.js +5 -4
- package/dist/orders.server.mjs +5 -4
- package/dist/organizations.server.js +120 -47
- package/dist/organizations.server.mjs +120 -47
- package/dist/{ownership.schema-C0w02Vw1.mjs → ownership.schema-CNCotD3D.mjs} +10 -4
- package/dist/{ownership.schema-Ck2H9clB.js → ownership.schema-MxfJlPtq.js} +10 -4
- package/dist/products.server.js +415 -149
- package/dist/products.server.mjs +415 -149
- package/dist/{profile.schema-h61hhB2w.js → profile.schema-BLSuV_VC.js} +0 -4
- package/dist/{profile.schema-kP_zKXNt.mjs → profile.schema-BRuvQ7QV.mjs} +0 -4
- package/dist/{queryProcessor-CWnMIe2U.mjs → queryProcessor-CVKI651_.mjs} +62 -8
- package/dist/{queryProcessor-D6GuKfTV.js → queryProcessor-DSUqSk3I.js} +62 -8
- package/dist/rents.server.js +4 -4
- package/dist/rents.server.mjs +4 -4
- package/dist/spots.server.js +162 -8
- package/dist/spots.server.mjs +162 -8
- package/dist/style.css +27 -4
- package/dist/wallet.server.js +2 -2
- package/dist/wallet.server.mjs +2 -2
- package/package.json +1 -1
- package/src/builder/rspack/rspack.config.base.js +1 -1
- package/src/builder/rspack/rspack.config.client.js +13 -5
- package/src/components/Select/Select.vue +4 -2
- package/src/modules/auth/models/user.model.js +4 -1
- package/src/modules/community/components/sections/HotPosts.vue +1 -1
- package/src/modules/globals/controllers/classes/globals.abac.js +148 -23
- package/src/modules/globals/controllers/classes/globals.validator.js +37 -0
- package/src/modules/globals/controllers/classes/globals.verifier.js +2 -0
- package/src/modules/globals/controllers/policies/globals.policies.js +91 -74
- package/src/modules/globals/controllers/utils/queryProcessor.js +59 -11
- package/src/modules/globals/models/schemas/ownership.schema.js +11 -6
- package/src/modules/globals/models/schemas/profile.schema.js +0 -4
- package/src/modules/music/components/layouts/MusicLayout.vue +10 -58
- package/src/modules/music/components/pages/MusicHome.vue +5 -5
- package/src/modules/orders/components/pages/OrderCreate.vue +85 -12
- package/src/modules/orders/controllers/orders.controller.js +3 -0
- package/src/modules/orders/store/shopcart.js +1 -0
- package/src/modules/organizations/models/schemas/accesses.schema.js +18 -0
- package/src/modules/organizations/policies/organizations.policies.js +117 -61
- package/src/modules/products/components/pages/CategoryEdit.vue +27 -2
- package/src/modules/products/components/pages/Product.vue +1 -0
- package/src/modules/products/components/pages/ProductEdit.vue +2 -2
- package/src/modules/products/controllers/categories.controller.js +297 -133
- package/src/modules/products/middlewares/categories.verifier.js +177 -0
- package/src/modules/products/models/category.model.js +12 -14
- package/src/modules/products/routes/categories.routes.js +50 -11
- package/src/modules/products/store/categories.js +2 -0
- package/src/modules/spots/components/pages/SpotEdit.vue +21 -17
- package/src/modules/spots/components/sections/WorktimeEdit.vue +840 -0
- package/src/modules/spots/controllers/queries/getIsOpenNowStage.js +109 -0
- package/src/modules/spots/controllers/spots.controller.js +2 -1
- package/src/modules/spots/models/spot.model.js +59 -13
- package/src/modules/spots/store/spots.js +4 -1
- package/src/modules/products/middlewares/index.js +0 -11
- package/src/modules/products/middlewares/verifyCategory.js +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=require("./main-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=require("./main-CsGkbSyK.js"),C={class:"media-container"},M=["src","data-src","alt"],j=["controls","loop","muted","autoplay","playsinline","preload"],N=["src","type"],O={key:2,class:"media-placeholder"},P={key:3,class:"media-error"},S={__name:"Media",props:{url:{type:String,required:!0},options:{type:Object,default:()=>({muted:!0,loop:!0,playsinline:!0,preload:"metadata"})}},setup(t){const m=t,l=e.ref(null),p=e.ref(null),s=e.ref(!1),u=e.ref(null),v=e.ref(!1);let i=null,f=!1;const d=e.computed(()=>{var o,a,n;return(n=(a=(o=m.url)==null?void 0:o.split("."))==null?void 0:a.pop())==null?void 0:n.toLowerCase()}),g=e.computed(()=>["jpg","jpeg","png","gif","webp","svg","avif"].includes(d.value)),y=e.computed(()=>["mp4","webm","ogg"].includes(d.value)),x=e.computed(()=>({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg"})[d.value]||"");function E(){s.value=!0}function I(o){u.value=`Ошибка загрузки медиа: ${o.message}`,s.value=!1}async function w(){if(l.value)try{l.value.paused&&!f&&(await l.value.play(),f=!0)}catch(o){I(o)}}function L(){const o={root:null,rootMargin:"50px",threshold:.1};i=new IntersectionObserver(n=>{n.forEach(r=>{var c;v.value=r.isIntersecting,r.isIntersecting&&(y.value&&((c=m.options)!=null&&c.autoplay)&&w(),i.disconnect())})},o);const a=g.value?p.value:l.value;a&&i.observe(a)}return e.onMounted(()=>{L()}),e.onUnmounted(()=>{i&&i.disconnect()}),(o,a)=>{var n,r,c,k,h,b,B;return e.openBlock(),e.createElementBlock("div",C,[g.value?(e.openBlock(),e.createElementBlock("img",e.mergeProps({key:0,src:v.value?t.url:"","data-src":t.url,alt:((n=t.options)==null?void 0:n.alt)||"Image",class:["media-item",{loading:!s.value}],loading:"lazy",onLoad:E},t.options,{ref_key:"imageElement",ref:p}),null,16,M)):y.value?(e.openBlock(),e.createElementBlock("video",e.mergeProps({key:1,ref_key:"videoElement",ref:l,class:[{loading:!s.value},"media-item"],controls:!((r=t.options)!=null&&r.hideControls),loop:((c=t.options)==null?void 0:c.loop)!==!1,muted:((k=t.options)==null?void 0:k.muted)!==!1,autoplay:(h=t.options)==null?void 0:h.autoplay,playsinline:((b=t.options)==null?void 0:b.playsinline)!==!1,preload:((B=t.options)==null?void 0:B.preload)||"metadata",onLoadeddata:E},t.options),[e.createElementVNode("source",{src:t.url,type:x.value},null,8,N)],16,j)):e.createCommentVNode("",!0),s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",O," Loading... ")),u.value?(e.openBlock(),e.createElementBlock("div",P,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0)])}}},q=V._export_sfc(S,[["__scopeId","data-v-1f94a0e9"]]);exports.default=q;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as u, computed as m, onMounted as N, onUnmounted as P, createElementBlock as c, openBlock as d, createCommentVNode as f, mergeProps as V, createElementVNode as S, toDisplayString as q } from "vue";
|
|
2
|
-
import { _ as z } from "./main-
|
|
2
|
+
import { _ as z } from "./main-CqMtW7Hq.mjs";
|
|
3
3
|
const D = { class: "media-container" }, T = ["src", "data-src", "alt"], U = ["controls", "loop", "muted", "autoplay", "playsinline", "preload"], _ = ["src", "type"], $ = {
|
|
4
4
|
key: 2,
|
|
5
5
|
class: "media-placeholder"
|
package/dist/auth.server.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
|
-
const profile_schema = require("./profile.schema-
|
|
3
|
+
const profile_schema = require("./profile.schema-BLSuV_VC.js");
|
|
4
4
|
const credentials_schema = require("./credentials.schema-BmOPv6FD.js");
|
|
5
5
|
const require$$0 = require("jsonwebtoken");
|
|
6
6
|
const require$$1$1 = require("bcryptjs");
|
|
7
7
|
const require$$0$1 = require("mongoose");
|
|
8
8
|
const require$$1 = require("jwk-to-pem");
|
|
9
9
|
const mailing = require("./mailing-D4kWlk3_.js");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
11
11
|
const require$$0$2 = require("uuid");
|
|
12
12
|
const addMembersQuantity = require("./addMembersQuantity-DxWjHK1K.js");
|
|
13
13
|
const require$$0$3 = require("crypto");
|
|
@@ -65,6 +65,10 @@ function requireUser_model() {
|
|
|
65
65
|
default: "active",
|
|
66
66
|
required: true
|
|
67
67
|
},
|
|
68
|
+
birthday: {
|
|
69
|
+
type: Date,
|
|
70
|
+
default: null
|
|
71
|
+
},
|
|
68
72
|
roles: [{
|
|
69
73
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
70
74
|
ref: "Role"
|
package/dist/auth.server.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
|
-
import { r as requireProfile_schema } from "./profile.schema-
|
|
2
|
+
import { r as requireProfile_schema } from "./profile.schema-BRuvQ7QV.mjs";
|
|
3
3
|
import { r as requireCredentials_schema } from "./credentials.schema-oOC8B5KL.mjs";
|
|
4
4
|
import require$$0 from "jsonwebtoken";
|
|
5
5
|
import require$$1$1 from "bcryptjs";
|
|
6
6
|
import require$$0$1 from "mongoose";
|
|
7
7
|
import require$$1 from "jwk-to-pem";
|
|
8
8
|
import { r as requireMailing } from "./mailing-DvCT5ijo.mjs";
|
|
9
|
-
import { r as requireMiddlewares } from "./index-
|
|
9
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
10
10
|
import require$$0$2 from "uuid";
|
|
11
11
|
import { r as requireAddUserStatusFields, a as requireAddMembersQuantity } from "./addMembersQuantity-DBfuUEx_.mjs";
|
|
12
12
|
import require$$0$3 from "crypto";
|
|
@@ -64,6 +64,10 @@ function requireUser_model() {
|
|
|
64
64
|
default: "active",
|
|
65
65
|
required: true
|
|
66
66
|
},
|
|
67
|
+
birthday: {
|
|
68
|
+
type: Date,
|
|
69
|
+
default: null
|
|
70
|
+
},
|
|
67
71
|
roles: [{
|
|
68
72
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
69
73
|
ref: "Role"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require$$0 = require("jsonwebtoken");
|
|
3
|
+
var authJwt;
|
|
4
|
+
var hasRequiredAuthJwt;
|
|
5
|
+
function requireAuthJwt() {
|
|
6
|
+
if (hasRequiredAuthJwt) return authJwt;
|
|
7
|
+
hasRequiredAuthJwt = 1;
|
|
8
|
+
const jwt = require$$0;
|
|
9
|
+
const middlewareFactory = (db) => {
|
|
10
|
+
const User = db.user;
|
|
11
|
+
const Role = db.role;
|
|
12
|
+
const verifyToken = (continueOnFail = false) => {
|
|
13
|
+
return async (req, res, next) => {
|
|
14
|
+
try {
|
|
15
|
+
let token = req.headers["x-access-token"];
|
|
16
|
+
if (!token && req.cookies.user) {
|
|
17
|
+
let user = JSON.parse(req.cookies.user);
|
|
18
|
+
token = user.accessToken;
|
|
19
|
+
}
|
|
20
|
+
if (req.headers["x-service-key"]) {
|
|
21
|
+
const serviceKey = req.headers["x-service-key"];
|
|
22
|
+
const validServiceKey = process.env.SERVICE_KEY;
|
|
23
|
+
if (serviceKey !== validServiceKey) {
|
|
24
|
+
return res.status(403).send({ message: "Unauthorized: Invalid service key" });
|
|
25
|
+
}
|
|
26
|
+
req.isServiceRequest = true;
|
|
27
|
+
return next();
|
|
28
|
+
}
|
|
29
|
+
if (!token) {
|
|
30
|
+
req.userId = null;
|
|
31
|
+
if (continueOnFail) {
|
|
32
|
+
return next();
|
|
33
|
+
} else {
|
|
34
|
+
return res.status(401).send({ message: "Unauthorized: No token provided" });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const decoded = jwt.verify(token, process.env.SECRET_KEY);
|
|
38
|
+
req.userId = decoded._id;
|
|
39
|
+
req.user = {
|
|
40
|
+
_id: decoded._id
|
|
41
|
+
};
|
|
42
|
+
next();
|
|
43
|
+
} catch (err) {
|
|
44
|
+
req.userId = null;
|
|
45
|
+
if (continueOnFail) {
|
|
46
|
+
next();
|
|
47
|
+
} else {
|
|
48
|
+
res.status(401).send({ message: "Unauthorized: Invalid token" });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const checkRole = (roleToCheck) => async (req, res, next) => {
|
|
54
|
+
try {
|
|
55
|
+
const user = await User.findById(req.userId).exec();
|
|
56
|
+
if (!user) {
|
|
57
|
+
return res.status(404).send({ message: "User Not found." });
|
|
58
|
+
}
|
|
59
|
+
const roles = await Role.find({ _id: { $in: user.roles } }).exec();
|
|
60
|
+
for (let role of roles) {
|
|
61
|
+
if (role.name === roleToCheck) {
|
|
62
|
+
next();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
res.status(403).send({ message: `Require ${roleToCheck} Role!` });
|
|
67
|
+
} catch (err) {
|
|
68
|
+
res.status(500).send({ message: err.message });
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const isAdmin = checkRole("admin");
|
|
72
|
+
const isModerator = checkRole("moderator");
|
|
73
|
+
return {
|
|
74
|
+
verifyToken,
|
|
75
|
+
isAdmin,
|
|
76
|
+
isModerator
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
authJwt = middlewareFactory;
|
|
80
|
+
return authJwt;
|
|
81
|
+
}
|
|
82
|
+
exports.requireAuthJwt = requireAuthJwt;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import require$$0 from "jsonwebtoken";
|
|
2
|
+
var authJwt;
|
|
3
|
+
var hasRequiredAuthJwt;
|
|
4
|
+
function requireAuthJwt() {
|
|
5
|
+
if (hasRequiredAuthJwt) return authJwt;
|
|
6
|
+
hasRequiredAuthJwt = 1;
|
|
7
|
+
const jwt = require$$0;
|
|
8
|
+
const middlewareFactory = (db) => {
|
|
9
|
+
const User = db.user;
|
|
10
|
+
const Role = db.role;
|
|
11
|
+
const verifyToken = (continueOnFail = false) => {
|
|
12
|
+
return async (req, res, next) => {
|
|
13
|
+
try {
|
|
14
|
+
let token = req.headers["x-access-token"];
|
|
15
|
+
if (!token && req.cookies.user) {
|
|
16
|
+
let user = JSON.parse(req.cookies.user);
|
|
17
|
+
token = user.accessToken;
|
|
18
|
+
}
|
|
19
|
+
if (req.headers["x-service-key"]) {
|
|
20
|
+
const serviceKey = req.headers["x-service-key"];
|
|
21
|
+
const validServiceKey = process.env.SERVICE_KEY;
|
|
22
|
+
if (serviceKey !== validServiceKey) {
|
|
23
|
+
return res.status(403).send({ message: "Unauthorized: Invalid service key" });
|
|
24
|
+
}
|
|
25
|
+
req.isServiceRequest = true;
|
|
26
|
+
return next();
|
|
27
|
+
}
|
|
28
|
+
if (!token) {
|
|
29
|
+
req.userId = null;
|
|
30
|
+
if (continueOnFail) {
|
|
31
|
+
return next();
|
|
32
|
+
} else {
|
|
33
|
+
return res.status(401).send({ message: "Unauthorized: No token provided" });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const decoded = jwt.verify(token, process.env.SECRET_KEY);
|
|
37
|
+
req.userId = decoded._id;
|
|
38
|
+
req.user = {
|
|
39
|
+
_id: decoded._id
|
|
40
|
+
};
|
|
41
|
+
next();
|
|
42
|
+
} catch (err) {
|
|
43
|
+
req.userId = null;
|
|
44
|
+
if (continueOnFail) {
|
|
45
|
+
next();
|
|
46
|
+
} else {
|
|
47
|
+
res.status(401).send({ message: "Unauthorized: Invalid token" });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const checkRole = (roleToCheck) => async (req, res, next) => {
|
|
53
|
+
try {
|
|
54
|
+
const user = await User.findById(req.userId).exec();
|
|
55
|
+
if (!user) {
|
|
56
|
+
return res.status(404).send({ message: "User Not found." });
|
|
57
|
+
}
|
|
58
|
+
const roles = await Role.find({ _id: { $in: user.roles } }).exec();
|
|
59
|
+
for (let role of roles) {
|
|
60
|
+
if (role.name === roleToCheck) {
|
|
61
|
+
next();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
res.status(403).send({ message: `Require ${roleToCheck} Role!` });
|
|
66
|
+
} catch (err) {
|
|
67
|
+
res.status(500).send({ message: err.message });
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const isAdmin = checkRole("admin");
|
|
71
|
+
const isModerator = checkRole("moderator");
|
|
72
|
+
return {
|
|
73
|
+
verifyToken,
|
|
74
|
+
isAdmin,
|
|
75
|
+
isModerator
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
authJwt = middlewareFactory;
|
|
79
|
+
return authJwt;
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
requireAuthJwt as r
|
|
83
|
+
};
|
package/dist/builder.js
CHANGED
|
@@ -1037,7 +1037,7 @@ function requireRspack_config_base() {
|
|
|
1037
1037
|
plugins: [
|
|
1038
1038
|
...process.env.BUNDLE_ANALYZER ? [new RsdoctorRspackPlugin(), new BundleAnalyzerPlugin()] : [],
|
|
1039
1039
|
new VueLoaderPlugin(),
|
|
1040
|
-
...process.env.
|
|
1040
|
+
...process.env.NODE_ENV === "production" ? [new rspack2.CssExtractRspackPlugin({
|
|
1041
1041
|
filename: "[name].[contenthash].css",
|
|
1042
1042
|
chunkFilename: "[id].[contenthash].css",
|
|
1043
1043
|
ignoreOrder: true
|
|
@@ -1131,14 +1131,17 @@ function requireRspack_config_client() {
|
|
|
1131
1131
|
safelist: {
|
|
1132
1132
|
standard: ["safelisted", /^html/, /^:root/],
|
|
1133
1133
|
deep: [/^safelisted-deep-/, /^html/, /^:root/],
|
|
1134
|
-
greedy: [
|
|
1134
|
+
greedy: [/^data-v-/, /\[data-v-.*\]/, /\[data-v-[a-zA-Z0-9]*\]/]
|
|
1135
1135
|
},
|
|
1136
|
+
rejected: true,
|
|
1136
1137
|
extractors: [
|
|
1137
1138
|
{
|
|
1138
1139
|
extractor: (content) => {
|
|
1139
|
-
|
|
1140
|
+
const normalClasses = content.match(/[A-Za-z0-9-_:\/]+/g) || [];
|
|
1141
|
+
const scopedAttrs = content.match(/\[data-v-[a-zA-Z0-9]*\]/g) || [];
|
|
1142
|
+
return [...normalClasses, ...scopedAttrs];
|
|
1140
1143
|
},
|
|
1141
|
-
extensions: ["vue"]
|
|
1144
|
+
extensions: ["vue", "js", "css", "scss"]
|
|
1142
1145
|
}
|
|
1143
1146
|
]
|
|
1144
1147
|
})
|
package/dist/builder.mjs
CHANGED
|
@@ -1014,7 +1014,7 @@ function requireRspack_config_base() {
|
|
|
1014
1014
|
plugins: [
|
|
1015
1015
|
...process.env.BUNDLE_ANALYZER ? [new RsdoctorRspackPlugin(), new BundleAnalyzerPlugin()] : [],
|
|
1016
1016
|
new VueLoaderPlugin(),
|
|
1017
|
-
...process.env.
|
|
1017
|
+
...process.env.NODE_ENV === "production" ? [new rspack2.CssExtractRspackPlugin({
|
|
1018
1018
|
filename: "[name].[contenthash].css",
|
|
1019
1019
|
chunkFilename: "[id].[contenthash].css",
|
|
1020
1020
|
ignoreOrder: true
|
|
@@ -1108,14 +1108,17 @@ function requireRspack_config_client() {
|
|
|
1108
1108
|
safelist: {
|
|
1109
1109
|
standard: ["safelisted", /^html/, /^:root/],
|
|
1110
1110
|
deep: [/^safelisted-deep-/, /^html/, /^:root/],
|
|
1111
|
-
greedy: [
|
|
1111
|
+
greedy: [/^data-v-/, /\[data-v-.*\]/, /\[data-v-[a-zA-Z0-9]*\]/]
|
|
1112
1112
|
},
|
|
1113
|
+
rejected: true,
|
|
1113
1114
|
extractors: [
|
|
1114
1115
|
{
|
|
1115
1116
|
extractor: (content) => {
|
|
1116
|
-
|
|
1117
|
+
const normalClasses = content.match(/[A-Za-z0-9-_:\/]+/g) || [];
|
|
1118
|
+
const scopedAttrs = content.match(/\[data-v-[a-zA-Z0-9]*\]/g) || [];
|
|
1119
|
+
return [...normalClasses, ...scopedAttrs];
|
|
1117
1120
|
},
|
|
1118
|
-
extensions: ["vue"]
|
|
1121
|
+
extensions: ["vue", "js", "css", "scss"]
|
|
1119
1122
|
}
|
|
1120
1123
|
]
|
|
1121
1124
|
})
|
package/dist/chats.server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const mailing = require("./mailing-D4kWlk3_.js");
|
|
4
|
-
const index = require("./index-
|
|
4
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
5
5
|
var chats_controller;
|
|
6
6
|
var hasRequiredChats_controller;
|
|
7
7
|
function requireChats_controller() {
|
package/dist/chats.server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import { r as requireMailing } from "./mailing-DvCT5ijo.mjs";
|
|
3
|
-
import { r as requireMiddlewares } from "./index-
|
|
3
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
4
4
|
var chats_controller;
|
|
5
5
|
var hasRequiredChats_controller;
|
|
6
6
|
function requireChats_controller() {
|
package/dist/community.server.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const require$$0 = require("mongoose");
|
|
4
|
-
const queryProcessor$2 = require("./queryProcessor-
|
|
4
|
+
const queryProcessor$2 = require("./queryProcessor-DSUqSk3I.js");
|
|
5
5
|
require("util");
|
|
6
6
|
const require$$0$1 = require("uuid");
|
|
7
|
-
const index = require("./index-
|
|
8
|
-
const globals_abac = require("./globals.abac-
|
|
7
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
8
|
+
const globals_abac = require("./globals.abac-Bn-4tbX8.js");
|
|
9
9
|
const common_schema = require("./common.schema-O0w_rDyC.js");
|
|
10
10
|
const engagement_schema = require("./engagement.schema-DAiXsvh1.js");
|
|
11
|
-
const ownership_schema = require("./ownership.schema-
|
|
11
|
+
const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
|
|
12
12
|
const metadata_schema = require("./metadata.schema-CUkLXZ2f.js");
|
|
13
13
|
var queryProcessor$1;
|
|
14
14
|
var hasRequiredQueryProcessor$1;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import require$$0 from "mongoose";
|
|
3
|
-
import { r as requireQueryProcessor$2 } from "./queryProcessor-
|
|
3
|
+
import { r as requireQueryProcessor$2 } from "./queryProcessor-CVKI651_.mjs";
|
|
4
4
|
import "util";
|
|
5
5
|
import require$$0$1 from "uuid";
|
|
6
|
-
import { r as requireMiddlewares } from "./index-
|
|
7
|
-
import { r as requireGlobals_abac } from "./globals.abac-
|
|
6
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
7
|
+
import { r as requireGlobals_abac } from "./globals.abac-DZpTRxKR.mjs";
|
|
8
8
|
import { r as requireCommon_schema } from "./common.schema-C2m3O1XY.mjs";
|
|
9
9
|
import { r as requireEngagement_schema } from "./engagement.schema-DnDD7Bn3.mjs";
|
|
10
|
-
import { r as requireOwnership_schema } from "./ownership.schema-
|
|
10
|
+
import { r as requireOwnership_schema } from "./ownership.schema-CNCotD3D.mjs";
|
|
11
11
|
import { r as requireMetadata_schema } from "./metadata.schema--tle-GU8.mjs";
|
|
12
12
|
var queryProcessor$1;
|
|
13
13
|
var hasRequiredQueryProcessor$1;
|
package/dist/events.server.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const require$$0 = require("mongoose");
|
|
4
|
-
const queryProcessor$1 = require("./queryProcessor-
|
|
4
|
+
const queryProcessor$1 = require("./queryProcessor-DSUqSk3I.js");
|
|
5
5
|
const metadata_schema = require("./metadata.schema-CUkLXZ2f.js");
|
|
6
6
|
const require$$0$1 = require("stripe");
|
|
7
7
|
const tickets_controller = require("./tickets.controller-zEHIAe_B.js");
|
|
8
|
-
const index = require("./index-
|
|
9
|
-
const globals_abac = require("./globals.abac-
|
|
8
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
9
|
+
const globals_abac = require("./globals.abac-Bn-4tbX8.js");
|
|
10
10
|
const common_schema = require("./common.schema-O0w_rDyC.js");
|
|
11
11
|
const engagement_schema = require("./engagement.schema-DAiXsvh1.js");
|
|
12
|
-
const ownership_schema = require("./ownership.schema-
|
|
12
|
+
const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
|
|
13
13
|
var queryProcessor;
|
|
14
14
|
var hasRequiredQueryProcessor;
|
|
15
15
|
function requireQueryProcessor() {
|
package/dist/events.server.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import require$$0 from "mongoose";
|
|
3
|
-
import { r as requireQueryProcessor$1 } from "./queryProcessor-
|
|
3
|
+
import { r as requireQueryProcessor$1 } from "./queryProcessor-CVKI651_.mjs";
|
|
4
4
|
import { a as requireSeoFriendlyUrl, r as requireMetadata_schema } from "./metadata.schema--tle-GU8.mjs";
|
|
5
5
|
import require$$0$1 from "stripe";
|
|
6
6
|
import { r as requireTickets_controller } from "./tickets.controller-BIhfgjNb.mjs";
|
|
7
|
-
import { r as requireMiddlewares } from "./index-
|
|
8
|
-
import { r as requireGlobals_abac } from "./globals.abac-
|
|
7
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
8
|
+
import { r as requireGlobals_abac } from "./globals.abac-DZpTRxKR.mjs";
|
|
9
9
|
import { r as requireCommon_schema } from "./common.schema-C2m3O1XY.mjs";
|
|
10
10
|
import { r as requireEngagement_schema } from "./engagement.schema-DnDD7Bn3.mjs";
|
|
11
|
-
import { r as requireOwnership_schema } from "./ownership.schema-
|
|
11
|
+
import { r as requireOwnership_schema } from "./ownership.schema-CNCotD3D.mjs";
|
|
12
12
|
var queryProcessor;
|
|
13
13
|
var hasRequiredQueryProcessor;
|
|
14
14
|
function requireQueryProcessor() {
|
package/dist/files.server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const require$$0 = require("path");
|
|
4
|
-
const index = require("./index-
|
|
4
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
5
5
|
const require$$0$1 = require("sharp");
|
|
6
6
|
const require$$1 = require("fs");
|
|
7
7
|
const require$$2 = require("fs/promises");
|
package/dist/files.server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import require$$0 from "path";
|
|
3
|
-
import { r as requireMiddlewares } from "./index-
|
|
3
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
4
4
|
import require$$0$1 from "sharp";
|
|
5
5
|
import require$$1 from "fs";
|
|
6
6
|
import require$$2 from "fs/promises";
|
package/dist/gallery.server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const require$$0 = require("path");
|
|
4
|
-
const queryProcessor = require("./queryProcessor-
|
|
5
|
-
const index = require("./index-
|
|
4
|
+
const queryProcessor = require("./queryProcessor-DSUqSk3I.js");
|
|
5
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
6
6
|
const common_schema = require("./common.schema-O0w_rDyC.js");
|
|
7
7
|
const engagement_schema = require("./engagement.schema-DAiXsvh1.js");
|
|
8
|
-
const ownership_schema = require("./ownership.schema-
|
|
8
|
+
const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
|
|
9
9
|
var gallery_controller;
|
|
10
10
|
var hasRequiredGallery_controller;
|
|
11
11
|
function requireGallery_controller() {
|
package/dist/gallery.server.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import require$$0 from "path";
|
|
3
|
-
import { r as requireQueryProcessor } from "./queryProcessor-
|
|
4
|
-
import { r as requireMiddlewares } from "./index-
|
|
3
|
+
import { r as requireQueryProcessor } from "./queryProcessor-CVKI651_.mjs";
|
|
4
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
5
5
|
import { r as requireCommon_schema } from "./common.schema-C2m3O1XY.mjs";
|
|
6
6
|
import { r as requireEngagement_schema } from "./engagement.schema-DnDD7Bn3.mjs";
|
|
7
|
-
import { r as requireOwnership_schema } from "./ownership.schema-
|
|
7
|
+
import { r as requireOwnership_schema } from "./ownership.schema-CNCotD3D.mjs";
|
|
8
8
|
var gallery_controller;
|
|
9
9
|
var hasRequiredGallery_controller;
|
|
10
10
|
function requireGallery_controller() {
|
|
@@ -57,8 +57,34 @@ function requireGlobals_abac() {
|
|
|
57
57
|
}
|
|
58
58
|
return model;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Нормализация результата политики для единообразной обработки
|
|
62
|
+
* @param {any} result - Результат выполнения политики
|
|
63
|
+
* @param {string} policyName - Имя политики для формирования причины
|
|
64
|
+
* @returns {Object} Нормализованный результат
|
|
65
|
+
*/
|
|
66
|
+
_normalizeResult(result, policyName) {
|
|
67
|
+
if (result && typeof result === "object" && ("allow" in result || "force" in result)) {
|
|
68
|
+
return {
|
|
69
|
+
allow: !!result.allow,
|
|
70
|
+
force: !!result.force,
|
|
71
|
+
reason: result.reason || `POLICY_${policyName.toUpperCase()}`
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (result === true) {
|
|
75
|
+
return { allow: true, force: false, reason: `ALLOWED_BY_${policyName.toUpperCase()}` };
|
|
76
|
+
}
|
|
77
|
+
if (result === false) {
|
|
78
|
+
return { allow: false, force: false, reason: `DENIED_BY_${policyName.toUpperCase()}` };
|
|
79
|
+
}
|
|
80
|
+
if (result === void 0 && policyName === "AdminModeratorAccessPolicy" && (this._context && this._context.adminAccessGranted)) {
|
|
81
|
+
return { allow: true, force: true, reason: "ADMIN_MODERATOR_ACCESS_GRANTED" };
|
|
82
|
+
}
|
|
83
|
+
return { allow: true, force: false, reason: `NEUTRAL_${policyName.toUpperCase()}` };
|
|
84
|
+
}
|
|
60
85
|
// Базовый метод проверки доступа
|
|
61
86
|
async checkAccess(context) {
|
|
87
|
+
this._context = context;
|
|
62
88
|
const {
|
|
63
89
|
user,
|
|
64
90
|
// Пользователь
|
|
@@ -110,27 +136,95 @@ function requireGlobals_abac() {
|
|
|
110
136
|
};
|
|
111
137
|
}
|
|
112
138
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
139
|
+
const policyEntries = Object.entries(this.policies.global);
|
|
140
|
+
const policyPromises = policyEntries.map(async ([policyName, policyFn]) => {
|
|
141
|
+
try {
|
|
142
|
+
const result = await policyFn(context);
|
|
143
|
+
return { policyName, result };
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.error(`Error in policy ${policyName}:`, error);
|
|
146
|
+
return { policyName, result: void 0, error };
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const policyResults = await Promise.all(policyPromises);
|
|
150
|
+
let hasForceAllow = false;
|
|
151
|
+
let hasForceDisallow = false;
|
|
152
|
+
let hasDeny = false;
|
|
153
|
+
let denyReason = "";
|
|
154
|
+
let allowReason = "";
|
|
155
|
+
for (const { policyName, result, error } of policyResults) {
|
|
156
|
+
if (error) continue;
|
|
157
|
+
const normalizedResult = this._normalizeResult(result, policyName);
|
|
158
|
+
if (normalizedResult.force) {
|
|
159
|
+
if (normalizedResult.allow) {
|
|
160
|
+
hasForceAllow = true;
|
|
161
|
+
allowReason = normalizedResult.reason;
|
|
162
|
+
} else {
|
|
163
|
+
hasForceDisallow = true;
|
|
164
|
+
denyReason = normalizedResult.reason;
|
|
165
|
+
}
|
|
166
|
+
} else if (!normalizedResult.allow) {
|
|
167
|
+
hasDeny = true;
|
|
168
|
+
if (!denyReason) denyReason = normalizedResult.reason;
|
|
120
169
|
}
|
|
121
170
|
}
|
|
171
|
+
if (hasForceDisallow) {
|
|
172
|
+
return {
|
|
173
|
+
allowed: false,
|
|
174
|
+
reason: denyReason || "FORCE_DENIED_BY_POLICY"
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (hasForceAllow) {
|
|
178
|
+
return {
|
|
179
|
+
allowed: true,
|
|
180
|
+
reason: allowReason || "FORCE_ALLOWED_BY_POLICY"
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (hasDeny) {
|
|
184
|
+
return {
|
|
185
|
+
allowed: false,
|
|
186
|
+
reason: denyReason || "DENIED_BY_POLICY"
|
|
187
|
+
};
|
|
188
|
+
}
|
|
122
189
|
if (this.policies.resources[resource]) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
190
|
+
try {
|
|
191
|
+
const resourceResult = await this.policies.resources[resource](context);
|
|
192
|
+
const normalizedResult = this._normalizeResult(resourceResult, `RESOURCE_${resource}`);
|
|
193
|
+
if (normalizedResult.force) {
|
|
194
|
+
return {
|
|
195
|
+
allowed: normalizedResult.allow,
|
|
196
|
+
reason: normalizedResult.reason
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (!normalizedResult.allow) {
|
|
200
|
+
return {
|
|
201
|
+
allowed: false,
|
|
202
|
+
reason: normalizedResult.reason
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (normalizedResult.allow) {
|
|
206
|
+
return {
|
|
207
|
+
allowed: true,
|
|
208
|
+
reason: normalizedResult.reason
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.error(`Error in resource policy for ${resource}:`, error);
|
|
129
213
|
}
|
|
130
214
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
215
|
+
const extensionPromises = Object.entries(this.policies.extensions).map(async ([moduleName, extensionFn]) => {
|
|
216
|
+
try {
|
|
217
|
+
const extensionResult = await extensionFn(context);
|
|
218
|
+
return { moduleName, result: extensionResult };
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.error(`Error in extension ${moduleName}:`, error);
|
|
221
|
+
return { moduleName, result: null, error };
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
const extensionResults = await Promise.all(extensionPromises);
|
|
225
|
+
for (const { moduleName, result, error } of extensionResults) {
|
|
226
|
+
if (error) continue;
|
|
227
|
+
if (result && result.allowed) {
|
|
134
228
|
return {
|
|
135
229
|
allowed: true,
|
|
136
230
|
reason: `ALLOWED_BY_${moduleName.toUpperCase()}_EXTENSION`
|