webfast 0.1.84 → 0.1.85
Sign up to get free protection for your applications and to get access to all the features.
- package/app/content/js/webfast.js +12 -0
- package/modules/data/mongo/find.js +57 -55
- package/modules/express/init.js +1 -1
- package/package.json +6 -3
@@ -97,6 +97,18 @@ web.fast = {
|
|
97
97
|
list : function(data) {
|
98
98
|
console.log(`Processing List`);
|
99
99
|
}
|
100
|
+
},
|
101
|
+
telegram : function(action){
|
102
|
+
try {
|
103
|
+
const telegram = window.Telegram;
|
104
|
+
const actionFunction = telegram[action];
|
105
|
+
console.log(`TELEGRAM`,action);
|
106
|
+
return actionFunction;
|
107
|
+
} catch (err) {
|
108
|
+
//console.error(Err);
|
109
|
+
console.error(`NO TELEGRAM`,action);
|
110
|
+
return false;
|
111
|
+
}
|
100
112
|
}
|
101
113
|
}
|
102
114
|
// Connect to the Socket.IO server
|
@@ -67,65 +67,67 @@ module.exports = async function(db,collection,query,one = false,array) {
|
|
67
67
|
}
|
68
68
|
|
69
69
|
// Check if profile image to get it from db
|
70
|
-
if (result
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
70
|
+
if (result != undefined) {
|
71
|
+
if (result.profileImage != undefined && array.image == true) {
|
72
|
+
const profileImage = await program.modules.data.file.downloadBuffer(result.profileImage,process.env.dbName);
|
73
|
+
|
74
|
+
// Set in dynamic routing for serving
|
75
|
+
let sizeMeta = {};
|
76
|
+
let other = {}
|
77
|
+
for (let pi in profileImage) {
|
78
|
+
// Profile image
|
79
|
+
const theImage = profileImage[pi];
|
80
|
+
|
81
|
+
// Get the meta
|
82
|
+
const imageMeta = theImage.metadata;
|
83
|
+
|
84
|
+
// Sizes
|
85
|
+
const size = imageMeta.size;
|
86
|
+
|
87
|
+
const sizeKey = `${size.width}x${size.height}`;
|
88
|
+
const setUUID = program.uuid.v4();
|
89
|
+
sizeMeta[setUUID] = {
|
90
|
+
buffer : theImage.buffer,
|
91
|
+
meta : imageMeta
|
92
|
+
}
|
93
|
+
console.log(`The Size Meta`);
|
91
94
|
}
|
92
|
-
console.log(`The Size Meta`);
|
93
|
-
}
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
96
|
+
// Now we have sizes thingy so create a route for this specific uuid
|
97
|
+
const dynamicLink = `/dynamic/${result.profileImage}/list`;
|
98
|
+
result.imageList = `${process.env.url}${dynamicLink.slice(1)}`;
|
99
|
+
result.images = sizeMeta;
|
100
|
+
|
101
|
+
const routeCheck = await routeExists(dynamicLink);
|
102
|
+
if (!routeCheck) {
|
103
|
+
program.express.app.get(dynamicLink, async (req, res) => {
|
104
|
+
// Requesting image
|
105
|
+
console.log(`Requesting dynamic link`);
|
106
|
+
// Send buffer image as image
|
107
|
+
// Set content type header to indicate that you're sending an image
|
108
|
+
res.setHeader('Content-Type', 'application/json');
|
109
|
+
|
110
|
+
// Send the image buffer as the response body
|
111
|
+
for (let sizeKey in sizeMeta) {
|
112
|
+
const item = sizeMeta[sizeKey];
|
113
|
+
other[sizeKey] = item.meta;
|
114
|
+
|
115
|
+
// Create dynamic url for this on
|
116
|
+
const imageDynamicPath = `/dynamic/${sizeKey}.${item.meta.type}`;
|
117
|
+
const imageLinkURL = `https://${process.env.url}${imageDynamicPath.slice(1)}`
|
118
|
+
//other[sizeKey].link = imageLinkURL;
|
119
|
+
|
120
|
+
// generate dynamic url
|
121
|
+
|
122
|
+
}
|
120
123
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
}
|
126
|
-
console.log(`Profile Image`);
|
124
|
+
res.send(JSON.stringify(other, null, 2));
|
125
|
+
});
|
126
|
+
}
|
127
|
+
console.log(`Profile Image`);
|
127
128
|
|
128
|
-
|
129
|
+
// generate paths
|
130
|
+
}
|
129
131
|
}
|
130
132
|
|
131
133
|
if (callback != undefined) {
|
package/modules/express/init.js
CHANGED
@@ -392,7 +392,7 @@ module.exports = async function (program) {
|
|
392
392
|
// Check if function is running in program modules that you can add in the init scirpt when using remote
|
393
393
|
if (program.express.process != undefined) {
|
394
394
|
try {
|
395
|
-
let resp = await program.express.process[split[0]][split[1]][split[2]](program,ws,json,data,path,clientId);
|
395
|
+
let resp = await program.express.process[split[0]][split[1]][split[2]](program,ws,json,data,path,clientId,ws);
|
396
396
|
if (resp != false) {
|
397
397
|
ws.send(JSON.stringify(resp));
|
398
398
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webfast",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.85",
|
4
4
|
"description": "WebFast! Bot Application, including TON mini-apps for makign it easy and fast to build ini-apps",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": {
|
@@ -25,14 +25,17 @@
|
|
25
25
|
"generator",
|
26
26
|
"mini-app",
|
27
27
|
"express",
|
28
|
-
"
|
28
|
+
"bot",
|
29
29
|
"famework",
|
30
30
|
"ejs",
|
31
31
|
"javascript",
|
32
32
|
"jquery",
|
33
33
|
"webfast",
|
34
34
|
"dynamic",
|
35
|
-
"model"
|
35
|
+
"model",
|
36
|
+
"mini app",
|
37
|
+
"webflow",
|
38
|
+
"lowcode"
|
36
39
|
],
|
37
40
|
"author": "Kai Gartner",
|
38
41
|
"license": "ISC",
|