Browse Source

feat: add stars button

0xJacky 2 years ago
parent
commit
ca45d4e2e2

+ 2 - 1
frontend/package.json

@@ -27,7 +27,8 @@
         "pinia-plugin-persistedstate": "^3.0.2",
         "reconnecting-websocket": "^4.4.0",
         "vite-plugin-build-id": "^0.2.3",
-        "vue": "^3.2.45",
+        "vue": "^3.2.47",
+        "vue-github-button": "https://github.com/0xJacky/vue-github-button",
         "vue-router": "4",
         "vue3-ace-editor": "^2.2.2",
         "vue3-apexcharts": "^1.4.1",

+ 4 - 1
frontend/src/views/domain/DomainEdit.vue

@@ -49,13 +49,16 @@ const advance_mode = computed({
     get() {
         return advance_mode_ref.value || parse_error_status.value
     },
-    set(v) {
+    set(v: boolean) {
         advance_mode_ref.value = v
     }
 })
 const history_chatgpt_record = ref([])
 
 function handle_response(r: any) {
+    if (r.advanced) {
+        advance_mode.value = true
+    }
 
     Object.keys(cert_info_map).forEach(v => {
         delete cert_info_map[v]

+ 11 - 0
frontend/src/views/system/About.vue

@@ -2,6 +2,7 @@
 import gettext from '@/gettext'
 import logo from '@/assets/img/logo.png'
 import version from '@/version.json'
+import GithubButton from 'vue-github-button'
 
 const {$gettext} = gettext
 
@@ -16,6 +17,12 @@ const this_year = new Date().getFullYear()
         <h2>Nginx UI</h2>
         <p>Yet another WebUI for Nginx</p>
         <p>Version: {{ version.version }} ({{ version.build_id || $gettext('Development Mode') }})</p>
+        <div class="star-on-github">
+            <github-button href="https://github.com/0xJacky/nginx-ui"
+                           data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large"
+                           data-show-count="true" aria-label="Star 0xJacky/nginx-ui on GitHub">Star
+            </github-button>
+        </div>
         <h3 v-translate>Project Team</h3>
         <p><a href="https://jackyu.cn/">@0xJacky</a> <a href="https://blog.kugeek.com/">@Hintay</a></p>
         <h3 v-translate>Build with</h3>
@@ -44,4 +51,8 @@ const this_year = new Date().getFullYear()
 .ant-btn {
     margin: 10px 10px 0 0;
 }
+
+.star-on-github {
+    margin-bottom: 10px;
+}
 </style>

+ 11 - 0
frontend/yarn.lock

@@ -1983,6 +1983,11 @@ gettext-extractor@^3.5.4:
     pofile "1.0.x"
     typescript "2 - 4"
 
+github-buttons@^2.22.0:
+  version "2.27.0"
+  resolved "https://registry.yarnpkg.com/github-buttons/-/github-buttons-2.27.0.tgz#bbebea3d1c4f8c302b7d8432fd25a679242597e2"
+  integrity sha512-PmfRMI2Rttg/2jDfKBeSl621sEznrsKF019SuoLdoNlO7qRUZaOyEI5Li4uW+79pVqnDtKfIEVuHTIJ5lgy64w==
+
 glob-parent@^5.1.2, glob-parent@~5.1.2:
   version "5.1.2"
   resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
@@ -3232,6 +3237,12 @@ vue-demi@*:
   resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.13.6.tgz#f9433cbd75e68a970dec066647f4ba6c08ced48f"
   integrity sha512-02NYpxgyGE2kKGegRPYlNQSL1UWfA/+JqvzhGCOYjhfbLWXU5QQX0+9pAm/R2sCOPKr5NBxVIab7fvFU0B1RxQ==
 
+"vue-github-button@https://github.com/0xJacky/vue-github-button":
+  version "3.1.0"
+  resolved "https://github.com/0xJacky/vue-github-button#fc3c93355a790d3249de6610de3ebe35949ee314"
+  dependencies:
+    github-buttons "^2.22.0"
+
 vue-router@4:
   version "4.1.3"
   resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.1.3.tgz#f8dc7931a2253cc5aa9b740f8b98969d08ca283c"