webfast 0.1.57 → 0.1.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -124,16 +124,49 @@ web.fast.connectWebSocket = function(socketURL,maxRetries = 40, retries = 0) {
124
124
  console.log('WebSocket connected');
125
125
  // Start other things (e.g., send initial data)
126
126
  web.fast.que.state = true;
127
+
128
+ //alert(web.fast.tools.isMobile);
129
+ function arraySend() {
130
+ try {
131
+ if (web.fast.user != undefined || window.Telegram.WebApp.initData == ``) {
132
+ let arraySend = [];
133
+ jQuery(`[webfast-get]`).each(async function(){
134
+ const type = jQuery(this).attr(`webfast-get`);
135
+ let id = jQuery(this).attr(`id`);
136
+ if (id == undefined) {
137
+ id = await web.fast.tools.generateRandomId(8); // Generate a random ID of length 8
138
+ }
139
+ arraySend.push({
140
+ id : id,
141
+ type : type
142
+ })
143
+ })
144
+ console.log(`Send Array`,arraySend);
145
+ web.fast.tools.on.connect(arraySend);
146
+ } else {
147
+ throw new Error(`error some send`);
148
+ }
149
+ } catch (err) {
150
+ console.error(`Try again`);
151
+ setTimeout(function(){
152
+ arraySend();
153
+ },200);
154
+ }
155
+ }
156
+ // send array
157
+ arraySend();
158
+
127
159
  };
128
160
 
129
161
  ws.onmessage = (event) => {
130
- console.log('Received:', event.data);
162
+ //console.log('Received:', event.data);
131
163
  // Handle received data
132
164
  // Check if type user then we will walk through the data to set the data for the user
133
165
  const json = JSON.parse(event.data);
134
166
  if (json.type == `user`) {
135
167
  // We have user data
136
168
  console.log(`Set User Data`);
169
+ web.fast.user = json;
137
170
  // Now go Through to set all data
138
171
  // Get all webfast client
139
172
  jQuery(`[webfast-client]`).each(function(){
@@ -349,7 +349,8 @@ module.exports = async function (program) {
349
349
  sendData.images = allImages;
350
350
 
351
351
  // TODO ADD OTHER DATA
352
-
352
+ //program.express.process.socket.api.
353
+ // TODO location
353
354
  ws.send(JSON.stringify({ type: 'user', clientId: clientId, data : sendData }));
354
355
 
355
356
  }});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webfast",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
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": {