mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-21 12:32:04 +02:00
Fix custom base URL support
This commit is contained in:
parent
05eafe51ac
commit
dcc6579365
11
.env.example
11
.env.example
@ -32,6 +32,17 @@ APP_KEY=SomeRandomStringOf32CharsExactly
|
|||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
|
||||||
|
# The domain subdirectory from which you want to serve 2FAuth.
|
||||||
|
# This must reflect the path targeted by APP_URL.
|
||||||
|
#
|
||||||
|
# For example, if you set APP_URL=https://mydomain.org/2fa to access 2FAuth from the '/2fa/' subdirectory
|
||||||
|
# you have to set APP_SUBDIRECTORY=2fa
|
||||||
|
#
|
||||||
|
# Leave blank if you serve 2FAuth from the domain root.
|
||||||
|
|
||||||
|
APP_SUBDIRECTORY=
|
||||||
|
|
||||||
|
|
||||||
# Turn this to true if you want your app to react like a demo.
|
# Turn this to true if you want your app to react like a demo.
|
||||||
# The Demo mode reset the app content every hours and set a generic demo user.
|
# The Demo mode reset the app content every hours and set a generic demo user.
|
||||||
|
|
||||||
|
@ -17,13 +17,16 @@ class SinglePageController extends Controller
|
|||||||
{
|
{
|
||||||
event(new ScanForNewReleaseCalled());
|
event(new ScanForNewReleaseCalled());
|
||||||
|
|
||||||
|
$subdir = config('2fauth.config.appSubdirectory') ? '/' . config('2fauth.config.appSubdirectory') : '';
|
||||||
|
|
||||||
return view('landing')->with([
|
return view('landing')->with([
|
||||||
'appSettings' => Settings::all()->toJson(),
|
'appSettings' => Settings::all()->toJson(),
|
||||||
'appConfig' => collect([
|
'appConfig' => collect([
|
||||||
'proxyAuth' => config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false,
|
'proxyAuth' => config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false,
|
||||||
'proxyLogoutUrl' => config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false,
|
'proxyLogoutUrl' => config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false,
|
||||||
'subdirectory' => '/' . config('2fauth.config.appSubdirectory') . '/',
|
'subdirectory' => $subdir,
|
||||||
])->toJson(),
|
])->toJson(),
|
||||||
|
'subdirectory' => $subdir,
|
||||||
'lang' => App::currentLocale(),
|
'lang' => App::currentLocale(),
|
||||||
'isDemoApp' => config('2fauth.config.isDemoApp') ? 'true' : 'false',
|
'isDemoApp' => config('2fauth.config.isDemoApp') ? 'true' : 'false',
|
||||||
'isTestingApp' => config('2fauth.config.isTestingApp') ? 'true' : 'false',
|
'isTestingApp' => config('2fauth.config.isTestingApp') ? 'true' : 'false',
|
||||||
|
@ -26,7 +26,7 @@ return [
|
|||||||
'isTestingApp' => env('IS_TESTING_APP', false),
|
'isTestingApp' => env('IS_TESTING_APP', false),
|
||||||
'trustedProxies' => env('TRUSTED_PROXIES', null),
|
'trustedProxies' => env('TRUSTED_PROXIES', null),
|
||||||
'proxyLogoutUrl' => env('PROXY_LOGOUT_URL', null),
|
'proxyLogoutUrl' => env('PROXY_LOGOUT_URL', null),
|
||||||
'appSubdirectory' => env('APP_SUBDIR', ''),
|
'appSubdirectory' => env('APP_SUBDIRECTORY', ''),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
2
resources/js/api.js
vendored
2
resources/js/api.js
vendored
@ -8,7 +8,7 @@ Vue.use(VueAxios, axios)
|
|||||||
Vue.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
Vue.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||||
Vue.axios.defaults.headers.common['Content-Type'] = 'application/json'
|
Vue.axios.defaults.headers.common['Content-Type'] = 'application/json'
|
||||||
|
|
||||||
if (window.appConfig.APP_SUBDIRECTORY) {
|
if (window.appConfig.subdirectory) {
|
||||||
Vue.axios.defaults.baseURL = window.appConfig.subdirectory;
|
Vue.axios.defaults.baseURL = window.appConfig.subdirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
resources/views/landing.blade.php
vendored
8
resources/views/landing.blade.php
vendored
@ -17,7 +17,7 @@
|
|||||||
<link rel="apple-touch-icon-precomposed" href="{{ asset('favicon_lg.png') }}" />
|
<link rel="apple-touch-icon-precomposed" href="{{ asset('favicon_lg.png') }}" />
|
||||||
<link rel="manifest" href="/manifest.json">
|
<link rel="manifest" href="/manifest.json">
|
||||||
|
|
||||||
<link href=".{{ mix('css/app.css') }}" rel="stylesheet">
|
<link href="{!! $subdirectory !!}{{ mix('css/app.css') }}" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body class="has-text-lighter">
|
<body class="has-text-lighter">
|
||||||
<div id="app">
|
<div id="app">
|
||||||
@ -31,8 +31,8 @@
|
|||||||
var isTestingApp = {!! $isTestingApp !!};
|
var isTestingApp = {!! $isTestingApp !!};
|
||||||
var appLocales = {!! $locales !!};
|
var appLocales = {!! $locales !!};
|
||||||
</script>
|
</script>
|
||||||
<script src=".{{ mix('js/manifest.js') }}"></script>
|
<script src="{!! $subdirectory !!}{{ mix('js/manifest.js') }}"></script>
|
||||||
<script src=".{{ mix('js/vendor.js') }}"></script>
|
<script src="{!! $subdirectory !!}{{ mix('js/vendor.js') }}"></script>
|
||||||
<script src=".{{ mix('js/app.js') }}"></script>
|
<script src="{!! $subdirectory !!}{{ mix('js/app.js') }}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user