Selaa lähdekoodia

fix: bug report url on native mobile

Andelf 2 vuotta sitten
vanhempi
sitoutus
0386cf2359

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

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

+ 8 - 1
capacitor.config.ts

@@ -1,4 +1,7 @@
 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 = {
   appId: 'com.logseq.app',
@@ -18,8 +21,12 @@ const config: CapacitorConfig = {
       resize: 'none'
     }
   },
+  android: {
+    appendUserAgent: `Logseq/${version} (Android)`
+  },
   ios: {
-    scheme: 'Logseq'
+    scheme: 'Logseq',
+    appendUserAgent: `Logseq/${version} (iOS)`
   },
   cordova: {
     staticPlugins: [

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

@@ -20,7 +20,8 @@
             [frontend.util :as util]
             [frontend.version :refer [version]]
             [reitit.frontend.easy :as rfe]
-            [rum.core :as rum]))
+            [rum.core :as rum]
+            [clojure.string :as string]))
 
 (rum/defc home-button
   < {:key-fn #(identity "home-button")}
@@ -59,8 +60,11 @@
      (ui/icon "menu-2" {:size ui/icon-size})]))
 
 (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))]
     (str "https://github.com/logseq/logseq/issues/new?"
          "title=&"