config: limit news param types
Limit countries, categories and languages to specific literals
This commit is contained in:
parent
d77c324fd5
commit
aeec219e84
3 changed files with 347 additions and 25 deletions
|
|
@ -169,8 +169,8 @@ export default {
|
||||||
countries: ["current"], // A list of country codes or "current" for the current location
|
countries: ["current"], // A list of country codes or "current" for the current location
|
||||||
categories: [] as string[], // A list of news categories to filter by
|
categories: [] as string[], // A list of news categories to filter by
|
||||||
languages: ["en"], // A list of languages codes to filter by
|
languages: ["en"], // A list of languages codes to filter by
|
||||||
domains: [] as string[], // A list of news domains to pull from
|
domains: [] as string[], // A list of news domains to pull from, see https://newsdata.io/news-sources for available domains
|
||||||
timezone: "", // A timezone to filter by, e.g. "America/New_York"
|
timezone: "", // A timezone to filter by, e.g. "America/New_York", see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||||
pages: 3, // Number of pages to pull (each page is 10 articles)
|
pages: 3, // Number of pages to pull (each page is 10 articles)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
336
src/config/literals.ts
Normal file
336
src/config/literals.ts
Normal file
|
|
@ -0,0 +1,336 @@
|
||||||
|
export const BAR_MODULES = [
|
||||||
|
"osIcon",
|
||||||
|
"activeWindow",
|
||||||
|
"mediaPlaying",
|
||||||
|
"brightnessSpacer",
|
||||||
|
"workspaces",
|
||||||
|
"volumeSpacer",
|
||||||
|
"tray",
|
||||||
|
"statusIcons",
|
||||||
|
"pkgUpdates",
|
||||||
|
"notifCount",
|
||||||
|
"battery",
|
||||||
|
"dateTime",
|
||||||
|
"power",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const NEWS_COUNTRIES = [
|
||||||
|
"af", // Afghanistan
|
||||||
|
"al", // Albania
|
||||||
|
"dz", // Algeria
|
||||||
|
"ad", // Andorra
|
||||||
|
"ao", // Angola
|
||||||
|
"ar", // Argentina
|
||||||
|
"am", // Armenia
|
||||||
|
"au", // Australia
|
||||||
|
"at", // Austria
|
||||||
|
"az", // Azerbaijan
|
||||||
|
"bs", // Bahamas
|
||||||
|
"bh", // Bahrain
|
||||||
|
"bd", // Bangladesh
|
||||||
|
"bb", // Barbados
|
||||||
|
"by", // Belarus
|
||||||
|
"be", // Belgium
|
||||||
|
"bz", // Belize
|
||||||
|
"bj", // Benin
|
||||||
|
"bm", // Bermuda
|
||||||
|
"bt", // Bhutan
|
||||||
|
"bo", // Bolivia
|
||||||
|
"ba", // Bosnia And Herzegovina
|
||||||
|
"bw", // Botswana
|
||||||
|
"br", // Brazil
|
||||||
|
"bn", // Brunei
|
||||||
|
"bg", // Bulgaria
|
||||||
|
"bf", // Burkina fasco
|
||||||
|
"bi", // Burundi
|
||||||
|
"kh", // Cambodia
|
||||||
|
"cm", // Cameroon
|
||||||
|
"ca", // Canada
|
||||||
|
"cv", // Cape Verde
|
||||||
|
"ky", // Cayman Islands
|
||||||
|
"cf", // Central African Republic
|
||||||
|
"td", // Chad
|
||||||
|
"cl", // Chile
|
||||||
|
"cn", // China
|
||||||
|
"co", // Colombia
|
||||||
|
"km", // Comoros
|
||||||
|
"cg", // Congo
|
||||||
|
"ck", // Cook islands
|
||||||
|
"cr", // Costa Rica
|
||||||
|
"hr", // Croatia
|
||||||
|
"cu", // Cuba
|
||||||
|
"cw", // Curaçao
|
||||||
|
"cy", // Cyprus
|
||||||
|
"cz", // Czech republic
|
||||||
|
"dk", // Denmark
|
||||||
|
"dj", // Djibouti
|
||||||
|
"dm", // Dominica
|
||||||
|
"do", // Dominican republic
|
||||||
|
"cd", // DR Congo
|
||||||
|
"ec", // Ecuador
|
||||||
|
"eg", // Egypt
|
||||||
|
"sv", // El Salvador
|
||||||
|
"gq", // Equatorial Guinea
|
||||||
|
"er", // Eritrea
|
||||||
|
"ee", // Estonia
|
||||||
|
"sz", // Eswatini
|
||||||
|
"et", // Ethiopia
|
||||||
|
"fj", // Fiji
|
||||||
|
"fi", // Finland
|
||||||
|
"fr", // France
|
||||||
|
"pf", // French polynesia
|
||||||
|
"ga", // Gabon
|
||||||
|
"gm", // Gambia
|
||||||
|
"ge", // Georgia
|
||||||
|
"de", // Germany
|
||||||
|
"gh", // Ghana
|
||||||
|
"gi", // Gibraltar
|
||||||
|
"gr", // Greece
|
||||||
|
"gd", // Grenada
|
||||||
|
"gt", // Guatemala
|
||||||
|
"gn", // Guinea
|
||||||
|
"gy", // Guyana
|
||||||
|
"ht", // Haiti
|
||||||
|
"hn", // Honduras
|
||||||
|
"hk", // Hong kong
|
||||||
|
"hu", // Hungary
|
||||||
|
"is", // Iceland
|
||||||
|
"in", // India
|
||||||
|
"id", // Indonesia
|
||||||
|
"ir", // Iran
|
||||||
|
"iq", // Iraq
|
||||||
|
"ie", // Ireland
|
||||||
|
"il", // Israel
|
||||||
|
"it", // Italy
|
||||||
|
"ci", // Ivory Coast
|
||||||
|
"jm", // Jamaica
|
||||||
|
"jp", // Japan
|
||||||
|
"je", // Jersey
|
||||||
|
"jo", // Jordan
|
||||||
|
"kz", // Kazakhstan
|
||||||
|
"ke", // Kenya
|
||||||
|
"ki", // Kiribati
|
||||||
|
"xk", // Kosovo
|
||||||
|
"kw", // Kuwait
|
||||||
|
"kg", // Kyrgyzstan
|
||||||
|
"la", // Laos
|
||||||
|
"lv", // Latvia
|
||||||
|
"lb", // Lebanon
|
||||||
|
"ls", // Lesotho
|
||||||
|
"lr", // Liberia
|
||||||
|
"ly", // Libya
|
||||||
|
"li", // Liechtenstein
|
||||||
|
"lt", // Lithuania
|
||||||
|
"lu", // Luxembourg
|
||||||
|
"mo", // Macau
|
||||||
|
"mk", // Macedonia
|
||||||
|
"mg", // Madagascar
|
||||||
|
"mw", // Malawi
|
||||||
|
"my", // Malaysia
|
||||||
|
"mv", // Maldives
|
||||||
|
"ml", // Mali
|
||||||
|
"mt", // Malta
|
||||||
|
"mh", // Marshall Islands
|
||||||
|
"mr", // Mauritania
|
||||||
|
"mu", // Mauritius
|
||||||
|
"mx", // Mexico
|
||||||
|
"fm", // Micronesia
|
||||||
|
"md", // Moldova
|
||||||
|
"mc", // Monaco
|
||||||
|
"mn", // Mongolia
|
||||||
|
"me", // Montenegro
|
||||||
|
"ma", // Morocco
|
||||||
|
"mz", // Mozambique
|
||||||
|
"mm", // Myanmar
|
||||||
|
"na", // Namibia
|
||||||
|
"nr", // Nauru
|
||||||
|
"np", // Nepal
|
||||||
|
"nl", // Netherland
|
||||||
|
"nc", // New caledonia
|
||||||
|
"nz", // New zealand
|
||||||
|
"ni", // Nicaragua
|
||||||
|
"ne", // Niger
|
||||||
|
"ng", // Nigeria
|
||||||
|
"kp", // North korea
|
||||||
|
"no", // Norway
|
||||||
|
"om", // Oman
|
||||||
|
"pk", // Pakistan
|
||||||
|
"pw", // Palau
|
||||||
|
"ps", // Palestine
|
||||||
|
"pa", // Panama
|
||||||
|
"pg", // Papua New Guinea
|
||||||
|
"py", // Paraguay
|
||||||
|
"pe", // Peru
|
||||||
|
"ph", // Philippines
|
||||||
|
"pl", // Poland
|
||||||
|
"pt", // Portugal
|
||||||
|
"pr", // Puerto rico
|
||||||
|
"qa", // Qatar
|
||||||
|
"ro", // Romania
|
||||||
|
"ru", // Russia
|
||||||
|
"rw", // Rwanda
|
||||||
|
"lc", // Saint lucia
|
||||||
|
"sx", // Saint martin(dutch)
|
||||||
|
"ws", // Samoa
|
||||||
|
"sm", // San Marino
|
||||||
|
"st", // Sao tome and principe
|
||||||
|
"sa", // Saudi arabia
|
||||||
|
"sn", // Senegal
|
||||||
|
"rs", // Serbia
|
||||||
|
"sc", // Seychelles
|
||||||
|
"sl", // Sierra Leone
|
||||||
|
"sg", // Singapore
|
||||||
|
"sk", // Slovakia
|
||||||
|
"si", // Slovenia
|
||||||
|
"sb", // Solomon Islands
|
||||||
|
"so", // Somalia
|
||||||
|
"za", // South africa
|
||||||
|
"kr", // South korea
|
||||||
|
"es", // Spain
|
||||||
|
"lk", // Sri Lanka
|
||||||
|
"sd", // Sudan
|
||||||
|
"sr", // Suriname
|
||||||
|
"se", // Sweden
|
||||||
|
"ch", // Switzerland
|
||||||
|
"sy", // Syria
|
||||||
|
"tw", // Taiwan
|
||||||
|
"tj", // Tajikistan
|
||||||
|
"tz", // Tanzania
|
||||||
|
"th", // Thailand
|
||||||
|
"tl", // Timor-Leste
|
||||||
|
"tg", // Togo
|
||||||
|
"to", // Tonga
|
||||||
|
"tt", // Trinidad and tobago
|
||||||
|
"tn", // Tunisia
|
||||||
|
"tr", // Turkey
|
||||||
|
"tm", // Turkmenistan
|
||||||
|
"tv", // Tuvalu
|
||||||
|
"ug", // Uganda
|
||||||
|
"ua", // Ukraine
|
||||||
|
"ae", // United arab emirates
|
||||||
|
"gb", // United kingdom
|
||||||
|
"us", // United states of america
|
||||||
|
"uy", // Uruguay
|
||||||
|
"uz", // Uzbekistan
|
||||||
|
"vu", // Vanuatu
|
||||||
|
"va", // Vatican
|
||||||
|
"ve", // Venezuela
|
||||||
|
"vi", // Vietnam
|
||||||
|
"vg", // Virgin Islands (British)
|
||||||
|
"wo", // World
|
||||||
|
"ye", // Yemen
|
||||||
|
"zm", // Zambia
|
||||||
|
"zw", // Zimbabwe
|
||||||
|
];
|
||||||
|
|
||||||
|
export const NEWS_CATEGORIES = [
|
||||||
|
"business",
|
||||||
|
"crime",
|
||||||
|
"domestic",
|
||||||
|
"education",
|
||||||
|
"entertainment",
|
||||||
|
"environment",
|
||||||
|
"food",
|
||||||
|
"health",
|
||||||
|
"lifestyle",
|
||||||
|
"other",
|
||||||
|
"politics",
|
||||||
|
"science",
|
||||||
|
"sports",
|
||||||
|
"technology",
|
||||||
|
"top",
|
||||||
|
"tourism",
|
||||||
|
"world",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const NEWS_LANGUAGES = [
|
||||||
|
"af", // Afrikaans
|
||||||
|
"sq", // Albanian
|
||||||
|
"am", // Amharic
|
||||||
|
"ar", // Arabic
|
||||||
|
"hy", // Armenian
|
||||||
|
"as", // Assamese
|
||||||
|
"az", // Azerbaijani
|
||||||
|
"bm", // Bambara
|
||||||
|
"eu", // Basque
|
||||||
|
"be", // Belarusian
|
||||||
|
"bn", // Bengali
|
||||||
|
"bs", // Bosnian
|
||||||
|
"bg", // Bulgarian
|
||||||
|
"my", // Burmese
|
||||||
|
"ca", // Catalan
|
||||||
|
"ckb", // Central Kurdish
|
||||||
|
"zh", // Chinese
|
||||||
|
"hr", // Croatian
|
||||||
|
"cs", // Czech
|
||||||
|
"da", // Danish
|
||||||
|
"nl", // Dutch
|
||||||
|
"en", // English
|
||||||
|
"et", // Estonian
|
||||||
|
"pi", // Filipino
|
||||||
|
"fi", // Finnish
|
||||||
|
"fr", // French
|
||||||
|
"gl", // Galician
|
||||||
|
"ka", // Georgian
|
||||||
|
"de", // German
|
||||||
|
"el", // Greek
|
||||||
|
"gu", // Gujarati
|
||||||
|
"ha", // Hausa
|
||||||
|
"he", // Hebrew
|
||||||
|
"hi", // Hindi
|
||||||
|
"hu", // Hungarian
|
||||||
|
"is", // Icelandic
|
||||||
|
"id", // Indonesian
|
||||||
|
"it", // Italian
|
||||||
|
"jp", // Japanese
|
||||||
|
"kn", // Kannada
|
||||||
|
"kz", // Kazakh
|
||||||
|
"kh", // Khmer
|
||||||
|
"rw", // Kinyarwanda
|
||||||
|
"ko", // Korean
|
||||||
|
"ku", // Kurdish
|
||||||
|
"lv", // Latvian
|
||||||
|
"lt", // Lithuanian
|
||||||
|
"lb", // Luxembourgish
|
||||||
|
"mk", // Macedonian
|
||||||
|
"ms", // Malay
|
||||||
|
"ml", // Malayalam
|
||||||
|
"mt", // Maltese
|
||||||
|
"mi", // Maori
|
||||||
|
"mr", // Marathi
|
||||||
|
"mn", // Mongolian
|
||||||
|
"ne", // Nepali
|
||||||
|
"no", // Norwegian
|
||||||
|
"or", // Oriya
|
||||||
|
"ps", // Pashto
|
||||||
|
"fa", // Persian
|
||||||
|
"pl", // Polish
|
||||||
|
"pt", // Portuguese
|
||||||
|
"pa", // Punjabi
|
||||||
|
"ro", // Romanian
|
||||||
|
"ru", // Russian
|
||||||
|
"sm", // Samoan
|
||||||
|
"sr", // Serbian
|
||||||
|
"sn", // Shona
|
||||||
|
"sd", // Sindhi
|
||||||
|
"si", // Sinhala
|
||||||
|
"sk", // Slovak
|
||||||
|
"sl", // Slovenian
|
||||||
|
"so", // Somali
|
||||||
|
"es", // Spanish
|
||||||
|
"sw", // Swahili
|
||||||
|
"sv", // Swedish
|
||||||
|
"tg", // Tajik
|
||||||
|
"ta", // Tamil
|
||||||
|
"te", // Telugu
|
||||||
|
"th", // Thai
|
||||||
|
"zht", // Traditional chinese
|
||||||
|
"tr", // Turkish
|
||||||
|
"tk", // Turkmen
|
||||||
|
"uk", // Ukrainian
|
||||||
|
"ur", // Urdu
|
||||||
|
"uz", // Uzbek
|
||||||
|
"vi", // Vietnamese
|
||||||
|
"cy", // Welsh
|
||||||
|
"zu", // Zulu
|
||||||
|
];
|
||||||
|
|
@ -1,25 +1,11 @@
|
||||||
|
import { BAR_MODULES, NEWS_CATEGORIES, NEWS_COUNTRIES, NEWS_LANGUAGES } from "./literals";
|
||||||
|
|
||||||
const BOOL = "boolean";
|
const BOOL = "boolean";
|
||||||
const STR = "string";
|
const STR = "string";
|
||||||
const NUM = "number";
|
const NUM = "number";
|
||||||
const ARR = (type: string | string[]) => `array of ${typeof type === "string" ? type : JSON.stringify(type)}`;
|
const ARR = (type: string | string[]) => `array of ${typeof type === "string" ? type : JSON.stringify(type)}`;
|
||||||
const OBJ_ARR = (shape: object) => ARR(JSON.stringify(shape));
|
const OBJ_ARR = (shape: object) => ARR(JSON.stringify(shape));
|
||||||
|
|
||||||
const barModules = [
|
|
||||||
"osIcon",
|
|
||||||
"activeWindow",
|
|
||||||
"mediaPlaying",
|
|
||||||
"brightnessSpacer",
|
|
||||||
"workspaces",
|
|
||||||
"volumeSpacer",
|
|
||||||
"tray",
|
|
||||||
"statusIcons",
|
|
||||||
"pkgUpdates",
|
|
||||||
"notifCount",
|
|
||||||
"battery",
|
|
||||||
"dateTime",
|
|
||||||
"power",
|
|
||||||
];
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
"style.transparency": ["off", "normal", "high"],
|
"style.transparency": ["off", "normal", "high"],
|
||||||
"style.borders": BOOL,
|
"style.borders": BOOL,
|
||||||
|
|
@ -29,10 +15,10 @@ export default {
|
||||||
"bar.vertical": BOOL,
|
"bar.vertical": BOOL,
|
||||||
"bar.style": ["gaps", "panel", "embedded"],
|
"bar.style": ["gaps", "panel", "embedded"],
|
||||||
"bar.layout.type": ["centerbox", "flowbox"],
|
"bar.layout.type": ["centerbox", "flowbox"],
|
||||||
"bar.layout.centerbox.start": ARR(barModules),
|
"bar.layout.centerbox.start": ARR(BAR_MODULES),
|
||||||
"bar.layout.centerbox.center": ARR(barModules),
|
"bar.layout.centerbox.center": ARR(BAR_MODULES),
|
||||||
"bar.layout.centerbox.end": ARR(barModules),
|
"bar.layout.centerbox.end": ARR(BAR_MODULES),
|
||||||
"bar.layout.flowbox": ARR(barModules),
|
"bar.layout.flowbox": ARR(BAR_MODULES),
|
||||||
"bar.modules.workspaces.shown": NUM,
|
"bar.modules.workspaces.shown": NUM,
|
||||||
"bar.modules.workspaces.showLabels": BOOL,
|
"bar.modules.workspaces.showLabels": BOOL,
|
||||||
"bar.modules.workspaces.labels": ARR(STR),
|
"bar.modules.workspaces.labels": ARR(STR),
|
||||||
|
|
@ -95,9 +81,9 @@ export default {
|
||||||
"thumbnailer.defaults.height": NUM,
|
"thumbnailer.defaults.height": NUM,
|
||||||
"thumbnailer.defaults.exact": BOOL,
|
"thumbnailer.defaults.exact": BOOL,
|
||||||
"news.apiKey": STR,
|
"news.apiKey": STR,
|
||||||
"news.countries": ARR(STR),
|
"news.countries": ARR(NEWS_COUNTRIES),
|
||||||
"news.categories": ARR(STR),
|
"news.categories": ARR(NEWS_CATEGORIES),
|
||||||
"news.languages": ARR(STR),
|
"news.languages": ARR(NEWS_LANGUAGES),
|
||||||
"news.domains": ARR(STR),
|
"news.domains": ARR(STR),
|
||||||
"news.timezone": STR,
|
"news.timezone": STR,
|
||||||
"news.pages": NUM,
|
"news.pages": NUM,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue