File tree Expand file tree Collapse file tree
packages/hydrooj/src/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,19 +144,14 @@ export async function apply(ctx: Context) {
144144 }
145145 try {
146146 const { anchor } = args ;
147- let withDomainId = args . domainId || false ;
148- const domainId = this . args . domainId ;
149- const host = this . domain ?. host ;
150- if ( domainId !== 'system' && (
151- ! this . request . host
152- || ( host instanceof Array
153- ? ( ! host . includes ( this . request . host ) )
154- : this . request . host !== host )
155- ) ) withDomainId ||= domainId ;
147+ const host = this . domain ?. host || [ ] ;
148+ const target = args . domainId || this . args . domainId ;
149+ const rootDomainId = ( this . request . host && host ?. length && host ?. includes ( this . request . host ) )
150+ ? this . args . domainId : 'system' ;
156151 delete args . query ;
157152 res = server . router . url ( name , args , { query } ) . toString ( ) ;
158153 if ( anchor ) res = `${ res } #${ anchor } ` ;
159- if ( withDomainId ) res = `/d/${ withDomainId } ${ res } ` ;
154+ if ( target !== rootDomainId ) res = `/d/${ target } ${ res } ` ;
160155 } catch ( e ) {
161156 logger . warn ( e . message ) ;
162157 logger . info ( '%s %o' , name , args ) ;
You can’t perform that action at this time.
0 commit comments