2020-02-21 20:40:46 +00:00
|
|
|
import Vue from 'vue'
|
2020-05-28 02:48:41 +00:00
|
|
|
import $ from 'jquery'
|
2020-02-27 03:10:56 +00:00
|
|
|
import { mapActions } from 'vuex'
|
2020-02-21 20:40:46 +00:00
|
|
|
import FtCard from '../ft-card/ft-card.vue'
|
|
|
|
import FtSelect from '../ft-select/ft-select.vue'
|
2020-06-02 02:42:29 +00:00
|
|
|
import FtInput from '../ft-input/ft-input.vue'
|
2020-02-21 20:40:46 +00:00
|
|
|
import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue'
|
|
|
|
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
|
|
|
|
|
2020-06-02 02:42:29 +00:00
|
|
|
import debounce from 'lodash.debounce'
|
|
|
|
|
2020-02-21 20:40:46 +00:00
|
|
|
export default Vue.extend({
|
|
|
|
name: 'GeneralSettings',
|
|
|
|
components: {
|
|
|
|
'ft-card': FtCard,
|
|
|
|
'ft-select': FtSelect,
|
2020-06-02 02:42:29 +00:00
|
|
|
'ft-input': FtInput,
|
2020-02-21 20:40:46 +00:00
|
|
|
'ft-toggle-switch': FtToggleSwitch,
|
|
|
|
'ft-flex-box': FtFlexBox
|
|
|
|
},
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
title: 'General Settings',
|
2020-05-28 02:48:41 +00:00
|
|
|
showInvidiousInstances: false,
|
|
|
|
instanceNames: [],
|
|
|
|
instanceValues: [],
|
2020-02-21 20:40:46 +00:00
|
|
|
backendNames: [
|
|
|
|
'Invidious API',
|
|
|
|
'Local API'
|
|
|
|
],
|
|
|
|
backendValues: [
|
|
|
|
'invidious',
|
|
|
|
'local'
|
|
|
|
],
|
|
|
|
defaultPageNames: [
|
|
|
|
'Subscriptions',
|
|
|
|
'Trending',
|
|
|
|
'Most Popular',
|
|
|
|
'Playlists',
|
|
|
|
'History'
|
|
|
|
],
|
|
|
|
defaultPageValues: [
|
|
|
|
'subscriptions',
|
|
|
|
'trending',
|
|
|
|
'mostPopular',
|
|
|
|
'playlists',
|
|
|
|
'history'
|
|
|
|
],
|
|
|
|
viewTypeNames: [
|
|
|
|
'Grid',
|
|
|
|
'List'
|
|
|
|
],
|
|
|
|
viewTypeValues: [
|
|
|
|
'grid',
|
|
|
|
'list'
|
|
|
|
],
|
2020-02-27 03:10:56 +00:00
|
|
|
thumbnailTypeNames: [
|
|
|
|
'Default',
|
|
|
|
'Beginning',
|
|
|
|
'Middle',
|
|
|
|
'End'
|
|
|
|
],
|
|
|
|
thumbnailTypeValues: [
|
|
|
|
'',
|
|
|
|
'start',
|
|
|
|
'middle',
|
|
|
|
'end'
|
|
|
|
],
|
2020-02-21 20:40:46 +00:00
|
|
|
regionNames: [
|
|
|
|
'Afghanistan',
|
|
|
|
'Albania',
|
|
|
|
'Algeria',
|
|
|
|
'American Samoa',
|
|
|
|
'Andorra',
|
|
|
|
'Angola',
|
|
|
|
'Antarctica',
|
|
|
|
'Antigua And Barbuda',
|
|
|
|
'Argentina',
|
|
|
|
'Armenia',
|
|
|
|
'Aruba',
|
|
|
|
'Australia',
|
|
|
|
'Austria',
|
|
|
|
'Azerbaijan',
|
|
|
|
'Bahamas',
|
|
|
|
'Bahrain',
|
|
|
|
'Bangladesh',
|
|
|
|
'Barbados',
|
|
|
|
'Belarus',
|
|
|
|
'Belgium',
|
|
|
|
'Belize',
|
|
|
|
'Benin',
|
|
|
|
'Bermuda',
|
|
|
|
'Bhutan',
|
|
|
|
'Bolivia',
|
|
|
|
'Bosnia And Herzegovina',
|
|
|
|
'Botswana',
|
|
|
|
'Bouvet Island',
|
|
|
|
'Brazil',
|
|
|
|
'British Indian Ocean Territory',
|
|
|
|
'Brunei Darussalam',
|
|
|
|
'Bulgaria',
|
|
|
|
'Burkina Faso',
|
|
|
|
'Burundi',
|
|
|
|
'Cambodia',
|
|
|
|
'Cameroon',
|
|
|
|
'Canada',
|
|
|
|
'Cape Verde',
|
|
|
|
'Cayman Islands',
|
|
|
|
'Central African Republic',
|
|
|
|
'Chad',
|
|
|
|
'Chile',
|
|
|
|
'China',
|
|
|
|
'Christmas Island',
|
|
|
|
'Cocos (Keeling) Islands',
|
|
|
|
'Colombia',
|
|
|
|
'Comoros',
|
|
|
|
'Congo',
|
|
|
|
'Congo, The Democratic Republic Of The',
|
|
|
|
'Cook Islands',
|
|
|
|
'Costa Rica',
|
|
|
|
"Cote D'Ivoire",
|
|
|
|
'Croatia',
|
|
|
|
'Cuba',
|
|
|
|
'Cyprus',
|
|
|
|
'Czech Republic',
|
|
|
|
'Denmark',
|
|
|
|
'Djibouti',
|
|
|
|
'Dominica',
|
|
|
|
'Dominican Republic',
|
|
|
|
'Ecuador',
|
|
|
|
'Egypt',
|
|
|
|
'El Salvador',
|
|
|
|
'Equatorial Guinea',
|
|
|
|
'Eritrea',
|
|
|
|
'Estonia',
|
|
|
|
'Ethiopia',
|
|
|
|
'Falkland Islands (Malvinas)',
|
|
|
|
'Faroe Islands',
|
|
|
|
'Fiji',
|
|
|
|
'Finland',
|
|
|
|
'France',
|
|
|
|
'French Guiana',
|
|
|
|
'French Polynesia',
|
|
|
|
'French Southern Territories',
|
|
|
|
'Gabon',
|
|
|
|
'Gambia',
|
|
|
|
'Georgia',
|
|
|
|
'Germany',
|
|
|
|
'Ghana',
|
|
|
|
'Gibraltar',
|
|
|
|
'Greece',
|
|
|
|
'Greenland',
|
|
|
|
'Grenada',
|
|
|
|
'Guadeloupe',
|
|
|
|
'Guam',
|
|
|
|
'Guatamala',
|
|
|
|
'Guinea',
|
|
|
|
'Guinea-Bissau',
|
|
|
|
'Guyana',
|
|
|
|
'Haiti',
|
|
|
|
'Heard Island And McDonald Islands',
|
|
|
|
'Honduras',
|
|
|
|
'Hong Kong',
|
|
|
|
'Hungary',
|
|
|
|
'Iceland',
|
|
|
|
'India',
|
|
|
|
'Indonesia',
|
|
|
|
'Iran, Islamic Republic Of',
|
|
|
|
'Iraq',
|
|
|
|
'Ireland',
|
|
|
|
'Israel',
|
|
|
|
'Italy',
|
|
|
|
'Jamaica',
|
|
|
|
'Japan',
|
|
|
|
'Jordan',
|
|
|
|
'Kazakhstan',
|
|
|
|
'Kenya',
|
|
|
|
'Kiribati',
|
|
|
|
"Korea, Democratic People's Republic Of",
|
|
|
|
'Korea, Republic Of',
|
|
|
|
'Kuwait',
|
|
|
|
'Kyrgyzstan',
|
|
|
|
"Lao People's Democratic Republic (LAOS)",
|
|
|
|
'Latvia',
|
|
|
|
'Lebonon',
|
|
|
|
'Lesotho',
|
|
|
|
'Liberia',
|
|
|
|
'Libyan Arab Jamahiriya',
|
|
|
|
'Liechtenstein',
|
|
|
|
'Lithuania',
|
|
|
|
'Luxembourg',
|
|
|
|
'Macao',
|
|
|
|
'Macedonia, The Former Yugoslav Republic Of',
|
|
|
|
'Madagascar',
|
|
|
|
'Malawi',
|
|
|
|
'Malaysia',
|
|
|
|
'Maldives',
|
|
|
|
'Mali',
|
|
|
|
'Malta',
|
|
|
|
'Marshall Islands',
|
|
|
|
'Martinique',
|
|
|
|
'Mauritania',
|
|
|
|
'Mauritius',
|
|
|
|
'Mayotte',
|
|
|
|
'Mexico',
|
|
|
|
'Micronesia, Federated States Of',
|
|
|
|
'Moldova, Republic Of',
|
|
|
|
'Monaco',
|
|
|
|
'Mongolia',
|
|
|
|
'Montenegro',
|
|
|
|
'Montserrat',
|
|
|
|
'Morocco',
|
|
|
|
'Mozambique',
|
|
|
|
'Myanmar',
|
|
|
|
'Namibia',
|
|
|
|
'Nauru',
|
|
|
|
'Nepal',
|
|
|
|
'Netherlands',
|
|
|
|
'Netherlands Antilles',
|
|
|
|
'New Caledonia',
|
|
|
|
'New Zealand',
|
|
|
|
'Nicaragua',
|
|
|
|
'Niger',
|
|
|
|
'Nigeria',
|
|
|
|
'Niue',
|
|
|
|
'Norfolk Island',
|
|
|
|
'Northern Mariana Islands',
|
|
|
|
'Norway',
|
|
|
|
'Oman',
|
|
|
|
'Pakistan',
|
|
|
|
'Palau',
|
|
|
|
'Palestinian Territory, Occupied',
|
|
|
|
'Panama',
|
|
|
|
'Papua New Guinea',
|
|
|
|
'Paraguay',
|
|
|
|
'Peru',
|
|
|
|
'Philippines',
|
|
|
|
'Pitcair',
|
|
|
|
'Poland',
|
|
|
|
'Portugal',
|
|
|
|
'Puerto Rico',
|
|
|
|
'Qatar',
|
|
|
|
'Reunion',
|
|
|
|
'Romania',
|
|
|
|
'Russian Federation',
|
|
|
|
'Rwanda',
|
|
|
|
'Saint Helena',
|
|
|
|
'Saint Kitts And Nevis',
|
|
|
|
'Saint Lucia',
|
|
|
|
'Saint Pierre And Miquelon',
|
|
|
|
'Saint Vincent And The Grenadines',
|
|
|
|
'Samoa',
|
|
|
|
'San Marina',
|
|
|
|
'Sao Tome And Principe',
|
|
|
|
'Saudi Arabia',
|
|
|
|
'Senegal',
|
|
|
|
'Serbia',
|
|
|
|
'Seychelles',
|
|
|
|
'Sierra Leone',
|
|
|
|
'Singapore',
|
|
|
|
'Slovakia',
|
|
|
|
'Slovenia',
|
|
|
|
'Solomon Islands',
|
|
|
|
'Somalia',
|
|
|
|
'South Africa',
|
|
|
|
'South Georgia And The South Sandwich Islands',
|
|
|
|
'Spain',
|
|
|
|
'Sri Lanka',
|
|
|
|
'Sudan',
|
|
|
|
'Suriname',
|
|
|
|
'Svalbard And Jan Mayen',
|
|
|
|
'Swaziland',
|
|
|
|
'Sweden',
|
|
|
|
'Switzerland',
|
|
|
|
'Syrian Arab Republic',
|
|
|
|
'Taiwan',
|
|
|
|
'Tajikistan',
|
|
|
|
'Tanzania, United Republic Of',
|
|
|
|
'Thailand',
|
|
|
|
'Timor-Leste',
|
|
|
|
'Togo',
|
|
|
|
'Tokelau',
|
|
|
|
'Tonga',
|
|
|
|
'Trinidad And Tobago',
|
|
|
|
'Tunisia',
|
|
|
|
'Turkey',
|
|
|
|
'Turkenistan',
|
|
|
|
'Turks And Caicos Islands',
|
|
|
|
'Tuvalu',
|
|
|
|
'Uganda',
|
|
|
|
'Ukraine',
|
|
|
|
'United Arab Emirates',
|
|
|
|
'United Kingdom',
|
|
|
|
'United States',
|
|
|
|
'United States Minor Outlying Islands',
|
|
|
|
'Uruguay',
|
|
|
|
'Uzbekistan',
|
|
|
|
'Vanuatu',
|
|
|
|
'Venezuela',
|
|
|
|
'Viet Nam',
|
|
|
|
'Virgin Islands, British',
|
|
|
|
'Virgin Islands, U.S.',
|
|
|
|
'Wallis And Futuna',
|
|
|
|
'Western Sahara',
|
|
|
|
'Yemen',
|
|
|
|
'Zambia',
|
|
|
|
'Zimbabwe'
|
|
|
|
],
|
|
|
|
regionValues: [
|
|
|
|
'AF',
|
|
|
|
'AL',
|
|
|
|
'DZ',
|
|
|
|
'AS',
|
|
|
|
'AD',
|
|
|
|
'AO',
|
|
|
|
'AQ',
|
|
|
|
'AG',
|
|
|
|
'AR',
|
|
|
|
'AM',
|
|
|
|
'AW',
|
|
|
|
'AU',
|
|
|
|
'AT',
|
|
|
|
'AZ',
|
|
|
|
'BS',
|
|
|
|
'BH',
|
|
|
|
'BD',
|
|
|
|
'BB',
|
|
|
|
'BY',
|
|
|
|
'BE',
|
|
|
|
'BZ',
|
|
|
|
'BJ',
|
|
|
|
'BM',
|
|
|
|
'BT',
|
|
|
|
'BO',
|
|
|
|
'BA',
|
|
|
|
'BW',
|
|
|
|
'BV',
|
|
|
|
'BR',
|
|
|
|
'IO',
|
|
|
|
'BN',
|
|
|
|
'BG',
|
|
|
|
'BF',
|
|
|
|
'BI',
|
|
|
|
'KH',
|
|
|
|
'CM',
|
|
|
|
'CA',
|
|
|
|
'CV',
|
|
|
|
'KY',
|
|
|
|
'CF',
|
|
|
|
'TD',
|
|
|
|
'CL',
|
|
|
|
'CN',
|
|
|
|
'CX',
|
|
|
|
'CC',
|
|
|
|
'CO',
|
|
|
|
'KM',
|
|
|
|
'CG',
|
|
|
|
'CD',
|
|
|
|
'CK',
|
|
|
|
'CR',
|
|
|
|
'CI',
|
|
|
|
'HR',
|
|
|
|
'CU',
|
|
|
|
'CY',
|
|
|
|
'CZ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
|
'TK',
|
|
|
|
'TO',
|
|
|
|
'TT',
|
|
|
|
'TN',
|
|
|
|
'TR',
|
|
|
|
'TM',
|
|
|
|
'TC',
|
|
|
|
'TV',
|
|
|
|
'UG',
|
|
|
|
'UA',
|
|
|
|
'AE',
|
|
|
|
'GB',
|
|
|
|
'US',
|
|
|
|
'UM',
|
|
|
|
'UY',
|
|
|
|
'UZ',
|
|
|
|
'VU',
|
|
|
|
'VE',
|
|
|
|
'VN',
|
|
|
|
'VG',
|
|
|
|
'VI',
|
|
|
|
'WF',
|
|
|
|
'EH',
|
|
|
|
'YE',
|
|
|
|
'ZM',
|
|
|
|
'ZW'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-05-28 02:48:41 +00:00
|
|
|
invidiousInstance: function () {
|
|
|
|
return this.$store.getters.getInvidiousInstance
|
|
|
|
},
|
2020-02-27 03:10:56 +00:00
|
|
|
backendFallback: function () {
|
|
|
|
return this.$store.getters.getBackendFallback
|
|
|
|
},
|
|
|
|
checkForUpdates: function () {
|
|
|
|
return this.$store.getters.getCheckForUpdates
|
|
|
|
},
|
|
|
|
backendPreference: function () {
|
|
|
|
return this.$store.getters.getBackendPreference
|
|
|
|
},
|
|
|
|
landingPage: function () {
|
|
|
|
return this.$store.getters.getLandingPage
|
|
|
|
},
|
|
|
|
region: function () {
|
|
|
|
return this.$store.getters.getRegion
|
|
|
|
},
|
|
|
|
listType: function () {
|
|
|
|
return this.$store.getters.getListType
|
|
|
|
},
|
|
|
|
thumbnailPreference: function () {
|
|
|
|
return this.$store.getters.getThumbnailPreference
|
2020-02-21 20:40:46 +00:00
|
|
|
}
|
|
|
|
},
|
2020-05-28 02:48:41 +00:00
|
|
|
mounted: function () {
|
|
|
|
const requestUrl = 'https://instances.invidio.us/instances.json'
|
|
|
|
$.getJSON(requestUrl, (response) => {
|
|
|
|
console.log(response)
|
|
|
|
const instances = response.filter((instance) => {
|
|
|
|
if (instance[0].includes('.onion') || instance[0].includes('.i2p')) {
|
|
|
|
return false
|
|
|
|
} else {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
this.instanceNames = instances.map((instance) => {
|
|
|
|
return instance[0]
|
|
|
|
})
|
|
|
|
|
|
|
|
this.instanceValues = instances.map((instance) => {
|
|
|
|
return instance[1].uri.replace(/\/$/, '')
|
|
|
|
})
|
|
|
|
|
|
|
|
this.showInvidiousInstances = true
|
|
|
|
}).fail((xhr, textStatus, error) => {
|
|
|
|
console.log(xhr)
|
|
|
|
console.log(textStatus)
|
|
|
|
console.log(requestUrl)
|
|
|
|
console.log(error)
|
|
|
|
})
|
2020-06-02 02:42:29 +00:00
|
|
|
|
|
|
|
this.updateInvidiousInstanceBounce = debounce(this.updateInvidiousInstance, 500)
|
|
|
|
},
|
|
|
|
beforeDestroy: function () {
|
|
|
|
if (this.invidiousInstance === '') {
|
|
|
|
this.updateInvidiousInstance('https://invidio.us')
|
|
|
|
}
|
2020-05-28 02:48:41 +00:00
|
|
|
},
|
2020-02-21 20:40:46 +00:00
|
|
|
methods: {
|
2020-06-02 02:42:29 +00:00
|
|
|
handleInvidiousInstanceInput: function (input) {
|
|
|
|
const invidiousInstance = input.replace(/\/$/, '')
|
|
|
|
this.updateInvidiousInstanceBounce(invidiousInstance)
|
|
|
|
},
|
|
|
|
|
2020-02-27 03:10:56 +00:00
|
|
|
...mapActions([
|
|
|
|
'updateBackendFallback',
|
|
|
|
'updateCheckForUpdates',
|
|
|
|
'updateBarColor',
|
|
|
|
'updateBackendPreference',
|
|
|
|
'updateLandingPage',
|
|
|
|
'updateRegion',
|
|
|
|
'updateListType',
|
2020-05-28 02:48:41 +00:00
|
|
|
'updateThumbnailPreference',
|
|
|
|
'updateInvidiousInstance'
|
2020-02-27 03:10:56 +00:00
|
|
|
])
|
2020-02-21 20:40:46 +00:00
|
|
|
}
|
|
|
|
})
|