Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,464 changes: 1,947 additions & 1,517 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions src/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import 'bootstrap-vue/dist/bootstrap-vue.css';
import 'bootstrap-vue/dist/bootstrap-vue-icons.min.css';
import {DateTime, Interval} from 'luxon';
import TextView from '@/_Hub/components/TextView.vue';
import {isUndefined } from 'lodash';

Vue.use(BootstrapVue);
Vue.use(BootstrapVueIcons);
Expand Down Expand Up @@ -231,10 +232,16 @@ export default defineComponent({
})
.catch(async () => {
this.isLoading = false;
await this.logout();
if (!['Login', 'Home'].includes(this.$route.name)) {
this.$router.push('/login');
const {access_token} = (await get(USER_INFO).then((res) => res.data));
if(isUndefined(access_token)){
await this.logout();
if (!['Login', 'Home'].includes(this.$route.name)) {
this.$router.push('/login');
}
}else {
this.$store.commit('setUserInfo', {mode: CONNEXION_MODE.PUBLIC});
}

});
},

Expand Down
2 changes: 0 additions & 2 deletions src/StacBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ for (let key in CONFIG) {

export default {
name: 'StacBrowser',
// router,
// store,
components: {
MLflowIframeView,
TabSectionApiStac, TabSectionReview, TextView, BTabs, BTab,
Expand Down
5 changes: 3 additions & 2 deletions src/_Hub/components/HeaderNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,11 @@ export default defineComponent({
const {auth} = this.provideConfig;
const redirect = path.substring(1);
let url = '/login';
let pathPrefix = this.pathPrefix == './' ? '' : this.pathPrefix.substring(1);
if (auth && auth === PROVIDERS.OAUTH) {
const login_url = this.login_url.endsWith('/') ? this.login_url.slice(0, this.login_url.length-1) : this.login_url;
const login_url = this.login_url;
url = redirect
? `${login_url}${this.pathPrefix.replace('.', '')}?redirect=${redirect}`
? `${login_url}${pathPrefix}?redirect=${redirect}`
: login_url;
}
return url;
Expand Down
3 changes: 2 additions & 1 deletion src/_Hub/tools/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export function removeLocalToken(){
export const CONNEXION_MODE = {
'PRIVATE_TOKEN' : 'PRIVATE_TOKEN',
'CONNECTED' : 'CONNECTED',
'DEFAULT_TOKEN' : 'DEFAULT_TOKEN'
'DEFAULT_TOKEN' : 'DEFAULT_TOKEN',
'PUBLIC' : 'PUBLIC'
};

export const PROVIDERS = {
Expand Down
3 changes: 2 additions & 1 deletion src/_Hub/views/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ export default defineComponent({
...mapState(['pathPrefix', 'provideConfig']),
connexion_url() {
const { redirect } = this.$route.query;
let pathPrefix = this.pathPrefix == './' ? '' : this.pathPrefix.substring(1);
const url = redirect
? `${this.login_url}${this.pathPrefix}?redirect=${redirect}`
? `${this.login_url}${pathPrefix}?redirect=${redirect}`
: this.login_url;
return url;
},
Expand Down
10 changes: 8 additions & 2 deletions src/components/StacLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
}
},
computed: {
...mapState(['allowExternalAccess', 'privateQueryParameters']),
...mapState(['allowExternalAccess', 'privateQueryParameters', 'pathPrefix']),
...mapGetters(['toBrowserPath', 'getRequestUrl', 'isExternalUrl']),
icon() {
if (this.stac) {
Expand Down Expand Up @@ -120,7 +120,13 @@ export default {
href = this.link.href.split('/').splice(3).join('/');
}
if (!href.startsWith('/')) {
href = '/' + href;
const {pathname} = window.location;
if(pathname !== '/' && pathname !== this.pathPrefix ){
href = pathname + href;
}else{
href = '/' + href;
}

}

// Add private query parameters to links: https://github.com/radiantearth/stac-browser/issues/142
Expand Down
11 changes: 7 additions & 4 deletions src/views/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</section>
<Assets v-if="hasAssets" :assets="assets" :context="data" :shown="shownAssets" @showAsset="showAsset" />

<Contributors />
<Contributors v-if="showContributors" />
</inside-tab>

<inside-tab :title="$t('fields.metadata.links')">
Expand All @@ -51,8 +51,8 @@ import ShowAssetMixin from '../components/ShowAssetMixin';
import {BTab, BTabs} from 'bootstrap-vue';
import {addSchemaToDocument, createItemSchema} from '../schema-org';
import STAC from '@/models/stac';
import {get} from '@/_Hub/tools/https';
import {PROXY_URL} from '@/_Hub/Endpoint';
import {get, CONNEXION_MODE} from '@/_Hub/tools/https';
import {PROXY_URL } from '@/_Hub/Endpoint';
import {ACCESS_LEVELS} from '@/utils';
import InsideTabs from '@/_Hub/components/InsideTabs.vue';
import InsideTab from '@/_Hub/components/InsideTab.vue';
Expand Down Expand Up @@ -96,13 +96,16 @@ export default {
};
},
computed: {
...mapState(['data', 'url', 'uiLanguage']),
...mapState(['data', 'url', 'uiLanguage', 'auth']),
...mapGetters(['additionalLinks', 'collectionLink', 'parentLink']),
canViewMap() {
if (this.data instanceof STAC) {
return this.data.getMetadata('sharinghub:map-viewer') === 'enable' && !!this.data.bbox;
}
return false;
},
showContributors() {
return this.auth?.mode !== CONNEXION_MODE.PUBLIC;
}
},
watch: {
Expand Down