- add alias_url ind config/app.php

- Define constants DATACITE_PREFIX abd APP_URL inside wevpack.mix.js
- define subdomains for alias and dois inside routes/web.php
- install dotenv via npm
This commit is contained in:
Arno Kaimbacher 2021-06-01 17:32:19 +02:00
parent a68b7b34cf
commit 00bea6885e
9 changed files with 541 additions and 490 deletions

View File

@ -55,6 +55,7 @@ return [
*/ */
'url' => env('APP_URL', 'http://localhost'), 'url' => env('APP_URL', 'http://localhost'),
'alias_url' => env('ALIAS_URL'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

5
package-lock.json generated
View File

@ -10,6 +10,7 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"datatables.net": "^1.10.21", "datatables.net": "^1.10.21",
"datatables.net-buttons": "^1.6.3", "datatables.net-buttons": "^1.6.3",
"dotenv": "^8.6.0",
"easytimer": "^1.1.1", "easytimer": "^1.1.1",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"leaflet": "^1.7.1", "leaflet": "^1.7.1",
@ -4601,7 +4602,6 @@
"version": "8.6.0", "version": "8.6.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==",
"dev": true,
"engines": { "engines": {
"node": ">=10" "node": ">=10"
} }
@ -17000,8 +17000,7 @@
"dotenv": { "dotenv": {
"version": "8.6.0", "version": "8.6.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g=="
"dev": true
}, },
"dotenv-expand": { "dotenv-expand": {
"version": "5.1.0", "version": "5.1.0",

View File

@ -31,6 +31,7 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"datatables.net": "^1.10.21", "datatables.net": "^1.10.21",
"datatables.net-buttons": "^1.6.3", "datatables.net-buttons": "^1.6.3",
"dotenv": "^8.6.0",
"easytimer": "^1.1.1", "easytimer": "^1.1.1",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"leaflet": "^1.7.1", "leaflet": "^1.7.1",

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
declare const DATACITE_PREFIX: string;
declare const APP_URL: string;
const _DATACITE_PREFIX = DATACITE_PREFIX;
const _APP_URL = APP_URL;
export {_DATACITE_PREFIX as DATACITE_PREFIX};
export {_APP_URL as APP_URL};

View File

@ -1,9 +1,12 @@
import { Component, Vue, Prop, Provide } from 'vue-property-decorator'; import { Component, Vue, Prop } from 'vue-property-decorator';
import { DATACITE_PREFIX, APP_URL } from "../../constants";
@Component @Component
export default class VsResults extends Vue { export default class VsResults extends Vue {
openAccessLicences: Array<string> = ['CC BY', 'CC BY-SA']; openAccessLicences: Array<string> = ['CC-BY-4.0', 'CC-BY-SA-4.0'];
datacite_prefix= DATACITE_PREFIX;
app_url=APP_URL;
@Prop() @Prop()
data; data;

View File

@ -30,17 +30,17 @@
<span v-if="openAccessLicences.includes(document.licence)" class="label label-success titlecase">Open Access</span> <span v-if="openAccessLicences.includes(document.licence)" class="label label-success titlecase">Open Access</span>
<h4 v-if="document.identifier && document.identifier.length > 0"> <p v-if="document.identifier && document.identifier.length > 0">
<!-- <span>Author: {{ document.identifier.join(', ') }}</span> --> <!-- <span>Author: {{ document.identifier.join(', ') }}</span> -->
<!-- <span v-for="(author,index) in document.author" :key="index">{{ author }}; </span> --> <!-- <span v-for="(author,index) in document.author" :key="index">{{ author }}; </span> -->
<!-- <span>'https://doi.org/' + {{ document.identifier[0] }}</span> --> <!-- <span>'https://doi.org/' + {{ document.identifier[0] }}</span> -->
<a target="_blank" v-bind:href="'https://doi.org/' + document.identifier[0]" class="ng-binding"> <a target="_blank" v-bind:href="'https://doi.org/' + document.identifier[0]" class="ng-binding">
{{ 'https://doi.org/' + document.identifier[0] }} {{ 'https://doi.org/' + document.identifier[0] }}
</a> </a>
</h4> </p>
<h4> <h4>
<a target="_self" v-bind:href="'dataset/' + document.id" class="ng-binding"> <a target="_self" v-bind:href="'https://doi.'+ app_url +'/' + datacite_prefix + '/tethys.' + document.id" class="ng-binding">
{{ document.title_output }} {{ document.title_output }}
</a> </a>
</h4> </h4>

View File

@ -13,26 +13,51 @@ use Illuminate\Support\Facades\Route;
*/ */
//Auth::routes(); //Auth::routes();
//Route::get('/home', 'HomeController@index')->name('home'); //Route::get('/home', 'HomeController@index')->name('home');
$base_domain = config('app.url');
$alias_domain = config('app.alias_url');
Route::match(array('GET','POST'), '/oai', ['as' => 'oai', 'uses' => 'Oai\RequestController@index']);
Route::group([
'domain' => 'doi.' . $base_domain,
'as' => 'doi'
], function () {
$dataset_prefix = config('tethys.datacite_prefix');
Route::get('/' . $dataset_prefix . '/tethys.{id}', [
'as' => 'dataset.show', 'uses' => 'Frontend\PagesController@show',
]);
Route::get('/', function () {
redirect()->route('frontend.home.index');
});
});
// Route::group([
// 'domain' => ($base_domain|'www.tethys.at')
// ],
$appRoutes = function () {
Route::match(array('GET', 'POST'), '/oai', ['as' => 'oai', 'uses' => 'Oai\RequestController@index']);
//Route::get('/', 'LocalizationController@index'); //Route::get('/', 'LocalizationController@index');
Route::get( Route::get(
'setlocale/{lang}', 'setlocale/{lang}',
[ [
'as' => 'setlocale', //name() 'as' => 'setlocale', //name()
'uses' => 'Frontend\LocalizationController@setLocale', 'uses' => 'Frontend\LocalizationController@setLocale',
] ]
); );
//============================================================================================================= //=============================================================================================================
//=================================================file download============================================= //=================================================file download=============================================
Route::get('file/download/{id}', [ Route::get('file/download/{id}', [
'as' => 'file.download', 'uses' => 'Settings\FileController@download', 'as' => 'file.download', 'uses' => 'Settings\FileController@download',
]); ]);
//=================================================publish datasets================================================ //=================================================publish datasets================================================
Route::group( Route::group(
[ [
'namespace' => 'Publish', 'namespace' => 'Publish',
// 'middleware' => ['permission:publish'], // 'middleware' => ['permission:publish'],
@ -202,10 +227,10 @@ Route::group(
'as' => 'review.changestate', 'uses' => 'SubmitController@changestate', 'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
]); ]);
} }
); );
//=================================================setting users==================================================== //=================================================setting users====================================================
Route::group( Route::group(
[ [
'namespace' => 'Settings\Access', 'namespace' => 'Settings\Access',
'prefix' => 'settings/access', 'prefix' => 'settings/access',
@ -249,12 +274,12 @@ Route::group(
'as' => 'role.update', 'uses' => 'RoleController@update', 'middleware' => ['permission:settings'], 'as' => 'role.update', 'uses' => 'RoleController@update', 'middleware' => ['permission:settings'],
]); ]);
} }
); );
/* /*
* CMS Pages Management============================================================================= * CMS Pages Management=============================================================================
*/ */
Route::group( Route::group(
[ [
'middleware' => ['permission:settings'], 'middleware' => ['permission:settings'],
'namespace' => 'Settings', 'namespace' => 'Settings',
@ -275,21 +300,21 @@ Route::group(
// //For DataTables // //For DataTables
Route::get('pages/get', ['uses' => 'PagesTableController@get'])->name('page.get'); Route::get('pages/get', ['uses' => 'PagesTableController@get'])->name('page.get');
} }
); );
// //============================================================================================================= // //=============================================================================================================
// //=================================================setting file============================================= // //=================================================setting file=============================================
Route::get('settings/file/download/{id}', [ Route::get('settings/file/download/{id}', [
'middleware' => ['isUserFileOwner'], 'middleware' => ['isUserFileOwner'],
'as' => 'settings.file.download', 'uses' => 'Settings\FileController@download', 'as' => 'settings.file.download', 'uses' => 'Settings\FileController@download',
]); ]);
//=================================================setting home - dashboard======================================= //=================================================setting home - dashboard=======================================
Route::get('settings/', [ Route::get('settings/', [
'as' => 'settings.dashboard', 'uses' => 'Settings\DashboardController@index', 'as' => 'settings.dashboard', 'uses' => 'Settings\DashboardController@index',
]); ]);
Route::group(['middleware' => ['permission:settings']], function () { Route::group(['middleware' => ['permission:settings']], function () {
//============================================================================================================= //=============================================================================================================
//=================================================setting dataset============================================= //=================================================setting dataset=============================================
@ -442,14 +467,14 @@ Route::group(['middleware' => ['permission:settings']], function () {
Route::patch('settings/license/update/{id}', [ Route::patch('settings/license/update/{id}', [
'as' => 'settings.license.update', 'uses' => 'Settings\LicenseController@update', 'as' => 'settings.license.update', 'uses' => 'Settings\LicenseController@update',
]); ]);
}); });
//=================================================home frontend controller======================================= //=================================================home frontend controller=======================================
/* /*
* Frontend Routes * Frontend Routes
* Namespaces indicate folder structure * Namespaces indicate folder structure
*/ */
Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () { Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
// includeRouteFiles(__DIR__.'/Frontend/'); // includeRouteFiles(__DIR__.'/Frontend/');
Route::get('/test', [ Route::get('/test', [
'as' => 'home.index', 'uses' => 'HomeController@test', 'as' => 'home.index', 'uses' => 'HomeController@test',
@ -513,27 +538,27 @@ Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
Route::get('/search', [ Route::get('/search', [
'as' => 'search.index', 'uses' => 'SolariumController@index', 'as' => 'search.index', 'uses' => 'SolariumController@index',
]); ]);
}); });
//=================================================borrow==================================================== //=================================================borrow====================================================
Route::get('borrow', [ Route::get('borrow', [
'as' => 'borrow.borrow', 'uses' => 'BorrowController@index', 'as' => 'borrow.borrow', 'uses' => 'BorrowController@index',
]); ]);
Route::post('borrow.post', [ Route::post('borrow.post', [
'as' => 'borrow.post', 'uses' => 'BorrowController@store', 'as' => 'borrow.post', 'uses' => 'BorrowController@store',
]); ]);
Route::get('laporan', [ Route::get('laporan', [
'as' => 'borrow.report', 'uses' => 'BorrowController@report', 'as' => 'borrow.report', 'uses' => 'BorrowController@report',
]); ]);
Route::get('pengembalian/{id}', [ Route::get('pengembalian/{id}', [
'as' => 'borrow.pengembalian', 'uses' => 'BorrowController@pengembalian', 'as' => 'borrow.pengembalian', 'uses' => 'BorrowController@pengembalian',
]); ]);
Route::get('perpanjang/{id}', [ Route::get('perpanjang/{id}', [
'as' => 'borrow.perpanjang', 'uses' => 'BorrowController@perpanjang', 'as' => 'borrow.perpanjang', 'uses' => 'BorrowController@perpanjang',
]); ]);
Route::get('history', [ Route::get('history', [
'as' => 'borrow.history', 'uses' => 'BorrowController@histori', 'as' => 'borrow.history', 'uses' => 'BorrowController@histori',
]); ]);
//====================================authentication=========================================================================== //====================================authentication===========================================================================
// Route::controllers([ // Route::controllers([
@ -542,9 +567,9 @@ Route::get('history', [
// ]); // ]);
// Auth::routes(); // Auth::routes();
// Authentication Routes... // Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login'); Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login'); Route::post('login', 'Auth\LoginController@login');
Route::get('logout', 'Auth\LoginController@logout')->name('logout'); Route::get('logout', 'Auth\LoginController@logout')->name('logout');
// // Registration Routes... // // Registration Routes...
// Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register'); // Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
@ -555,6 +580,13 @@ Route::get('logout', 'Auth\LoginController@logout')->name('logout');
// Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); // Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
// Route::post('password/reset', 'Auth\ResetPasswordController@reset'); // Route::post('password/reset', 'Auth\ResetPasswordController@reset');
Route::get('refresh-csrf', function () { Route::get('refresh-csrf', function () {
return csrf_token(); return csrf_token();
}); });
};
Route::group(array('domain' => $base_domain), $appRoutes);
if ($alias_domain) {
Route::group(array('domain' => $alias_domain), $appRoutes);
}

View File

@ -1,5 +1,6 @@
let mix = require('laravel-mix'); let mix = require('laravel-mix');
require('dotenv').config();
let webpack = require('webpack')
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Mix Asset Management siehe https://laravel.com/docs/5.5/mix | Mix Asset Management siehe https://laravel.com/docs/5.5/mix
@ -55,7 +56,13 @@ mix.js('resources/js/datasetPublish.js', 'public/backend/publish').vue()
// defaults. // defaults.
extensions: ['*', '.js', '.jsx', '.vue', '.ts', '.tsx'], extensions: ['*', '.js', '.jsx', '.vue', '.ts', '.tsx'],
}, },
}); plugins: [
new webpack.DefinePlugin({ // Remove this plugin if you don't plan to define any global constants
DATACITE_PREFIX: JSON.stringify(process.env.DATACITE_PREFIX),
APP_URL: JSON.stringify(process.env.APP_URL)
}),
]
});
// .options({ // .options({
// //publicPath: '../' // //publicPath: '../'
// processCssUrls: false // processCssUrls: false