@@ -47,30 +47,39 @@ const fetchData = () => {
47
47
let icon = ' ' ;
48
48
let title = ' ' ;
49
49
apps .value = resApps .data .data .items ;
50
- websites .value = res .data .map ((item ) => {
51
- const app = apps .value .find ((app : any ) => app .name === item .name );
52
- if (app ) {
53
- return {
54
- ... app ,
55
- ... item ,
56
- title: app .title ,
57
- icon: app .icon ,
58
- url:
59
- app .name === ' profile'
60
- ? ` //${app .url .split (' profile.' )[1 ]} `
61
- : ` //${app .url } `
62
- };
63
- } else if (item .name === ' desktop' ) {
64
- icon = desktopIcon ;
65
- title = ' Desktop' ;
50
+ const appNames = apps .value
51
+ .map ((item : any ) => item .name )
52
+ .concat ([' desktop' ]);
66
53
67
- const url = ` //desktop.${appDetail .user .username }${
68
- location .hostname .split (appDetail .user .username )[1 ]
69
- } ` ;
70
- return { ... app , ... item , title , icon , url };
71
- }
72
- return { ... app , ... item , url: ` //${app .url } ` };
73
- });
54
+ websites .value = res .data
55
+ .filter ((item ) => appNames .includes (item .name ))
56
+ .map ((item ) => {
57
+ const app = apps .value .find ((app : any ) => app .name === item .name );
58
+ if (app ) {
59
+ const entrance = app .entrances .find (
60
+ (entrance ) => ! entrance .invisible
61
+ );
62
+ return {
63
+ ... app ,
64
+ ... item ,
65
+ title: entrance .title ,
66
+ icon: entrance .icon ,
67
+ url:
68
+ entrance .name === ' profile'
69
+ ? ` //${app .url .split (' profile.' )[1 ]} `
70
+ : ` //${entrance .url } `
71
+ };
72
+ } else if (item .name === ' desktop' ) {
73
+ icon = desktopIcon ;
74
+ title = ' Desktop' ;
75
+
76
+ const url = ` //desktop.${appDetail .user .username }${
77
+ location .hostname .split (appDetail .user .username )[1 ]
78
+ } ` ;
79
+ return { ... app , ... item , title , icon , url };
80
+ }
81
+ return { ... app , ... item , url: ` //${app .url } ` };
82
+ });
74
83
setWebsiteDateDefault (websites .value );
75
84
})
76
85
.finally (() => {
0 commit comments