File tree Expand file tree Collapse file tree 4 files changed +41
-2
lines changed
Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 4747 "nprogress" : " ^0.2.0" ,
4848 "pinia" : " ^2.1.7" ,
4949 "pinia-plugin-persistedstate" : " ^1.6.1" ,
50+ "punycode" : " ^2.3.1" ,
5051 "qs" : " ^6.12.1" ,
5152 "screenfull" : " ^6.0.2" ,
5253 "uuid" : " ^10.0.0" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { v4 as uuidv4 } from 'uuid';
77import JSEncrypt from 'jsencrypt' ;
88import CryptoJS from 'crypto-js' ;
99import { routerToPathWithQuery } from './router' ;
10+ import { toUnicode } from 'punycode' ;
1011
1112export function deepCopy < T > ( obj : any ) : T {
1213 let newObj : any ;
@@ -919,3 +920,30 @@ export function sortMenu(arr) {
919920
920921 arr . sort ( compareById ) ;
921922}
923+
924+ export function isPunycoded ( domain : string ) : boolean {
925+ return domain . includes ( 'xn--' ) ;
926+ }
927+
928+ export function GetPunyCodeDomain ( domain : string ) : string {
929+ if ( ! domain || typeof domain !== 'string' ) {
930+ return '' ;
931+ }
932+
933+ const lowerDomain = domain . toLowerCase ( ) ;
934+ if ( ! lowerDomain . includes ( 'xn--' ) ) {
935+ return '' ;
936+ }
937+
938+ try {
939+ const decoded = toUnicode ( domain ) ;
940+
941+ if ( decoded === domain ) {
942+ return '' ;
943+ }
944+
945+ return decoded ;
946+ } catch ( error ) {
947+ return '' ;
948+ }
949+ }
Original file line number Diff line number Diff line change 88 <el-button link :icon =" Promotion" @click =" openUrl(row)" ></el-button >
99 </template >
1010 </el-table-column >
11- <el-table-column :label =" $t('website.domain')" prop =" domain" ></el-table-column >
11+ <el-table-column :label =" $t('website.domain')" prop =" domain" >
12+ <template #default =" { row } " >
13+ {{ row.domain }}
14+ <span class =" text-gray-400" v-if =" isPunycoded(row.domain)" >({{ GetPunyCodeDomain(row.domain) }})</span >
15+ </template >
16+ </el-table-column >
1217 <el-table-column :label =" $t('commons.table.port')" prop =" port" ></el-table-column >
1318 <el-table-column :label =" 'SSL'" prop =" ssl" >
1419 <template #default =" { row } " >
@@ -37,6 +42,7 @@ import { Promotion } from '@element-plus/icons-vue';
3742import { GlobalStore } from ' @/store' ;
3843import { checkAppInstalled } from ' @/api/modules/app' ;
3944import { MsgSuccess } from ' @/utils/message' ;
45+ import { GetPunyCodeDomain , isPunycoded } from ' @/utils/util' ;
4046const globalStore = GlobalStore ();
4147
4248const props = defineProps ({
Original file line number Diff line number Diff line change 1515 </el-form >
1616 <el-text v-else type =" primary" class =" cursor-pointer" @click =" openConfig(row.id)" >
1717 {{ row.primaryDomain }}
18+ <span class =" text-gray-400" v-if =" isPunycoded(row.primaryDomain)" >
19+ ({{ GetPunyCodeDomain(row.primaryDomain) }})
20+ </span >
1821 </el-text >
1922 <el-popover
2023 placement =" right"
6164</template >
6265
6366<script lang="ts" setup>
64- import { ref } from ' vue' ;
67+ import { ref , nextTick } from ' vue' ;
6568import { listDomains } from ' @/api/modules/website' ;
6669import { Website } from ' @/api/interface/website' ;
6770import { routerToNameWithParams } from ' @/utils/router' ;
6871import { Rules } from ' @/global/form-rules' ;
72+ import { GetPunyCodeDomain , isPunycoded } from ' @/utils/util' ;
6973
7074interface Props {
7175 row: Website .Website ;
You can’t perform that action at this time.
0 commit comments