- 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,6 +13,31 @@ 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::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']);
@ -558,3 +583,10 @@ Route::get('logout', 'Auth\LoginController@logout')->name('logout');
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,6 +56,12 @@ 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: '../'