nitro-web 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -729,7 +729,7 @@ export async function tokenSend({ type, id, payload, beforeUpdate, beforeSendEma
729
729
  }
730
730
 
731
731
  export function getBaseUrl(req) {
732
- return resolveBaseUrl(req?.nitroBaseUrl, authConfig.baseUrl)
732
+ return resolveBaseUrl(req?.requestOrigin, authConfig.baseUrl)
733
733
  }
734
734
 
735
735
  export function resolveBaseUrl(reqUrl, cfgUrl) {
@@ -82,7 +82,7 @@ async function billingPortalSessionCreate(req, res) {
82
82
  }
83
83
  const session = await stripe.billingPortal.sessions.create({
84
84
  customer: req.user.stripeCustomer.id,
85
- return_url: resolveBaseUrl(req.nitroBaseUrl, config.baseUrl) + '/subscriptions',
85
+ return_url: resolveBaseUrl(req.requestOrigin, config.baseUrl) + '/subscriptions',
86
86
  })
87
87
  res.json(session.url)
88
88
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "repository": "github:boycce/nitro-web",
5
5
  "homepage": "https://boycce.github.io/nitro-web/",
6
6
  "description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
package/server/router.js CHANGED
@@ -333,7 +333,7 @@ export const middleware = {
333
333
  // Handy boolean denoting that the request wants JSON returned
334
334
  req.json = req.xhr || req.accepts(['html', 'json']) == 'json'
335
335
  // Dynamic baseUrl from the request headers, may require app.set('trust proxy', 1) in the server setup for heroku proxying
336
- req.nitroBaseUrl = req.protocol + '://' + req.headers.host
336
+ req.requestOrigin = req.protocol + '://' + req.headers.host
337
337
  // log the headers if the config.logHeaders is true
338
338
  if (configLocal.logHeaders) {
339
339
  console.info('Headers:', req.headers)