Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/fonts/iran-yekan/MobileFonts/wgdpf7/user-playback.tar
Назад
config/routes.json 0000644 00000003304 15104277564 0010240 0 ustar 00 { "routes": [ { "method": "GET", "path": "/user-playbacks", "handler": "user-playback.find", "config": { "policies": [] } }, { "method": "GET", "path": "/user-playbacks/count", "handler": "user-playback.count", "config": { "policies": [] } }, { "method": "GET", "path": "/user-playbacks/:id", "handler": "user-playback.findOne", "config": { "policies": [] } }, { "method": "GET", "path": "/user-playbacks/getRecentPlaybacks/:id", "handler": "user-playback.getRecentPlaybacks", "config": { "policies": [] } }, { "method": "POST", "path": "/user-playbacks/refreshPlayback", "handler": "user-playback.refreshPlayback", "config": { "policies": [] } }, { "method": "POST", "path": "/user-playbacks/stopPlayback", "handler": "user-playback.stopPlayback", "config": { "policies": [] } }, { "method": "POST", "path": "/user-playbacks/validatePlay", "handler": "user-playback.validatePlay", "config": { "policies": [] } }, { "method": "POST", "path": "/user-playbacks", "handler": "user-playback.create", "config": { "policies": [] } }, { "method": "PUT", "path": "/user-playbacks/:id", "handler": "user-playback.update", "config": { "policies": [] } }, { "method": "DELETE", "path": "/user-playbacks/:id", "handler": "user-playback.delete", "config": { "policies": [] } } ] } controllers/user-playback.js 0000644 00000007437 15104277564 0012240 0 ustar 00 'use strict'; const requestIp = require('request-ip'); const {sanitizeEntity} = require('strapi-utils'); /** * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers) * to customize this controller */ module.exports = { async stopPlayback(ctx) { const {user} = ctx.state; const {id1, id2, desc} = ctx.request.body; let playbackInfo = await strapi.services["user-playback"].findOne({ id: id1 }); if (playbackInfo) { const entity = await strapi.services["user-playback"].update({ id: id1 }, { desc, isExpired: true }); } playbackInfo = await strapi.services["user-playback"].findOne({ id: id2 }); if (playbackInfo) { const entity = await strapi.services["user-playback"].update({ id: id2 }, { desc, isExpired: true }); } return ctx.send(true); }, async getRecentPlaybacks(ctx) { const {query} = ctx; const {id} = ctx.params; query["user_eq"] = id; query["_sort"] = "createdAt:desc"; let entities; if (query._q) { entities = await strapi.services["user-playback"].search(query, [ { path: "session", populate: { path: "course_level" } } ]); } else { entities = await strapi.services["user-playback"].find(query, [ { path: "session", populate: { path: "course_level" } } ]); } return entities.map(x => ({ip: x.ip, createdAt: x.createdAt, title: x.session.course_level.title})); }, async refreshPlayback(ctx) { const {user} = ctx.state; let {meetingId, desc, code, id, isAdobe} = ctx.request.body; code = code ? Number(code) : 0; let result = {id1: null, code1: null, id2: null, code2: null}; let entity = null; const ip = requestIp.getClientIp(ctx.request.req); if (desc === "before accept law") { const session = await strapi.services.helpers.verifyUserAccessToMeeting(meetingId, user); if (session.result === false) { return ctx.badRequest(null, session.entity); } code = strapi.services.helpers.makeRandomNumber(1000, 9999); entity = await strapi.services["user-playback"].create({ ip, code, user: user.id, session: session.entity.id, desc }); result.id1 = entity.id; result.code1 = code; if (!isAdobe) { code = strapi.services.helpers.makeRandomNumber(1000, 9999); entity = await strapi.services["user-playback"].create({ ip, code, user: user.id, session: session.entity.id, desc, }); result.id2 = entity.id; result.code2 = code; } } else { const isExist = await strapi.services["user-playback"].findOne({id}); if (!isExist || isExist.isExpired) { return ctx.badRequest(null, "session.errors.invalidPlayback"); } console.log("refresh desc is ...", desc); entity = await strapi.services["user-playback"].update({ id }, { ip, desc, code, isExpired: false, }); result.id1 = entity.id; result.code1 = code; } return ctx.send(result); }, async validatePlay(ctx) { const {user} = ctx.state; let {code, id, ip, initCode} = ctx.request.body; const result = await strapi.services["user-playback"] .validatePlay(user, ip, id, code, initCode); if (result.result) { return ctx.send(true); } else { return ctx.badRequest(null, result.entity); } } }; documentation/1.0.0/user-playback.json 0000644 00000061725 15104277564 0013534 0 ustar 00 { "paths": { "/user-playbacks": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "parameters": [ { "name": "_limit", "in": "query", "required": false, "description": "Maximum number of results possible", "schema": { "type": "integer" }, "deprecated": false }, { "name": "_sort", "in": "query", "required": false, "description": "Sort according to a specific field.", "schema": { "type": "string" }, "deprecated": false }, { "name": "_start", "in": "query", "required": false, "description": "Skip a specific number of entries (especially useful for pagination)", "schema": { "type": "integer" }, "deprecated": false }, { "name": "=", "in": "query", "required": false, "description": "Get entries that matches exactly your input", "schema": { "type": "string" }, "deprecated": false }, { "name": "_ne", "in": "query", "required": false, "description": "Get records that are not equals to something", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lt", "in": "query", "required": false, "description": "Get record that are lower than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lte", "in": "query", "required": false, "description": "Get records that are lower than or equal to a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gt", "in": "query", "required": false, "description": "Get records that are greater than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gte", "in": "query", "required": false, "description": "Get records that are greater than or equal a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_contains", "in": "query", "required": false, "description": "Get records that contains a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_containss", "in": "query", "required": false, "description": "Get records that contains (case sensitive) a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_in", "in": "query", "required": false, "description": "Get records that matches any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false }, { "name": "_nin", "in": "query", "required": false, "description": "Get records that doesn't match any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false } ] }, "post": { "deprecated": false, "description": "Create a new record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUser-playback" } } } } } }, "/user-playbacks/count": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "parameters": [] } }, "/user-playbacks/{id}": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] }, "put": { "deprecated": false, "description": "Update a record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUser-playback" } } } }, "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] }, "delete": { "deprecated": false, "description": "Delete a record", "responses": { "200": { "description": "deletes a single record based on the ID supplied", "content": { "application/json": { "schema": { "type": "integer", "format": "int64" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } }, "/user-playbacks/getRecentPlaybacks/{id}": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } }, "/user-playbacks/refreshPlayback": { "post": { "deprecated": false, "description": "Create a new record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } }, "/user-playbacks/stopPlayback": { "post": { "deprecated": false, "description": "Create a new record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } }, "/user-playbacks/validatePlay": { "post": { "deprecated": false, "description": "Create a new record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "User-playback" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } } }, "components": { "schemas": { "User-playback": { "required": [ "id", "ip", "code" ], "properties": { "id": { "type": "string" }, "desc": { "type": "string" }, "ip": { "type": "string" }, "user": { "required": [ "id", "username", "email", "name", "phoneNo" ], "properties": { "id": { "type": "string" }, "username": { "type": "string" }, "email": { "type": "string" }, "provider": { "type": "string" }, "password": { "type": "string" }, "resetPasswordToken": { "type": "string" }, "confirmed": { "type": "boolean" }, "blocked": { "type": "boolean" }, "role": { "type": "string" }, "name": { "type": "string" }, "family": { "type": "string" }, "phoneNo": { "type": "integer" }, "avatarImage": { "type": "string" }, "nationalCode": { "type": "string" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } }, "isExpired": { "type": "boolean" }, "code": { "type": "integer" }, "session": { "required": [ "id", "title" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "desc": { "type": "string" }, "link": { "type": "string" }, "isLive": { "type": "boolean" }, "session_resources": { "type": "array", "items": { "type": "string" } }, "course_level": { "type": "string" }, "isPublished": { "type": "boolean" }, "disallow_users": { "type": "array", "items": { "type": "string" } }, "isAdobe": { "type": "boolean" }, "checkLicense": { "type": "boolean" }, "internalMeetingID": { "type": "string" }, "logoutURL": { "type": "string" }, "record": { "type": "boolean" }, "sequence": { "type": "integer" }, "copyright": { "type": "string" }, "test": { "type": "string" }, "disallowRecording": { "type": "boolean" }, "offlineLink": { "type": "string" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } }, "confirmCodes": { "type": "object" }, "published_at": { "type": "string", "format": "date-time" } } }, "NewUser-playback": { "required": [ "ip", "code" ], "properties": { "desc": { "type": "string" }, "ip": { "type": "string" }, "user": { "type": "string" }, "isExpired": { "type": "boolean" }, "code": { "type": "integer" }, "session": { "type": "string" }, "confirmCodes": { "type": "object" }, "published_at": { "type": "string", "format": "date-time" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } } }, "tags": [] } models/user-playback.js 0000644 00000000321 15104277564 0011136 0 ustar 00 'use strict'; /** * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks) * to customize this model */ module.exports = {}; models/user-playback.settings.json 0000644 00000001226 15104277564 0013337 0 ustar 00 { "kind": "collectionType", "collectionName": "user_playbacks", "info": { "name": "userPlayback", "description": "" }, "options": { "increments": true, "timestamps": true, "draftAndPublish": true }, "attributes": { "desc": { "type": "string" }, "ip": { "type": "string", "required": true }, "user": { "plugin": "users-permissions", "model": "user" }, "isExpired": { "type": "boolean" }, "code": { "type": "integer", "required": true }, "session": { "model": "session" }, "confirmCodes": { "type": "json" } } } services/user-playback.js 0000644 00000003732 15104277564 0011507 0 ustar 00 'use strict'; /** * Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services) * to customize this service */ module.exports = { async validatePlay(user, ip, id, code, initCode) { let pInfo = await strapi.services["user-playback"].findOne({ id }); if (pInfo.desc.startsWith("error")) { console.log("is error ...", user.id); const entity = await strapi.services["user-playback"].update({ id }, { desc: 'is play..', }); return {result: true, entity}; } if (!pInfo) { return {result: false, entity: "invalidPlaybackId"}; } if (pInfo.isExpired) { return {result: false, entity: "playbackIsExpired"}; } // if (pInfo.ip !== ip) { // return {result: false, entity: "session.errors.invalidIpForValidate"}; // } if (!pInfo.confirmCodes) { pInfo.confirmCodes = []; } let exist = pInfo.confirmCodes.includes(code); if (exist) { const after2Sec = strapi.services.helpers.addSecond(pInfo.updatedAt.toString(), 0.5); const isBetween = strapi.services.helpers.isNowBetweenDates(pInfo.updatedAt, after2Sec); if (!isBetween) { return {result: false, entity: "session.errors.invalidCodeForValidate"}; } // //exist = pInfo.confirmCodes.includes(code); // if (exist) { // // } else { // pInfo.confirmCodes.push(code); // const entity = await strapi.services["user-playback"].update({ // id // }, { // code: initCode, // confirmCodes: pInfo.confirmCodes, // desc: 'is play..', // }); // return {result: true, entity}; // } } pInfo.confirmCodes.push(code); const entity = await strapi.services["user-playback"].update({ id }, { code, confirmCodes: pInfo.confirmCodes, desc: 'is play..', }); return {result: true, entity}; } };
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.02 |
proxy
|
phpinfo
|
Настройка