Parcourir la source

fix downloaded log format

Co-Authored-By: Alireza Ahmadi <[email protected]>
MHSanaei il y a 1 an
Parent
commit
5f9058c84f
1 fichiers modifiés avec 6 ajouts et 4 suppressions
  1. 6 4
      web/html/xui/index.html

+ 6 - 4
web/html/xui/index.html

@@ -299,12 +299,12 @@
             </a-form-item>
             <a-form-item>
                 <a-button type="primary" style="margin-bottom: 10px;"
-                :href="'data:application/text;charset=utf-8,' + encodeURIComponent(logModal.logs)" download="x-ui.log">
+                :href="'data:application/text;charset=utf-8,' + encodeURIComponent(logModal.logs.join('\n'))" download="x-ui.log">
                     {{ i18n "download" }} x-ui.log
                 </a-button>
             </a-form-item>
         </a-form>
-        <div class="ant-input" style="height: auto; max-height: 500px; overflow: auto;" v-html="logModal.logs"></div>
+        <div class="ant-input" style="height: auto; max-height: 500px; overflow: auto;" v-html="logModal.formattedLogs"></div>
     </a-modal>
 
     <a-modal id="backup-modal" v-model="backupModal.visible" :title="backupModal.title"
@@ -432,14 +432,16 @@
 
     const logModal = {
         visible: false,
-        logs: '',
+        logs: [],
+        formattedLogs: '',
         rows: 20,
         level: 'info',
         syslog: false,
         loading: false,
         show(logs) {
             this.visible = true;
-            this.logs = logs? this.formatLogs(logs) : "No Record...";
+            this.logs = logs;
+            this.formattedLogs = logs.length > 0 ? this.formatLogs(logs) : "No Record...";
         },
         formatLogs(logs) {
             let formattedLogs = '';