kopia lustrzana https://github.com/manuelkasper/sotlas-frontend
Make api and images URL configurable via environment variables
rodzic
d21213376c
commit
2698ec4284
|
@ -0,0 +1,4 @@
|
||||||
|
VUE_APP_API_URL="https://api.sotl.as"
|
||||||
|
VUE_APP_WSS_URL="wss://api.sotl.as"
|
||||||
|
VUE_APP_PHOTOS_URL="https://images.sotl.as/photos"
|
||||||
|
VUE_APP_PHOTOS_ORIGINAL_URL="https://sotlas-photos.s3.eu-central-003.backblazeb2.com/original"
|
|
@ -154,7 +154,7 @@ export default {
|
||||||
if (matches) {
|
if (matches) {
|
||||||
this.summitCode = (matches[1] + '/' + matches[2] + '-' + matches[3]).toUpperCase()
|
this.summitCode = (matches[1] + '/' + matches[2] + '-' + matches[3]).toUpperCase()
|
||||||
this.summitLoading = true
|
this.summitLoading = true
|
||||||
axios.get('https://api.sotl.as/summits/' + this.summitCode)
|
axios.get(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.summitLoading = false
|
this.summitLoading = false
|
||||||
this.summitInvalid = false
|
this.summitInvalid = false
|
||||||
|
|
|
@ -141,7 +141,7 @@ export default {
|
||||||
if (matches) {
|
if (matches) {
|
||||||
this.summitCode = (matches[1] + '/' + matches[2] + '-' + matches[3]).toUpperCase()
|
this.summitCode = (matches[1] + '/' + matches[2] + '-' + matches[3]).toUpperCase()
|
||||||
this.summitLoading = true
|
this.summitLoading = true
|
||||||
axios.get('https://api.sotl.as/summits/' + this.summitCode)
|
axios.get(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.summitLoading = false
|
this.summitLoading = false
|
||||||
this.summitInvalid = false
|
this.summitInvalid = false
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
navigator.geolocation.getCurrentPosition(
|
navigator.geolocation.getCurrentPosition(
|
||||||
position => {
|
position => {
|
||||||
axios.get('https://api.sotl.as/summits/near', { params: { lat: position.coords.latitude, lon: position.coords.longitude, limit: 5, maxDistance: 100000 } })
|
axios.get(process.env.VUE_APP_API_URL + '/summits/near', { params: { lat: position.coords.latitude, lon: position.coords.longitude, limit: 5, maxDistance: 100000 } })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.length === 0) {
|
if (response.data.length === 0) {
|
||||||
alert('No summits within 100 km.')
|
alert('No summits within 100 km.')
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadSolarData () {
|
loadSolarData () {
|
||||||
axios.get('https://api.sotl.as/solardata/latest')
|
axios.get(process.env.VUE_APP_API_URL + '/solardata/latest')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.latest = response.data
|
this.latest = response.data
|
||||||
})
|
})
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
if (!localStorage.getItem('swisstopoInfoShown')) {
|
if (!localStorage.getItem('swisstopoInfoShown')) {
|
||||||
// Check if we are in Switzerland
|
// Check if we are in Switzerland
|
||||||
axios.get('https://api.sotl.as/my_country')
|
axios.get(process.env.VUE_APP_API_URL + '/my_country')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.country === 'CH') {
|
if (response.data.country === 'CH') {
|
||||||
this.active = true
|
this.active = true
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default {
|
||||||
mixins: [ssoauth],
|
mixins: [ssoauth],
|
||||||
methods: {
|
methods: {
|
||||||
loadActivations (callsign) {
|
loadActivations (callsign) {
|
||||||
return axios.get('https://api.sotl.as/activations/' + callsign)
|
return axios.get(process.env.VUE_APP_API_URL + '/activations/' + callsign)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
return response.data
|
return response.data
|
||||||
})
|
})
|
||||||
|
@ -13,20 +13,20 @@ export default {
|
||||||
uploadPhoto (summitCode, file, progress, cancelToken) {
|
uploadPhoto (summitCode, file, progress, cancelToken) {
|
||||||
let formData = new FormData()
|
let formData = new FormData()
|
||||||
formData.append('photo', file)
|
formData.append('photo', file)
|
||||||
return this.axiosAuth.post('https://api.sotl.as/photos/summits/' + summitCode + '/upload', formData, {
|
return this.axiosAuth.post(process.env.VUE_APP_API_URL + '/photos/summits/' + summitCode + '/upload', formData, {
|
||||||
headers: { 'Content-Type': 'multipart/form-data' },
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
onUploadProgress: progress,
|
onUploadProgress: progress,
|
||||||
cancelToken
|
cancelToken
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deletePhoto (summitCode, filename) {
|
deletePhoto (summitCode, filename) {
|
||||||
return this.axiosAuth.delete('https://api.sotl.as/photos/summits/' + summitCode + '/' + filename)
|
return this.axiosAuth.delete(process.env.VUE_APP_API_URL + '/photos/summits/' + summitCode + '/' + filename)
|
||||||
},
|
},
|
||||||
editPhoto (summitCode, filename, data) {
|
editPhoto (summitCode, filename, data) {
|
||||||
return this.axiosAuth.post('https://api.sotl.as/photos/summits/' + summitCode + '/' + filename, data)
|
return this.axiosAuth.post(process.env.VUE_APP_API_URL + '/photos/summits/' + summitCode + '/' + filename, data)
|
||||||
},
|
},
|
||||||
reorderPhotos (summitCode, filenames) {
|
reorderPhotos (summitCode, filenames) {
|
||||||
return this.axiosAuth.post('https://api.sotl.as/photos/summits/' + summitCode + '/reorder', { filenames })
|
return this.axiosAuth.post(process.env.VUE_APP_API_URL + '/photos/summits/' + summitCode + '/reorder', { filenames })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default {
|
||||||
if (mapServerOverride && mapServerOverride !== 'test') {
|
if (mapServerOverride && mapServerOverride !== 'test') {
|
||||||
this.mapServer = mapServerOverride
|
this.mapServer = mapServerOverride
|
||||||
} else {
|
} else {
|
||||||
axios.get('https://api.sotl.as/map_server')
|
axios.get(process.env.VUE_APP_API_URL + '/map_server')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.mapServer) {
|
if (response.data.mapServer) {
|
||||||
this.mapServer = response.data.mapServer
|
this.mapServer = response.data.mapServer
|
||||||
|
|
|
@ -2,9 +2,9 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
photoSrc (photo, size) {
|
photoSrc (photo, size) {
|
||||||
if (size === 'original') {
|
if (size === 'original') {
|
||||||
return 'https://sotlas-photos.s3.eu-central-003.backblazeb2.com/original/' + photo.filename
|
return process.env.VUE_APP_PHOTOS_ORIGINAL_URL + '/' + photo.filename
|
||||||
} else {
|
} else {
|
||||||
return 'https://images.sotl.as/photos/' + size + '/' + photo.filename.substring(0, 2) + '/' + photo.filename
|
return process.env.VUE_APP_PHOTOS_URL + '/' + size + '/' + photo.filename.substring(0, 2) + '/' + photo.filename
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default {
|
||||||
mixins: [ssoauth],
|
mixins: [ssoauth],
|
||||||
methods: {
|
methods: {
|
||||||
loadActivations (callsign) {
|
loadActivations (callsign) {
|
||||||
return axios.get('https://api.sotl.as/activations/' + callsign)
|
return axios.get(process.env.VUE_APP_API_URL + '/activations/' + callsign)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
return response.data
|
return response.data
|
||||||
})
|
})
|
||||||
|
|
|
@ -200,7 +200,7 @@ function loadAlerts (noCache) {
|
||||||
if (noCache) {
|
if (noCache) {
|
||||||
params.noCache = 1
|
params.noCache = 1
|
||||||
}
|
}
|
||||||
axios.get('https://api.sotl.as/alerts', { params })
|
axios.get(process.env.VUE_APP_API_URL + '/alerts', { params })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
store.commit('setAlerts', response.data)
|
store.commit('setAlerts', response.data)
|
||||||
})
|
})
|
||||||
|
@ -209,7 +209,7 @@ function loadAlerts (noCache) {
|
||||||
loadAlerts(false)
|
loadAlerts(false)
|
||||||
setInterval(loadAlerts, ALERT_UPDATE_INTERVAL)
|
setInterval(loadAlerts, ALERT_UPDATE_INTERVAL)
|
||||||
|
|
||||||
Vue.use(VueNativeSock, 'wss://api.sotl.as/ws', {
|
Vue.use(VueNativeSock, process.env.VUE_APP_WSS_URL + '/ws', {
|
||||||
format: 'json',
|
format: 'json',
|
||||||
store,
|
store,
|
||||||
reconnection: true,
|
reconnection: true,
|
||||||
|
|
|
@ -340,7 +340,7 @@ export default {
|
||||||
this.databaseError = false
|
this.databaseError = false
|
||||||
|
|
||||||
let loads = []
|
let loads = []
|
||||||
axios.get('https://api.sotl.as/activators/' + this.callsign)
|
axios.get(process.env.VUE_APP_API_URL + '/activators/' + this.callsign)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response) {
|
if (response) {
|
||||||
this.activator = response.data
|
this.activator = response.data
|
||||||
|
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
loadData () {
|
loadData () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
axios.get('https://api.sotl.as/activators/search', { params: { q: this.filter, skip: (this.curPage - 1) * this.perPage, limit: this.perPage, sort: this.sortField, sortDirection: this.sortDirection } })
|
axios.get(process.env.VUE_APP_API_URL + '/activators/search', { params: { q: this.filter, skip: (this.curPage - 1) * this.perPage, limit: this.perPage, sort: this.sortField, sortDirection: this.sortDirection } })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.activators = response.data.activators
|
this.activators = response.data.activators
|
||||||
this.total = response.data.total
|
this.total = response.data.total
|
||||||
|
|
|
@ -79,7 +79,7 @@ export default {
|
||||||
},
|
},
|
||||||
loadAssociation () {
|
loadAssociation () {
|
||||||
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
||||||
axios.get('https://api.sotl.as/associations/' + this.associationCode)
|
axios.get(process.env.VUE_APP_API_URL + '/associations/' + this.associationCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.association = response.data
|
this.association = response.data
|
||||||
document.title = this.association.name + ' (' + this.associationCode + ') - SOTLAS'
|
document.title = this.association.name + ' (' + this.associationCode + ') - SOTLAS'
|
||||||
|
@ -104,7 +104,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
exportUrlPrefix () {
|
exportUrlPrefix () {
|
||||||
return `https://api.sotl.as/geoexport/associations/${this.associationCode}`
|
return process.env.VUE_APP_API_URL + '/geoexport/associations/' + this.associationCode
|
||||||
},
|
},
|
||||||
myActivationsPerRegion () {
|
myActivationsPerRegion () {
|
||||||
if (!this.$store.state.myActivatedSummits) {
|
if (!this.$store.state.myActivatedSummits) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
document.title = 'Associations - SOTLAS'
|
document.title = 'Associations - SOTLAS'
|
||||||
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
||||||
axios.get('https://api.sotl.as/associations/all')
|
axios.get(process.env.VUE_APP_API_URL + '/associations/all')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.associations = response.data
|
this.associations = response.data
|
||||||
this.loadingComponent.close()
|
this.loadingComponent.close()
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
this.showMap = true
|
this.showMap = true
|
||||||
} else {
|
} else {
|
||||||
axios.get('https://api.sotl.as/my_coordinates')
|
axios.get(process.env.VUE_APP_API_URL + '/my_coordinates')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.latitude && response.data.longitude) {
|
if (response.data.latitude && response.data.longitude) {
|
||||||
this.center = [response.data.longitude, response.data.latitude]
|
this.center = [response.data.longitude, response.data.latitude]
|
||||||
|
@ -346,7 +346,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchSummit (summitCode) {
|
fetchSummit (summitCode) {
|
||||||
return axios.get('https://api.sotl.as/summits/' + summitCode)
|
return axios.get(process.env.VUE_APP_API_URL + '/summits/' + summitCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
let summit = response.data
|
let summit = response.data
|
||||||
summit.photo = null
|
summit.photo = null
|
||||||
|
@ -354,7 +354,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchAssociation (associationCode) {
|
fetchAssociation (associationCode) {
|
||||||
return axios.get('https://api.sotl.as/associations/' + associationCode)
|
return axios.get(process.env.VUE_APP_API_URL + '/associations/' + associationCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
return response.data
|
return response.data
|
||||||
})
|
})
|
||||||
|
|
|
@ -64,7 +64,7 @@ export default {
|
||||||
if (this.selectedAssociations.length > 0) {
|
if (this.selectedAssociations.length > 0) {
|
||||||
associations = this.selectedAssociations.join('|')
|
associations = this.selectedAssociations.join('|')
|
||||||
}
|
}
|
||||||
axios.get('https://api.sotl.as/summits/recent_photos/' + associations + '/' + this.days, { params: recentPhotosParams })
|
axios.get(process.env.VUE_APP_API_URL + '/summits/recent_photos/' + associations + '/' + this.days, { params: recentPhotosParams })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.loadingComponent.close()
|
this.loadingComponent.close()
|
||||||
this.summits = response.data.slice(0, -1)
|
this.summits = response.data.slice(0, -1)
|
||||||
|
@ -72,7 +72,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadAssociations () {
|
loadAssociations () {
|
||||||
axios.get('https://api.sotl.as/associations/all')
|
axios.get(process.env.VUE_APP_API_URL + '/associations/all')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.associations = response.data
|
this.associations = response.data
|
||||||
})
|
})
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
exportUrlPrefix () {
|
exportUrlPrefix () {
|
||||||
return `https://api.sotl.as/geoexport/regions/${this.regionCode}`
|
return process.env.VUE_APP_API_URL + '/geoexport/regions/' + this.regionCode
|
||||||
},
|
},
|
||||||
exportUrlParams () {
|
exportUrlParams () {
|
||||||
return (this.showInactive ? { inactive: 1 } : {})
|
return (this.showInactive ? { inactive: 1 } : {})
|
||||||
|
@ -125,7 +125,7 @@ export default {
|
||||||
loadRegion () {
|
loadRegion () {
|
||||||
let loads = []
|
let loads = []
|
||||||
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
||||||
loads.push(axios.get('https://api.sotl.as/associations/' + this.associationCode)
|
loads.push(axios.get(process.env.VUE_APP_API_URL + '/associations/' + this.associationCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.association = response.data
|
this.association = response.data
|
||||||
document.title = this.region.name + ' (' + this.associationCode + '/' + this.region.code + ') - SOTLAS'
|
document.title = this.region.name + ' (' + this.associationCode + '/' + this.region.code + ') - SOTLAS'
|
||||||
|
@ -136,7 +136,7 @@ export default {
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
loads.push(axios.get('https://api.sotl.as/regions/' + this.regionCode)
|
loads.push(axios.get(process.env.VUE_APP_API_URL + '/regions/' + this.regionCode)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
let now = moment()
|
let now = moment()
|
||||||
if (response.data.length === 0) {
|
if (response.data.length === 0) {
|
||||||
|
|
|
@ -78,12 +78,12 @@ export default {
|
||||||
let loads = []
|
let loads = []
|
||||||
let q = this.$route.query.q.trim()
|
let q = this.$route.query.q.trim()
|
||||||
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
this.loadingComponent = this.$buefy.loading.open({ canCancel: true })
|
||||||
loads.push(axios.get('https://api.sotl.as/activators/search', { params: { q, limit: this.limit } })
|
loads.push(axios.get(process.env.VUE_APP_API_URL + '/activators/search', { params: { q, limit: this.limit } })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.activators = response.data.activators
|
this.activators = response.data.activators
|
||||||
}))
|
}))
|
||||||
|
|
||||||
loads.push(axios.get('https://api.sotl.as/summits/search', { params: { q, limit: this.limit } })
|
loads.push(axios.get(process.env.VUE_APP_API_URL + '/summits/search', { params: { q, limit: this.limit } })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
let now = moment()
|
let now = moment()
|
||||||
response.data.forEach(summit => {
|
response.data.forEach(summit => {
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
loadHistory () {
|
loadHistory () {
|
||||||
// Fetch data from last 30 days
|
// Fetch data from last 30 days
|
||||||
axios.get('https://api.sotl.as/solardata/history/720')
|
axios.get(process.env.VUE_APP_API_URL + '/solardata/history/720')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.loadingComponent.close()
|
this.loadingComponent.close()
|
||||||
|
|
||||||
|
|
|
@ -344,10 +344,10 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a dummy POST to the summit URL to invalidate the browser's cache for future page loads
|
// Make a dummy POST to the summit URL to invalidate the browser's cache for future page loads
|
||||||
axios.post('https://api.sotl.as/summits/' + this.summitCode)
|
axios.post(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
loads.push(axios.get('https://api.sotl.as/summits/' + this.summitCode, options)
|
loads.push(axios.get(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode, options)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.summit = response.data
|
this.summit = response.data
|
||||||
document.title = this.summit.name + ' (' + this.summit.code + ') - SOTLAS'
|
document.title = this.summit.name + ' (' + this.summit.code + ') - SOTLAS'
|
||||||
|
@ -358,7 +358,7 @@ export default {
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
loads.push(axios.get('https://api.sotl.as/associations/' + this.summitCode.substr(0, this.summitCode.indexOf('/')))
|
loads.push(axios.get(process.env.VUE_APP_API_URL + '/associations/' + this.summitCode.substr(0, this.summitCode.indexOf('/')))
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.association = response.data
|
this.association = response.data
|
||||||
}))
|
}))
|
||||||
|
@ -397,9 +397,9 @@ export default {
|
||||||
this.loadingComponent = this.$buefy.loading.open({ canCancel: false })
|
this.loadingComponent = this.$buefy.loading.open({ canCancel: false })
|
||||||
|
|
||||||
// Make a dummy POST to the summit URL to invalidate the browser's cache for future page loads
|
// Make a dummy POST to the summit URL to invalidate the browser's cache for future page loads
|
||||||
axios.post('https://api.sotl.as/summits/' + this.summitCode)
|
axios.post(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode)
|
||||||
|
|
||||||
axios.get('https://api.sotl.as/summits/' + this.summitCode, { params: { t: new Date().getTime() } })
|
axios.get(process.env.VUE_APP_API_URL + '/summits/' + this.summitCode, { params: { t: new Date().getTime() } })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.summit = response.data
|
this.summit = response.data
|
||||||
})
|
})
|
||||||
|
|
Ładowanie…
Reference in New Issue