Revert using url-join for SD WebUI paths
| @@ -106,8 +106,10 @@ router.post('/upscalers', jsonParser, async (request, response) => { | |||
| 106 | 106 | ||
| 107 | router.post('/vaes', jsonParser, async (request, response) => { | 107 | router.post('/vaes', jsonParser, async (request, response) => { |
| 108 | try { | 108 | try { |
| 109 | const autoUrl = urlJoin(request.body.url, '/sdapi/v1/sd-vae'); | 109 | const autoUrl = new URL(request.body.url); |
| 110 | const forgeUrl = urlJoin(request.body.url, '/sdapi/v1/sd-modules'); | 110 | autoUrl.pathname = '/sdapi/v1/sd-vae'; |
| 111 | const forgeUrl = new URL(request.body.url); | ||
| 112 | forgeUrl.pathname = '/sdapi/v1/sd-modules'; | ||
| 111 | 113 | ||
| 112 | const requestInit = { | 114 | const requestInit = { |
| 113 | method: 'GET', | 115 | method: 'GET', |
| @@ -295,7 +297,8 @@ router.post('/set-model', jsonParser, async (request, response) => { | |||
| 295 | router.post('/generate', jsonParser, async (request, response) => { | 297 | router.post('/generate', jsonParser, async (request, response) => { |
| 296 | try { | 298 | try { |
| 297 | try { | 299 | try { |
| 298 | const optionsUrl = urlJoin(request.body.url, '/sdapi/v1/options'); | 300 | const optionsUrl = new URL(request.body.url); |
| 301 | optionsUrl.pathname = '/sdapi/v1/options'; | ||
| 299 | const optionsResult = await fetch(optionsUrl, { headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } }); | 302 | const optionsResult = await fetch(optionsUrl, { headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } }); |
| 300 | if (optionsResult.ok) { | 303 | if (optionsResult.ok) { |
| 301 | const optionsData = /** @type {any} */ (await optionsResult.json()); | 304 | const optionsData = /** @type {any} */ (await optionsResult.json()); |
| @@ -313,14 +316,16 @@ router.post('/generate', jsonParser, async (request, response) => { | |||
| 313 | request.socket.removeAllListeners('close'); | 316 | request.socket.removeAllListeners('close'); |
| 314 | request.socket.on('close', function () { | 317 | request.socket.on('close', function () { |
| 315 | if (!response.writableEnded) { | 318 | if (!response.writableEnded) { |
| 316 | const interruptUrl = urlJoin(request.body.url, '/sdapi/v1/interrupt'); | 319 | const interruptUrl = new URL(request.body.url); |
| 320 | interruptUrl.pathname = '/sdapi/v1/interrupt'; | ||
| 317 | fetch(interruptUrl, { method: 'POST', headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } }); | 321 | fetch(interruptUrl, { method: 'POST', headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } }); |
| 318 | } | 322 | } |
| 319 | controller.abort(); | 323 | controller.abort(); |
| 320 | }); | 324 | }); |
| 321 | 325 | ||
| 322 | console.log('SD WebUI request:', request.body); | 326 | console.log('SD WebUI request:', request.body); |
| 323 | const txt2imgUrl = urlJoin(request.body.url, '/sdapi/v1/txt2img'); | 327 | const txt2imgUrl = new URL(request.body.url); |
| 328 | txt2imgUrl.pathname = '/sdapi/v1/txt2img'; | ||
| 324 | const result = await fetch(txt2imgUrl, { | 329 | const result = await fetch(txt2imgUrl, { |
| 325 | method: 'POST', | 330 | method: 'POST', |
| 326 | body: JSON.stringify(request.body), | 331 | body: JSON.stringify(request.body), |