webfast 0.1.84 → 0.1.86
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/README.md +13 -0
- package/app/content/js/webfast.js +65 -0
- package/modules/data/mongo/find.js +57 -55
- package/modules/express/init.js +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
@@ -130,6 +130,19 @@ program.modules.dependOn({REQUIRE},program,`{UNIQUE_NAME}-sync`,function(){
|
|
130
130
|
console.log(`Depend On CallBack`);
|
131
131
|
});
|
132
132
|
```
|
133
|
+
## NEW BETA FEATURE
|
134
|
+
Feature where youo can add a special frame for multiple views through telegram without reloading
|
135
|
+
````
|
136
|
+
await web.fast.telegram(`frame`).set(id,`https://${window.location.hostname}/concepts/esimco/package#${id}`,async function(id){
|
137
|
+
console.log(`Clicked Close`,id);
|
138
|
+
const frame = jQuery(`[wbfst-frame="${id}"]`);
|
139
|
+
console.log(`The Frame`,frame);
|
140
|
+
jQuery(frame).animate({ opacity:0 }, 600,function(){
|
141
|
+
jQuery(this).remove();
|
142
|
+
});
|
143
|
+
|
144
|
+
});
|
145
|
+
````
|
133
146
|
|
134
147
|
## License
|
135
148
|
|
@@ -97,6 +97,71 @@ web.fast = {
|
|
97
97
|
list : function(data) {
|
98
98
|
console.log(`Processing List`);
|
99
99
|
}
|
100
|
+
},
|
101
|
+
telegram : function(action){
|
102
|
+
// check if action is to set frame
|
103
|
+
if (action == `frame`) {
|
104
|
+
return {
|
105
|
+
get : async function(id) {
|
106
|
+
console.log(`Get Frame for ID`,id);
|
107
|
+
},
|
108
|
+
close : async function(id) {
|
109
|
+
console.log(`Close Frame`);
|
110
|
+
},
|
111
|
+
set : async function(id,url,closeAction,zIndex = 9990) {
|
112
|
+
if (web.fast.user != undefined) {
|
113
|
+
//console.error(`NO USER`);
|
114
|
+
//return window.location.href = url;
|
115
|
+
window.Telegram.WebApp.HapticFeedback.impactOccurred('medium');
|
116
|
+
}
|
117
|
+
console.log(`Telegram Frame Set`,id,url,closeAction);
|
118
|
+
let iframe = document.createElement('iframe');
|
119
|
+
iframe.src = url; // Replace with your desired URL
|
120
|
+
|
121
|
+
const settedID = ``+id;
|
122
|
+
// Set additional attributes (optional)
|
123
|
+
iframe.style.border = 'none'; // Remove the border
|
124
|
+
iframe.style.width = '100vw'; // Set width to 100vw
|
125
|
+
iframe.style.height = '100vh'; // Set height to 100vh
|
126
|
+
iframe.style.top = '0'; // Set height to 100vh
|
127
|
+
iframe.style.left = '0'; // Set height to 100vh
|
128
|
+
iframe.style[`z-index`] = zIndex; // Set height to 100vh
|
129
|
+
iframe.id = settedID;
|
130
|
+
|
131
|
+
iframe.style.position = 'fixed';
|
132
|
+
|
133
|
+
// Append the iframe to the body
|
134
|
+
document.body.appendChild(iframe);
|
135
|
+
jQuery(iframe).attr(`id`,settedID);
|
136
|
+
jQuery(iframe).attr(`wbfst-frame`,settedID);
|
137
|
+
|
138
|
+
try {
|
139
|
+
//window.Telegram.WebApp.web_app_open_link(url);
|
140
|
+
if (web.fast.user != undefined) {
|
141
|
+
window.closeIframe = function() {
|
142
|
+
console.log(`Close Iframe`,id);
|
143
|
+
//jQuery(`#${id}`).hide();
|
144
|
+
closeAction(id);
|
145
|
+
}
|
146
|
+
} else {
|
147
|
+
// Set on click event
|
148
|
+
if (closeAction != undefined) {
|
149
|
+
console.log(`Set Close Action`);
|
150
|
+
window.closeIframe = function() {
|
151
|
+
console.log(`Close Iframe`,id);
|
152
|
+
//jQuery(`#${id}`).hide();
|
153
|
+
closeAction(id);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
} catch (err) {
|
159
|
+
console.error(err);
|
160
|
+
console.error(`Error opening link`,url);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
100
165
|
}
|
101
166
|
}
|
102
167
|
// 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.86",
|
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",
|