diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-10 18:49:09 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-10 18:49:09 +1000 |
| commit | aeec219e843ad1d5b50378dd5817323c3ab4c324 (patch) | |
| tree | 761d91358cfd9daeeec105a8c9332101fe957bf5 /src | |
| parent | style: make transparency same for light/dark (diff) | |
| download | caelestia-shell-aeec219e843ad1d5b50378dd5817323c3ab4c324.tar.gz caelestia-shell-aeec219e843ad1d5b50378dd5817323c3ab4c324.tar.bz2 caelestia-shell-aeec219e843ad1d5b50378dd5817323c3ab4c324.zip | |
config: limit news param types
Limit countries, categories and languages to specific literals
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/defaults.ts | 4 | ||||
| -rw-r--r-- | src/config/literals.ts | 336 | ||||
| -rw-r--r-- | src/config/types.ts | 32 |
3 files changed, 347 insertions, 25 deletions
diff --git a/src/config/defaults.ts b/src/config/defaults.ts index 70a4700..b365a26 100644 --- a/src/config/defaults.ts +++ b/src/config/defaults.ts @@ -169,8 +169,8 @@ export default { countries: ["current"], // A list of country codes or "current" for the current location categories: [] as string[], // A list of news categories to filter by languages: ["en"], // A list of languages codes to filter by - domains: [] as string[], // A list of news domains to pull from - timezone: "", // A timezone to filter by, e.g. "America/New_York" + 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", see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones pages: 3, // Number of pages to pull (each page is 10 articles) }, }; diff --git a/src/config/literals.ts b/src/config/literals.ts new file mode 100644 index 0000000..1908c71 --- /dev/null +++ b/src/config/literals.ts @@ -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 +]; diff --git a/src/config/types.ts b/src/config/types.ts index 0e9138d..b79c408 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -1,25 +1,11 @@ +import { BAR_MODULES, NEWS_CATEGORIES, NEWS_COUNTRIES, NEWS_LANGUAGES } from "./literals"; + const BOOL = "boolean"; const STR = "string"; const NUM = "number"; const ARR = (type: string | string[]) => `array of ${typeof type === "string" ? type : JSON.stringify(type)}`; 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 { "style.transparency": ["off", "normal", "high"], "style.borders": BOOL, @@ -29,10 +15,10 @@ export default { "bar.vertical": BOOL, "bar.style": ["gaps", "panel", "embedded"], "bar.layout.type": ["centerbox", "flowbox"], - "bar.layout.centerbox.start": ARR(barModules), - "bar.layout.centerbox.center": ARR(barModules), - "bar.layout.centerbox.end": ARR(barModules), - "bar.layout.flowbox": ARR(barModules), + "bar.layout.centerbox.start": ARR(BAR_MODULES), + "bar.layout.centerbox.center": ARR(BAR_MODULES), + "bar.layout.centerbox.end": ARR(BAR_MODULES), + "bar.layout.flowbox": ARR(BAR_MODULES), "bar.modules.workspaces.shown": NUM, "bar.modules.workspaces.showLabels": BOOL, "bar.modules.workspaces.labels": ARR(STR), @@ -95,9 +81,9 @@ export default { "thumbnailer.defaults.height": NUM, "thumbnailer.defaults.exact": BOOL, "news.apiKey": STR, - "news.countries": ARR(STR), - "news.categories": ARR(STR), - "news.languages": ARR(STR), + "news.countries": ARR(NEWS_COUNTRIES), + "news.categories": ARR(NEWS_CATEGORIES), + "news.languages": ARR(NEWS_LANGUAGES), "news.domains": ARR(STR), "news.timezone": STR, "news.pages": NUM, |