webfast 0.1.57 → 0.1.59
Sign up to get free protection for your applications and to get access to all the features.
- package/app/content/js/webfast.js +34 -1
- package/modules/express/init.js +2 -1
- package/package.json +1 -1
@@ -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(){
|
package/modules/express/init.js
CHANGED
@@ -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
|
}});
|