diff --git a/package-lock.json b/package-lock.json
index f241cf88..9335ba5f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "freetube",
- "version": "0.9.0",
+ "version": "0.9.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -8552,7 +8552,7 @@
},
"humanize-plus": {
"version": "1.8.2",
- "resolved": "https://registry.npmjs.org/humanize-plus/-/humanize-plus-1.8.2.tgz",
+ "resolved": "http://registry.npmjs.org/humanize-plus/-/humanize-plus-1.8.2.tgz",
"integrity": "sha1-pls0RZrWNnrbs3B6gqPJ+RYWcDA=",
"dev": true
},
@@ -13899,7 +13899,7 @@
},
"safe-regex": {
"version": "1.1.0",
- "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
+ "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true,
"requires": {
@@ -15070,7 +15070,7 @@
},
"strip-eof": {
"version": "1.0.0",
- "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+ "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
"dev": true
},
diff --git a/src/renderer/components/general-settings/general-settings.js b/src/renderer/components/general-settings/general-settings.js
index 1b3a06eb..6019ceb3 100644
--- a/src/renderer/components/general-settings/general-settings.js
+++ b/src/renderer/components/general-settings/general-settings.js
@@ -1,5 +1,6 @@
import Vue from 'vue'
import $ from 'jquery'
+import FS from 'fs'
import { mapActions } from 'vuex'
import FtCard from '../ft-card/ft-card.vue'
import FtSelect from '../ft-select/ft-select.vue'
@@ -24,6 +25,8 @@ export default Vue.extend({
instanceNames: [],
instanceValues: [],
currentLocale: '',
+ currentGeoLocation: '',
+ geoLocationArray: [],
backendValues: [
'invidious',
'local'
@@ -535,6 +538,9 @@ export default Vue.extend({
}
},
computed: {
+ isDev: function () {
+ return process.env.NODE_ENV === 'development'
+ },
invidiousInstance: function () {
return this.$store.getters.getInvidiousInstance
},
@@ -584,6 +590,12 @@ export default Vue.extend({
return names
},
+ geoLocationOptions: function () {
+ return this.geoLocationArray.map((entry) => { return entry.code })
+ },
+ geoLocationNames: function () {
+ return this.geoLocationArray.map((entry) => { return entry.name })
+ },
backendNames: function () {
return [
@@ -639,6 +651,8 @@ export default Vue.extend({
this.updateInvidiousInstanceBounce = debounce(this.updateInvidiousInstance, 500)
this.currentLocale = this.$i18n.locale
+ this.currentGeoLocation = this.$i18n.geoLocation
+ this.updateGeoLocationNames(this.currentLocale)
},
beforeDestroy: function () {
if (this.invidiousInstance === '') {
@@ -664,6 +678,26 @@ export default Vue.extend({
this.$i18n.locale = locale
this.currentLocale = locale
localStorage.setItem('locale', locale)
+ this.updateGeoLocationNames(locale)
+ },
+
+ updateGeoLocation: function (location) {
+ this.$i18n.geoLocation = location
+ this.currentGeoLocation = location
+ localStorage.setItem('geoLocation', location)
+ },
+
+ updateGeoLocationNames: function (locale) {
+ let fileData
+ const fileLocation = this.isDev ? '.' : `${__dirname}`
+ if (FS.existsSync(`${fileLocation}/static/geolocations/${locale}`)) {
+ fileData = FS.readFileSync(`${fileLocation}/static/geolocations/${locale}/countries.json`)
+ } else {
+ fileData = FS.readFileSync(`${fileLocation}/static/geolocations/en-US/countries.json`)
+ }
+ const countries = JSON.parse(fileData).map((entry) => { return { id: entry.id, name: entry.name, code: entry.alpha2 } })
+ countries.sort((a, b) => { return a.id - b.id })
+ this.geoLocationArray = countries
},
...mapActions([
diff --git a/src/renderer/components/general-settings/general-settings.vue b/src/renderer/components/general-settings/general-settings.vue
index 81e9d72e..4433a706 100644
--- a/src/renderer/components/general-settings/general-settings.vue
+++ b/src/renderer/components/general-settings/general-settings.vue
@@ -85,6 +85,13 @@
:select-values="localeOptions"
@change="updateLocale"
/>
+
{
+ console.log(localStorage.geoLocation)
+ ytrend.scrape_trending_page(localStorage.geoLocation.toUpperCase()).then((result) => {
const returnData = result.filter((item) => {
return item.type === 'video' || item.type === 'channel' || item.type === 'playlist'
})