- 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'),
'alias_url' => env('ALIAS_URL'),
/*
|--------------------------------------------------------------------------

5
package-lock.json generated
View File

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

View File

@ -31,6 +31,7 @@
"axios": "^0.21.1",
"datatables.net": "^1.10.21",
"datatables.net-buttons": "^1.6.3",
"dotenv": "^8.6.0",
"easytimer": "^1.1.1",
"jquery": "^3.5.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
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()
data;

View File

@ -30,17 +30,17 @@
<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 v-for="(author,index) in document.author" :key="index">{{ author }}; </span> -->
<!-- <span>'https://doi.org/' + {{ document.identifier[0] }}</span> -->
<a target="_blank" v-bind:href="'https://doi.org/' + document.identifier[0]" class="ng-binding">
{{ 'https://doi.org/' + document.identifier[0] }}
</a>
</h4>
</p>
<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 }}
</a>
</h4>

View File

@ -13,26 +13,51 @@ use Illuminate\Support\Facades\Route;
*/
//Auth::routes();
//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(
Route::get(
'setlocale/{lang}',
[
'as' => 'setlocale', //name()
'uses' => 'Frontend\LocalizationController@setLocale',
]
);
);
//=============================================================================================================
//=================================================file download=============================================
Route::get('file/download/{id}', [
Route::get('file/download/{id}', [
'as' => 'file.download', 'uses' => 'Settings\FileController@download',
]);
]);
//=================================================publish datasets================================================
Route::group(
Route::group(
[
'namespace' => 'Publish',
// 'middleware' => ['permission:publish'],
@ -202,10 +227,10 @@ Route::group(
'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
]);
}
);
);
//=================================================setting users====================================================
Route::group(
Route::group(
[
'namespace' => 'Settings\Access',
'prefix' => 'settings/access',
@ -249,12 +274,12 @@ Route::group(
'as' => 'role.update', 'uses' => 'RoleController@update', 'middleware' => ['permission:settings'],
]);
}
);
);
/*
* CMS Pages Management=============================================================================
*/
Route::group(
Route::group(
[
'middleware' => ['permission:settings'],
'namespace' => 'Settings',
@ -275,21 +300,21 @@ Route::group(
// //For DataTables
Route::get('pages/get', ['uses' => 'PagesTableController@get'])->name('page.get');
}
);
);
// //=============================================================================================================
// //=================================================setting file=============================================
Route::get('settings/file/download/{id}', [
Route::get('settings/file/download/{id}', [
'middleware' => ['isUserFileOwner'],
'as' => 'settings.file.download', 'uses' => 'Settings\FileController@download',
]);
]);
//=================================================setting home - dashboard=======================================
Route::get('settings/', [
Route::get('settings/', [
'as' => 'settings.dashboard', 'uses' => 'Settings\DashboardController@index',
]);
]);
Route::group(['middleware' => ['permission:settings']], function () {
Route::group(['middleware' => ['permission:settings']], function () {
//=============================================================================================================
//=================================================setting dataset=============================================
@ -442,14 +467,14 @@ Route::group(['middleware' => ['permission:settings']], function () {
Route::patch('settings/license/update/{id}', [
'as' => 'settings.license.update', 'uses' => 'Settings\LicenseController@update',
]);
});
});
//=================================================home frontend controller=======================================
/*
* Frontend Routes
* Namespaces indicate folder structure
*/
Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
// includeRouteFiles(__DIR__.'/Frontend/');
Route::get('/test', [
'as' => 'home.index', 'uses' => 'HomeController@test',
@ -513,27 +538,27 @@ Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
Route::get('/search', [
'as' => 'search.index', 'uses' => 'SolariumController@index',
]);
});
});
//=================================================borrow====================================================
Route::get('borrow', [
Route::get('borrow', [
'as' => 'borrow.borrow', 'uses' => 'BorrowController@index',
]);
Route::post('borrow.post', [
]);
Route::post('borrow.post', [
'as' => 'borrow.post', 'uses' => 'BorrowController@store',
]);
Route::get('laporan', [
]);
Route::get('laporan', [
'as' => 'borrow.report', 'uses' => 'BorrowController@report',
]);
Route::get('pengembalian/{id}', [
]);
Route::get('pengembalian/{id}', [
'as' => 'borrow.pengembalian', 'uses' => 'BorrowController@pengembalian',
]);
Route::get('perpanjang/{id}', [
]);
Route::get('perpanjang/{id}', [
'as' => 'borrow.perpanjang', 'uses' => 'BorrowController@perpanjang',
]);
Route::get('history', [
]);
Route::get('history', [
'as' => 'borrow.history', 'uses' => 'BorrowController@histori',
]);
]);
//====================================authentication===========================================================================
// Route::controllers([
@ -542,9 +567,9 @@ Route::get('history', [
// ]);
// Auth::routes();
// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::get('logout', 'Auth\LoginController@logout')->name('logout');
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::get('logout', 'Auth\LoginController@logout')->name('logout');
// // Registration Routes...
// 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::post('password/reset', 'Auth\ResetPasswordController@reset');
Route::get('refresh-csrf', function () {
Route::get('refresh-csrf', function () {
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');
require('dotenv').config();
let webpack = require('webpack')
/*
|--------------------------------------------------------------------------
| 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.
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({
// //publicPath: '../'
// processCssUrls: false