-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow app to be run in a sub folder #340
Conversation
WalkthroughThe update primarily focuses on enhancing the application's flexibility and scalability by dynamically generating URLs for various resources, including email verification, API routing, and media assets in both server and client components. It leverages runtime configurations and environment variables to adapt to different deployment environments seamlessly. The changes span across backend and frontend, ensuring that the application remains robust and easily configurable across different setups. Changes
Related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 5
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
client/components/vendor/appsumo/AppSumoBilling.vue
is excluded by:!**/vendor/**
client/components/vendor/appsumo/AppSumoRegister.vue
is excluded by:!**/vendor/**
Files selected for processing (13)
- app/Exceptions/VerifyEmailException.php (1 hunks)
- app/Providers/RouteServiceProvider.php (2 hunks)
- client/app.vue (1 hunks)
- client/components/global/Navbar.vue (1 hunks)
- client/components/open/forms/components/FormStats.vue (1 hunks)
- client/components/pages/OpenFormFooter.vue (1 hunks)
- client/components/pages/welcome/AiFeature.vue (2 hunks)
- client/components/pages/welcome/Features.vue (3 hunks)
- client/error.vue (1 hunks)
- client/pages/ai-form-builder.vue (14 hunks)
- client/pages/forms/[slug]/index.vue (1 hunks)
- client/pages/home.vue (1 hunks)
- client/pages/index.vue (2 hunks)
Additional comments: 15
client/error.vue (1)
- 6-6: The dynamic setting of the
src
attribute usinguseRuntimeConfig().public.appUrl
is a good practice for supporting applications running in a subdirectory. This ensures that the image URL is correctly resolved regardless of the deployment environment. Just ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
under thepublicRuntimeConfig
section.client/components/pages/OpenFormFooter.vue (1)
- 11-11: Dynamically setting the
src
attribute for the logo image usinguseRuntimeConfig().public.appUrl
is a good practice for Nuxt.js applications, especially when supporting deployment in subdirectories. This ensures that the image URL is correctly resolved in different environments. Just make sure thatpublic.appUrl
is properly configured in yournuxt.config.js
.client/app.vue (1)
- 51-51: Setting the
ogImage
dynamically usinguseRuntimeConfig().public.appUrl
is a good approach to ensure that the Open Graph image URL is correctly resolved across different deployment environments. This is particularly important for SEO and when sharing links on social media. Ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
to reflect the actual URL of your application.client/components/open/forms/components/FormStats.vue (1)
- 16-16: Dynamically setting the image source using
useRuntimeConfig().public.appUrl
is a good practice for ensuring that resources are correctly loaded when the application is run from a subdirectory. This approach enhances the flexibility of the application to adapt to different deployment environments. Just ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
.client/pages/forms/[slug]/index.vue (1)
- 169-169: Dynamically setting the script source using
useRuntimeConfig().public.appUrl
is a good practice for ensuring that external scripts are correctly loaded when the application is run from a subdirectory. This approach enhances the flexibility of the application to adapt to different deployment environments. Just ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
.client/components/pages/welcome/AiFeature.vue (2)
- 8-8: Dynamically setting the background pattern image source using
useRuntimeConfig().public.appUrl
is a good practice for ensuring that resources are correctly loaded when the application is run from a subdirectory. This approach enhances the flexibility of the application to adapt to different deployment environments. Just ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
.- 87-87: Similarly, dynamically setting the illustration image source using
useRuntimeConfig().public.appUrl
is a good practice. This ensures that the image URL is correctly resolved across different deployment environments, enhancing the application's adaptability. Ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
.client/pages/home.vue (1)
- 44-44: Dynamically setting the image source for the "search not found" image using
useRuntimeConfig().public.appUrl
is a good practice for ensuring that resources are correctly loaded when the application is run from a subdirectory. This approach enhances the flexibility of the application to adapt to different deployment environments. Just ensure thatpublic.appUrl
is correctly set in yournuxt.config.js
.client/components/pages/welcome/Features.vue (1)
- 23-23: The update to use a dynamic URL for the image path in the "Create" step is a good approach to ensure images load correctly when the application is hosted in a subdirectory. Please ensure that all instances where dynamic URLs are used follow this pattern for consistency.
client/components/global/Navbar.vue (1)
- 8-8: The update to dynamically include the application's URL using
useRuntimeConfig().public.appUrl
for the<NuxtImg>
component'ssrc
attribute is a good approach to support running the application in a subdirectory. Ensure that theappUrl
is correctly configured in all environments to prevent issues with resource loading. Additionally, consider reviewing the security implications of dynamically constructing URLs to avoid potential vulnerabilities, such as Open Redirects.client/pages/index.vue (2)
- 6-6: The dynamic setting of the image source using
useRuntimeConfig().public.appUrl
for the background pattern is consistent with the objective of supporting subdirectory deployment. Ensure that theappUrl
is correctly set in the environment configurations. Additionally, review the security implications of dynamically constructing URLs to mitigate potential vulnerabilities.- 91-91: Updating the product cover image source to dynamically include the application's URL using
useRuntimeConfig().public.appUrl
aligns with the goal of enabling subdirectory deployment. As with other dynamic URL constructions, ensure theappUrl
is properly configured and assess any security concerns related to URL manipulation.client/pages/ai-form-builder.vue (3)
- 6-6: Using dynamic URLs for resources like images is a good practice when supporting applications in subdirectories. This ensures that the resources load correctly regardless of the application's base URL.
- 35-35: The dynamic URL for the video source is correctly implemented. This ensures that the video loads correctly when the application is hosted in a subdirectory.
- 45-45: All instances of dynamic URLs for images and icons are correctly implemented using
useRuntimeConfig().public.appUrl
. This consistent approach ensures that all resources are loaded correctly, supporting the application's functionality in a subdirectory environment.Also applies to: 58-58, 71-71, 107-107, 116-116, 134-134, 141-141, 156-156, 163-163, 203-203, 217-217, 231-231, 245-245, 425-425, 427-427, 429-429
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- client/components/pages/welcome/Features.vue (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- client/components/pages/welcome/Features.vue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- app/Exceptions/VerifyEmailException.php (1 hunks)
- app/Providers/RouteServiceProvider.php (2 hunks)
- client/components/pages/welcome/Features.vue (3 hunks)
Files skipped from review as they are similar to previous changes (3)
- app/Exceptions/VerifyEmailException.php
- app/Providers/RouteServiceProvider.php
- client/components/pages/welcome/Features.vue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks a lot for working on this. I left some comments. I don't think we should be adding ${useRuntimeConfig().public.appUrl}
on every file, there must be another way. If we set the appurl properly then we shouldn't need this should we?
@@ -14,7 +14,7 @@ public static function forUser($user) | |||
{ | |||
return static::withMessages([ | |||
'email' => [__('You must :linkOpen verify :linkClose your email first.', [ | |||
'linkOpen' => '<a href="/email/resend?email='.urlencode($user->email).'">', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this we should use the front_url
helper function
@@ -30,7 +30,7 @@ public function boot() | |||
$this->registerGlobalRouteParamConstraints(); | |||
|
|||
$this->routes(function () { | |||
Route::middleware('api') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum we shouldn't not change the middleware name this should be left as it is - this is a middleware name, not a URL prefix
@@ -43,7 +43,7 @@ public function boot() | |||
*/ | |||
protected function configureRateLimiting() | |||
{ | |||
RateLimiter::for('api', function (Request $request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the above
@@ -48,7 +48,7 @@ export default { | |||
useOpnSeoMeta({ | |||
title: 'OpnForm', | |||
description: 'Create beautiful forms for free. Unlimited fields, unlimited submissions. It\'s free and it takes less than 1 minute to create your first form.', | |||
ogImage: '/img/social-preview.jpg', | |||
ogImage: `${useRuntimeConfig().public.appUrl}/img/social-preview.jpg`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If appUrl is properly set with the subfolder path, why do we need this?
@@ -5,7 +5,7 @@ | |||
<div class="flex items-center"> | |||
<NuxtLink :to="{ name: user ? 'home' : 'index' }" | |||
class="flex-shrink-0 font-semibold hover:no-underline flex items-center"> | |||
<NuxtImg src="/img/logo.svg" alt="notion tools logo" class="w-8 h-8"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before - why need if appUrl is properly set with the subfolder path
@gilesbradshaw tagging on this as I forgot to do it earlier |
Thanks a lot for your comments - I shall work on this when I get the time. I assume you'd be willing to accept once issues are sorted? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (4)
- client/app.vue (1 hunks)
- client/components/global/Navbar.vue (1 hunks)
- client/pages/forms/[slug]/index.vue (1 hunks)
- client/pages/home.vue (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- client/app.vue
- client/components/global/Navbar.vue
- client/pages/forms/[slug]/index.vue
- client/pages/home.vue
Definitely |
Closing this for now, please re-open if needed. |
This allows opn form to be run in a subdirectory.
I wanted this so I can authenticate form submissions made on my web site. I have a proxy which gets the user from http-ony cookies and then strips the cookies before sending the post on to opnform.
the client env is as follows:
nb the NUXT_APP_BASE_URL value (nuxt uses this)
I struggled with getting this value in runtimeConfig.js (not sure why 🤷) so in the code I use the full NUXT_PUBLIC_APP_URL value.
discussed on issue #337
Summary by CodeRabbit
New Features
Enhancements