webfast 0.1.84 → 0.1.85

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.
@@ -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.profileImage != undefined && array.image == true) {
71
- const profileImage = await program.modules.data.file.downloadBuffer(result.profileImage,process.env.dbName);
72
-
73
- // Set in dynamic routing for serving
74
- let sizeMeta = {};
75
- let other = {}
76
- for (let pi in profileImage) {
77
- // Profile image
78
- const theImage = profileImage[pi];
79
-
80
- // Get the meta
81
- const imageMeta = theImage.metadata;
82
-
83
- // Sizes
84
- const size = imageMeta.size;
85
-
86
- const sizeKey = `${size.width}x${size.height}`;
87
- const setUUID = program.uuid.v4();
88
- sizeMeta[setUUID] = {
89
- buffer : theImage.buffer,
90
- meta : imageMeta
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
- // Now we have sizes thingy so create a route for this specific uuid
96
- const dynamicLink = `/dynamic/${result.profileImage}/list`;
97
- result.imageList = `${process.env.url}${dynamicLink.slice(1)}`;
98
- result.images = sizeMeta;
99
-
100
- const routeCheck = await routeExists(dynamicLink);
101
- if (!routeCheck) {
102
- program.express.app.get(dynamicLink, async (req, res) => {
103
- // Requesting image
104
- console.log(`Requesting dynamic link`);
105
- // Send buffer image as image
106
- // Set content type header to indicate that you're sending an image
107
- res.setHeader('Content-Type', 'application/json');
108
-
109
- // Send the image buffer as the response body
110
- for (let sizeKey in sizeMeta) {
111
- const item = sizeMeta[sizeKey];
112
- other[sizeKey] = item.meta;
113
-
114
- // Create dynamic url for this on
115
- const imageDynamicPath = `/dynamic/${sizeKey}.${item.meta.type}`;
116
- const imageLinkURL = `https://${process.env.url}${imageDynamicPath.slice(1)}`
117
- //other[sizeKey].link = imageLinkURL;
118
-
119
- // generate dynamic url
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
- res.send(JSON.stringify(other, null, 2));
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
- // generate paths
129
+ // generate paths
130
+ }
129
131
  }
130
132
 
131
133
  if (callback != undefined) {
@@ -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.84",
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
- "bots",
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",