@@ -1135,6 +1135,25 @@ async function renderCreateServer() {
11351135function handleEggChange ( ) {
11361136 const varsEl = $ ( '#egg-variables' ) ;
11371137 varsEl . innerHTML = '' ;
1138+ const eggVal = $ ( '#custom-egg-trigger' ) . dataset . value ;
1139+ if ( ! eggVal ) return ;
1140+ const [ eggId , nestId ] = eggVal . split ( ',' ) . map ( Number ) ;
1141+ const egg = eggCache . find ( e => e . eggId === eggId && e . nestId === nestId ) ;
1142+ if ( ! egg || ! egg . variables || egg . variables . length === 0 ) return ;
1143+ const userViewable = egg . variables . filter ( v => v . userViewable !== 0 ) ;
1144+ if ( userViewable . length === 0 ) return ;
1145+ let htmlStr = '<div class="card" style="margin-top:20px;padding:20px"><h3 style="font-size:0.95rem;font-weight:700;margin-bottom:16px">Egg Variables</h3>' ;
1146+ for ( const v of userViewable ) {
1147+ const isEditable = v . userEditable !== 0 ;
1148+ const desc = v . description ? `<p style="font-size:0.75rem;color:var(--text-muted);margin-top:2px">${ v . description } </p>` : '' ;
1149+ if ( isEditable ) {
1150+ htmlStr += `<div class="form-group"><label for="egg-var-${ v . envVariable } ">${ v . name } </label><input type="text" id="egg-var-${ v . envVariable } " value="${ v . defaultValue || '' } " placeholder="${ v . name } " />${ desc } </div>` ;
1151+ } else {
1152+ htmlStr += `<div class="form-group"><label>${ v . name } </label><input type="text" value="${ v . defaultValue || '' } " disabled />${ desc } </div>` ;
1153+ }
1154+ }
1155+ htmlStr += '</div>' ;
1156+ varsEl . innerHTML = htmlStr ;
11381157}
11391158
11401159async function handleCreateServer ( e ) {
@@ -1158,7 +1177,8 @@ async function handleCreateServer(e) {
11581177 const environment = { } ;
11591178 if ( egg && egg . variables ) {
11601179 for ( const v of egg . variables ) {
1161- environment [ v . envVariable ] = v . defaultValue || '' ;
1180+ const input = document . getElementById ( `egg-var-${ v . envVariable } ` ) ;
1181+ environment [ v . envVariable ] = input ? input . value . trim ( ) : ( v . defaultValue || '' ) ;
11621182 }
11631183 }
11641184
0 commit comments