Browse Source

增加 tick 打点。

oldj 10 years ago
parent
commit
e05e5b4be7
3 changed files with 11 additions and 5 deletions
  1. 1 1
      app/SH3/MacGap/SwitchHosts!-Info.plist
  2. 0 0
      app/SH3/public/js/main.js
  3. 10 4
      app/src/stat.js

+ 1 - 1
app/SH3/MacGap/SwitchHosts!-Info.plist

@@ -21,7 +21,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>3037</string>
+	<string>3044</string>
 	<key>LSApplicationCategoryType</key>
 	<string>public.app-category.developer-tools</string>
 	<key>LSMinimumSystemVersion</key>

File diff suppressed because it is too large
+ 0 - 0
app/SH3/public/js/main.js


+ 10 - 4
app/src/stat.js

@@ -10,9 +10,10 @@ var queue = [];
 var session_id = (new Date()).getTime() + ':' + Math.random();
 var v = require('./config').VERSION;
 
-exports.record = function (action) {
+function record(action) {
     queue.push(action);
-};
+}
+exports.record = record;
 
 function send() {
     if (queue.length === 0) {
@@ -20,8 +21,8 @@ function send() {
     }
 
     var src = url + '?app=sh3&action=' + queue.splice(0).join(',')
-        + '&v=' + v
-        + '&sid=' + session_id
+        + '&v=' + encodeURIComponent(v)
+        + '&sid=' + encodeURIComponent(session_id)
         + '&_r=' + Math.random();
     var id = ('_rnd_img_' + Math.random()).replace('.', '');
     var img = new Image();
@@ -33,6 +34,11 @@ function send() {
     };
 }
 
+setInterval(function () {
+    // 每一段时间自动打点
+    record('tick');
+}, 60 * 1000 * 42);
+
 setInterval(function () {
     send();
 }, 5000);

Some files were not shown because too many files changed in this diff