瀏覽代碼

fix: bug report url on native mobile

Andelf 2 年之前
父節點
當前提交
0386cf2359
共有 3 個文件被更改,包括 17 次插入6 次删除
  1. 2 2
      .github/ISSUE_TEMPLATE/bug_report.yaml
  2. 8 1
      capacitor.config.ts
  3. 7 3
      src/main/frontend/components/header.cljs

+ 2 - 2
.github/ISSUE_TEMPLATE/bug_report.yaml

@@ -4,7 +4,7 @@ body:
   - type: textarea
   - type: textarea
     id: problem
     id: problem
     attributes:
     attributes:
-      label: What happened?
+      label: What Happened?
       description: |
       description: |
         Please provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner.
         Please provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner.
     validations:
     validations:
@@ -41,7 +41,7 @@ body:
   - type: textarea
   - type: textarea
     id: platform
     id: platform
     attributes:
     attributes:
-      label: Desktop or mobile Platform Information
+      label: Desktop or Mobile Platform Information
       description: |
       description: |
         Would you mind to tell us the system information about your desktop or mobile platform?
         Would you mind to tell us the system information about your desktop or mobile platform?
       placeholder: |
       placeholder: |

+ 8 - 1
capacitor.config.ts

@@ -1,4 +1,7 @@
 import { CapacitorConfig } from '@capacitor/cli'
 import { CapacitorConfig } from '@capacitor/cli'
+import fs from 'fs'
+
+const version = fs.readFileSync('static/package.json', 'utf8').match(/"version": "(.*?)"/)?.at(1) ?? '0.0.0'
 
 
 const config: CapacitorConfig = {
 const config: CapacitorConfig = {
   appId: 'com.logseq.app',
   appId: 'com.logseq.app',
@@ -18,8 +21,12 @@ const config: CapacitorConfig = {
       resize: 'none'
       resize: 'none'
     }
     }
   },
   },
+  android: {
+    appendUserAgent: `Logseq/${version} (Android)`
+  },
   ios: {
   ios: {
-    scheme: 'Logseq'
+    scheme: 'Logseq',
+    appendUserAgent: `Logseq/${version} (iOS)`
   },
   },
   cordova: {
   cordova: {
     staticPlugins: [
     staticPlugins: [

+ 7 - 3
src/main/frontend/components/header.cljs

@@ -20,7 +20,8 @@
             [frontend.util :as util]
             [frontend.util :as util]
             [frontend.version :refer [version]]
             [frontend.version :refer [version]]
             [reitit.frontend.easy :as rfe]
             [reitit.frontend.easy :as rfe]
-            [rum.core :as rum]))
+            [rum.core :as rum]
+            [clojure.string :as string]))
 
 
 (rum/defc home-button
 (rum/defc home-button
   < {:key-fn #(identity "home-button")}
   < {:key-fn #(identity "home-button")}
@@ -59,8 +60,11 @@
      (ui/icon "menu-2" {:size ui/icon-size})]))
      (ui/icon "menu-2" {:size ui/icon-size})]))
 
 
 (def bug-report-url
 (def bug-report-url
-  (let [platform (str "App Version: " version "\n"
-                      "Platform: " (.-userAgent js/navigator) "\n"
+  (let [ua (.-userAgent js/navigator)
+        safe-ua (string/replace ua #"[^_/a-zA-Z0-9\.\(\)]+" " ")
+        platform (str "App Version: " version "\n"
+                      "Git Revision: " config/REVISION "\n"
+                      "Platform: " safe-ua "\n"
                       "Language: " (.-language js/navigator))]
                       "Language: " (.-language js/navigator))]
     (str "https://github.com/logseq/logseq/issues/new?"
     (str "https://github.com/logseq/logseq/issues/new?"
          "title=&"
          "title=&"