basic app implementation
All checks were successful
build / build (push) Successful in 36s
release-tag / release-image (push) Successful in 16m28s

This commit is contained in:
Tijl 2024-08-25 17:43:55 +02:00
parent 2ef54d14f9
commit b8d7a8c4cf
Signed by: tijl
GPG Key ID: DAE24BFCD722F053
21 changed files with 1043 additions and 23 deletions

4
go.mod
View File

@ -4,12 +4,13 @@ go 1.22.5
require ( require (
github.com/coreos/go-oidc/v3 v3.11.0 github.com/coreos/go-oidc/v3 v3.11.0
github.com/fsnotify/fsnotify v1.7.0
github.com/gofiber/contrib/fiberzerolog v1.0.2 github.com/gofiber/contrib/fiberzerolog v1.0.2
github.com/gofiber/fiber/v2 v2.52.5 github.com/gofiber/fiber/v2 v2.52.5
github.com/gofiber/template/html/v2 v2.1.2 github.com/gofiber/template/html/v2 v2.1.2
github.com/golang-migrate/migrate/v4 v4.17.1 github.com/golang-migrate/migrate/v4 v4.17.1
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.6.0 github.com/jackc/pgx/v5 v5.6.0
github.com/lib/pq v1.10.9
github.com/rs/zerolog v1.33.0 github.com/rs/zerolog v1.33.0
github.com/yuin/goldmark v1.7.4 github.com/yuin/goldmark v1.7.4
github.com/yuin/goldmark-meta v1.1.0 github.com/yuin/goldmark-meta v1.1.0
@ -22,7 +23,6 @@ require (
github.com/go-jose/go-jose/v4 v4.0.2 // indirect github.com/go-jose/go-jose/v4 v4.0.2 // indirect
github.com/gofiber/template v1.8.3 // indirect github.com/gofiber/template v1.8.3 // indirect
github.com/gofiber/utils v1.1.0 // indirect github.com/gofiber/utils v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect

2
go.sum
View File

@ -21,8 +21,6 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-jose/go-jose/v4 v4.0.2 h1:R3l3kkBds16bO7ZFAEEcofK0MkrAJt3jlJznWZG0nvk= github.com/go-jose/go-jose/v4 v4.0.2 h1:R3l3kkBds16bO7ZFAEEcofK0MkrAJt3jlJznWZG0nvk=
github.com/go-jose/go-jose/v4 v4.0.2/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY= github.com/go-jose/go-jose/v4 v4.0.2/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=

View File

@ -0,0 +1,252 @@
[
{"code": "BD", "tags": ["Asia"]},
{"code": "BE", "tags": ["Europe", "NatoMembers"]},
{"code": "BF", "tags": ["Africa", "WestAfrica"]},
{"code": "BG", "tags": ["Europe", "Balkans"]},
{"code": "BA", "tags": ["Europe", "Balkans"]},
{"code": "BB", "tags": ["Caribbean"]},
{"code": "WF", "tags": ["Caribbean"]},
{"code": "BL", "tags": []},
{"code": "BM", "tags": ["NorthAmerica"]},
{"code": "BN", "tags": ["Asia", "SoutheastAsia"]},
{"code": "BO", "tags": ["SouthAmerica"]},
{"code": "BH", "tags": ["MiddleEast", "Asia"]},
{"code": "BI", "tags": ["Africa", "EastAfrica"]},
{"code": "BJ", "tags": ["Africa", "WestAfrica"]},
{"code": "BT", "tags": ["Asia"]},
{"code": "JM", "tags": ["Caribbean"]},
{"code": "BV", "tags": []},
{"code": "BW", "tags": ["Africa", "SouthernAfrica"]},
{"code": "WS", "tags": ["Oceania"]},
{"code": "BQ", "tags": []},
{"code": "BR", "tags": ["South America"]},
{"code": "BS", "tags": ["Caribbean"]},
{"code": "JE", "tags": ["Europe"]},
{"code": "BY", "tags": ["Europe"]},
{"code": "BZ", "tags": ["CentralAmerica"]},
{"code": "RU", "tags": ["Europe", "Asia"]},
{"code": "RW", "tags": ["Africa", "EastAfrica"]},
{"code": "RS", "tags": ["Europe", "Balkans"]},
{"code": "TL", "tags": ["Oceania", "SoutheastAsia"]},
{"code": "RE", "tags": []},
{"code": "TM", "tags": ["Asia", "CentralAsia"]},
{"code": "TJ", "tags": ["Asia", "CentralAsia"]},
{"code": "RO", "tags": ["Europe"]},
{"code": "TK", "tags": []},
{"code": "GW", "tags": ["Africa", "WestAfrica"]},
{"code": "GU", "tags": []},
{"code": "GT", "tags": ["Central America"]},
{"code": "GS", "tags": []},
{"code": "GR", "tags": ["Europe", "Balkans"]},
{"code": "GQ", "tags": ["Africa", "CentralAfrica"]},
{"code": "GP", "tags": []},
{"code": "JP", "tags": ["Asia"]},
{"code": "GY", "tags": ["SouthAmerica"]},
{"code": "GG", "tags": ["Europe"]},
{"code": "GF", "tags": []},
{"code": "GE", "tags": ["Asia", "MiddleEast"]},
{"code": "GD", "tags": ["Caribbean"]},
{"code": "GB", "tags": ["Europe", "NatoMembers"]},
{"code": "GA", "tags": ["Africa", "CentralAfrica"]},
{"code": "SV", "tags": ["CentralAmerica"]},
{"code": "GN", "tags": ["Africa", "WestAfrica"]},
{"code": "GM", "tags": ["Africa", "WestAfrica"]},
{"code": "GL", "tags": ["NorthAmerica"]},
{"code": "GI", "tags": ["Europe"]},
{"code": "GH", "tags": ["Africa", "WestAfrica"]},
{"code": "OM", "tags": ["Asia", "MiddleEast"]},
{"code": "TN", "tags": ["Africa", "NorthAfrica"]},
{"code": "JO", "tags": ["Asia", "MiddleEast"]},
{"code": "HR", "tags": ["Europe", "Balkans"]},
{"code": "HT", "tags": ["Caribbean"]},
{"code": "HU", "tags": ["Europe"]},
{"code": "HK", "tags": ["Asia"]},
{"code": "HN", "tags": ["CentralAmerica"]},
{"code": "HM", "tags": ["Oceania"]},
{"code": "VE", "tags": ["SouthAmerica"]},
{"code": "PR", "tags": []},
{"code": "PS", "tags": ["Asia", "MiddleEast"]},
{"code": "PW", "tags": ["Oceania"]},
{"code": "PT", "tags": ["Europe"]},
{"code": "SJ", "tags": []},
{"code": "PY", "tags": ["SouthAmerica"]},
{"code": "IQ", "tags": ["Asia", "MiddleEast"]},
{"code": "PA", "tags": ["CentralAmerica"]},
{"code": "PF", "tags": []},
{"code": "PG", "tags": ["Oceania"]},
{"code": "PE", "tags": ["SouthAmerica"]},
{"code": "PK", "tags": ["Asia"]},
{"code": "PH", "tags": ["Asia", "SoutheastAsia"]},
{"code": "PN", "tags": []},
{"code": "PL", "tags": ["Europe"]},
{"code": "PM", "tags": []},
{"code": "ZM", "tags": ["Africa", "EastAfrica"]},
{"code": "EH", "tags": ["Africa", "WestAfrica", "NorthAfrica"]},
{"code": "EE", "tags": ["Europe", "NatoMembers"]},
{"code": "EG", "tags": ["Africa", "NorthAfrica"]},
{"code": "ZA", "tags": ["Africa", "SouthernAfrica"]},
{"code": "EC", "tags": ["SouthAmerica"]},
{"code": "IT", "tags": ["Europe"]},
{"code": "VN", "tags": ["Asia", "SoutheastAsia"]},
{"code": "SB", "tags": ["Oceania"]},
{"code": "ET", "tags": ["Africa", "EastAfrica"]},
{"code": "SO", "tags": ["Africa", "EastAfrica"]},
{"code": "ZW", "tags": ["Africa", "EastAfrica"]},
{"code": "SA", "tags": ["Asia", "MiddleEast"]},
{"code": "ES", "tags": ["Europe"]},
{"code": "ER", "tags": ["Africa", "EastAfrica"]},
{"code": "ME", "tags": ["Europe", "Balkans"]},
{"code": "MD", "tags": ["Europe"]},
{"code": "MG", "tags": ["Africa", "EastAfrica"]},
{"code": "MF", "tags": []},
{"code": "MA", "tags": ["Africa", "NorthAfrica"]},
{"code": "MC", "tags": ["Europe"]},
{"code": "UZ", "tags": ["Asia", "CentralAsia"]},
{"code": "MM", "tags": ["Asia", "SoutheastAsia"]},
{"code": "ML", "tags": ["Africa", "WestAfrica"]},
{"code": "MO", "tags": ["Asia"]},
{"code": "MN", "tags": ["Asia"]},
{"code": "MH", "tags": ["Oceania"]},
{"code": "MK", "tags": ["Europe", "Balkans"]},
{"code": "MU", "tags": ["Africa", "EastAfrica"]},
{"code": "MT", "tags": ["Europe"]},
{"code": "MW", "tags": ["Africa", "EastAfrica"]},
{"code": "MV", "tags": ["Asia"]},
{"code": "MQ", "tags": []},
{"code": "MP", "tags": []},
{"code": "MS", "tags": ["Caribbean"]},
{"code": "MR", "tags": ["Africa", "WestAfrica"]},
{"code": "IM", "tags": ["Europe"]},
{"code": "UG", "tags": ["Africa", "EastAfrica"]},
{"code": "TZ", "tags": ["Africa", "EastAfrica"]},
{"code": "MY", "tags": ["Asia", "SoutheastAsia"]},
{"code": "MX", "tags": ["NorthAmerica", "CentralAmerica"]},
{"code": "IL", "tags": ["Asia", "MiddleEast"]},
{"code": "FR", "tags": ["Europe"]},
{"code": "IO", "tags": []},
{"code": "SH", "tags": []},
{"code": "FI", "tags": ["Europe"]},
{"code": "FJ", "tags": ["Oceania"]},
{"code": "FK", "tags": ["SouthAmerica"]},
{"code": "FM", "tags": ["Oceania"]},
{"code": "FO", "tags": ["Europe"]},
{"code": "NI", "tags": ["CentralAmerica"]},
{"code": "NL", "tags": ["Europe"]},
{"code": "NO", "tags": ["Europe"]},
{"code": "NA", "tags": ["Africa", "SouthernAfrica"]},
{"code": "VU", "tags": ["Oceania"]},
{"code": "NC", "tags": []},
{"code": "NE", "tags": ["Africa", "WestAfrica"]},
{"code": "NF", "tags": []},
{"code": "NG", "tags": ["Africa", "WestAfrica"]},
{"code": "NZ", "tags": ["Oceania"]},
{"code": "NP", "tags": ["Asia"]},
{"code": "NR", "tags": ["Oceania"]},
{"code": "NU", "tags": []},
{"code": "CK", "tags": ["Oceania"]},
{"code": "XK", "tags": ["Europe", "Balkans"]},
{"code": "CI", "tags": ["Africa", "WestAfrica"]},
{"code": "CH", "tags": ["Europe"]},
{"code": "CO", "tags": ["SouthAmerica"]},
{"code": "CN", "tags": ["Asia"]},
{"code": "CM", "tags": ["Africa", "CentralAfrica"]},
{"code": "CL", "tags": ["SouthAmerica"]},
{"code": "CC", "tags": []},
{"code": "CA", "tags": ["NorthAmerica"]},
{"code": "CG", "tags": ["Africa", "CentralAfrica"]},
{"code": "CF", "tags": ["Africa", "CentralAfrica"]},
{"code": "CD", "tags": ["Africa", "CentralAfrica"]},
{"code": "CZ", "tags": ["Europe", "NatoMembers"]},
{"code": "CY", "tags": ["Europe", "Asia", "MiddleEast"]},
{"code": "CX", "tags": []},
{"code": "CR", "tags": ["CentralAmerica"]},
{"code": "CW", "tags": ["Europe"]},
{"code": "CV", "tags": ["Africa", "WestAfrica"]},
{"code": "CU", "tags": ["Caribbean"]},
{"code": "SZ", "tags": ["Africa", "SouthernAfrica"]},
{"code": "SY", "tags": ["Asia", "MiddleEast"]},
{"code": "SX", "tags": ["Caribbean"]},
{"code": "KG", "tags": ["Asia", "CentralAsia"]},
{"code": "KE", "tags": ["Africa", "EastAfrica"]},
{"code": "SS", "tags": ["Africa", "EastAfrica"]},
{"code": "SR", "tags": ["SouthAmerica"]},
{"code": "KI", "tags": ["Oceania"]},
{"code": "KH", "tags": ["Asia", "SoutheastAsia"]},
{"code": "KN", "tags": ["Caribbean"]},
{"code": "KM", "tags": ["Africa", "EastAfrica"]},
{"code": "ST", "tags": ["Africa", "CentralAfrica"]},
{"code": "SK", "tags": ["Europe"]},
{"code": "KR", "tags": ["Asia"]},
{"code": "SI", "tags": ["Europe", "Balkans"]},
{"code": "KP", "tags": ["Asia"]},
{"code": "KW", "tags": ["Asia", "MiddleEast"]},
{"code": "SN", "tags": ["Africa", "WestAfrica"]},
{"code": "SM", "tags": ["Europe"]},
{"code": "SL", "tags": ["Africa", "WestAfrica"]},
{"code": "SC", "tags": ["Africa", "EastAfrica"]},
{"code": "KZ", "tags": ["Asia", "CentralAsia"]},
{"code": "KY", "tags": []},
{"code": "SG", "tags": ["Asia", "SoutheastAsia"]},
{"code": "SE", "tags": ["Europe"]},
{"code": "SD", "tags": ["Africa", "NorthAfrica"]},
{"code": "DO", "tags": ["Caribbean"]},
{"code": "DM", "tags": ["Caribbean"]},
{"code": "DJ", "tags": ["Africa", "EastAfrica"]},
{"code": "DK", "tags": ["Europe"]},
{"code": "VG", "tags": []},
{"code": "DE", "tags": ["Europe"]},
{"code": "YE", "tags": ["Asia", "MiddleEast"]},
{"code": "DZ", "tags": ["Africa", "NorthAfrica"]},
{"code": "US", "tags": ["NorthAmerica"]},
{"code": "UY", "tags": ["SouthAmerica"]},
{"code": "YT", "tags": []},
{"code": "UM", "tags": []},
{"code": "LB", "tags": ["Asia", "MiddleEast"]},
{"code": "LC", "tags": ["Caribbean"]},
{"code": "LA", "tags": ["Asia", "SoutheastAsia"]},
{"code": "TV", "tags": ["Oceania"]},
{"code": "TW", "tags": ["Asia"]},
{"code": "TT", "tags": ["Caribbean"]},
{"code": "TR", "tags": ["Europe", "Asia", "MiddleEast"]},
{"code": "LK", "tags": ["Asia"]},
{"code": "LI", "tags": ["Europe"]},
{"code": "LV", "tags": ["Europe"]},
{"code": "TO", "tags": ["Oceania"]},
{"code": "LT", "tags": ["Europe"]},
{"code": "LU", "tags": ["Europe"]},
{"code": "LR", "tags": ["Africa", "WestAfrica"]},
{"code": "LS", "tags": ["Africa", "SouthernAfrica"]},
{"code": "TH", "tags": ["Asia", "SoutheastAsia"]},
{"code": "TF", "tags": []},
{"code": "TG", "tags": ["Africa", "WestAfrica"]},
{"code": "TD", "tags": ["Africa", "CentralAfrica"]},
{"code": "TC", "tags": ["Caribbean"]},
{"code": "LY", "tags": ["Africa", "NorthAfrica"]},
{"code": "VA", "tags": ["Europe"]},
{"code": "VC", "tags": ["Caribbean"]},
{"code": "AE", "tags": ["Asia", "MiddleEast"]},
{"code": "AD", "tags": ["Europe"]},
{"code": "AG", "tags": ["Caribbean"]},
{"code": "AF", "tags": ["Asia", "MiddleEast", "CentralAsia"]},
{"code": "AI", "tags": ["North America", "Caribbean"]},
{"code": "VI", "tags": []},
{"code": "IS", "tags": ["Europe"]},
{"code": "IR", "tags": []},
{"code": "AM", "tags": ["Middle East", "Asia"]},
{"code": "AL", "tags": ["Europe", "Balkans"]},
{"code": "AO", "tags": ["Africa", "CentralAfrica"]},
{"code": "AQ", "tags": []},
{"code": "AS", "tags": ["Oceania"]},
{"code": "AR", "tags": ["SouthAmerica"]},
{"code": "AU", "tags": ["Oceania"]},
{"code": "AT", "tags": ["Europe"]},
{"code": "AW", "tags": ["Europe"]},
{"code": "IN", "tags": ["Asia"]},
{"code": "AX", "tags": ["Europe"]},
{"code": "AZ", "tags": ["MiddleEast", "Asia"]},
{"code": "IE", "tags": ["Europe"]},
{"code": "ID", "tags": ["Asia", "Oceania", "SoutheastAsia"]},
{"code": "UA", "tags": ["Europe"]},
{"code": "QA", "tags": ["Asia", "MiddleEast"]},
{"code": "MZ", "tags": ["Africa", "EastAfrica"]}
]

View File

@ -0,0 +1,19 @@
[
"Asia",
"MiddleEast",
"SoutheastAsia",
"CentralAsia",
"Europe",
"Balkans",
"NorthAmerica",
"SouthAmerica",
"CentralAmerica",
"Caribbean",
"Africa",
"NorthAfrica",
"SouthernAfrica",
"WestAfrica",
"EastAfrica",
"CentralAfrica",
"Oceania"
]

View File

@ -0,0 +1 @@
package flags

View File

@ -0,0 +1,269 @@
{
"Asia": "Asia",
"MiddleEast": "Middle East",
"SoutheastAsia": "Southeast Asia",
"CentralAsia": "Central Asia",
"Europe": "Europe",
"Balkans": "Balkans",
"NorthAmerica": "North America",
"SouthAmerica": "South America",
"CentralAmerica": "Central America",
"Caribbean": "Caribbean",
"Africa": "Africa",
"NorthAfrica": "North Africa",
"SouthernAfrica": "Southern Africa",
"WestAfrica": "West Africa",
"EastAfrica": "East Africa",
"CentralAfrica": "Central Africa",
"Oceania": "Oceania",
"BD": "Bangladesh",
"BE": "Belgium",
"BF": "Burkina Faso",
"BG": "Bulgaria",
"BA": "Bosnia and Herzegovina",
"BB": "Barbados",
"WF": "Wallis and Futuna",
"BL": "Saint Barthelemy",
"BM": "Bermuda",
"BN": "Brunei",
"BO": "Bolivia",
"BH": "Bahrain",
"BI": "Burundi",
"BJ": "Benin",
"BT": "Bhutan",
"JM": "Jamaica",
"BV": "Bouvet Island",
"BW": "Botswana",
"WS": "Samoa",
"BQ": "Caribbean Netherlands",
"BR": "Brazil",
"BS": "Bahamas",
"JE": "Jersey",
"BY": "Belarus",
"BZ": "Belize",
"RU": "Russia",
"RW": "Rwanda",
"RS": "Serbia",
"TL": "East Timor",
"RE": "Reunion",
"TM": "Turkmenistan",
"TJ": "Tajikistan",
"RO": "Romania",
"TK": "Tokelau",
"GW": "Guinea-Bissau",
"GU": "Guam",
"GT": "Guatemala",
"GS": "South Georgia and the South Sandwich Islands",
"GR": "Greece",
"GQ": "Equatorial Guinea",
"GP": "Guadeloupe",
"JP": "Japan",
"GY": "Guyana",
"GG": "Guernsey",
"GF": "French Guiana",
"GE": "Georgia",
"GD": "Grenada",
"GB": "United Kingdom",
"GA": "Gabon",
"SV": "El Salvador",
"GN": "Guinea",
"GM": "Gambia",
"GL": "Greenland",
"GI": "Gibraltar",
"GH": "Ghana",
"OM": "Oman",
"TN": "Tunisia",
"JO": "Jordan",
"HR": "Croatia",
"HT": "Haiti",
"HU": "Hungary",
"HK": "Hong Kong",
"HN": "Honduras",
"HM": "Heard Island and McDonald Islands",
"VE": "Venezuela",
"PR": "Puerto Rico",
"PS": "Palestine",
"PW": "Palau",
"PT": "Portugal",
"SJ": "Svalbard and Jan Mayen",
"PY": "Paraguay",
"IQ": "Iraq",
"PA": "Panama",
"PF": "French Polynesia",
"PG": "Papua New Guinea",
"PE": "Peru",
"PK": "Pakistan",
"PH": "Philippines",
"PN": "Pitcairn",
"PL": "Poland",
"PM": "Saint Pierre and Miquelon",
"ZM": "Zambia",
"EH": "Western Sahara",
"EE": "Estonia",
"EG": "Egypt",
"ZA": "South Africa",
"EC": "Ecuador",
"IT": "Italy",
"VN": "Vietnam",
"SB": "Solomon Islands",
"ET": "Ethiopia",
"SO": "Somalia",
"ZW": "Zimbabwe",
"SA": "Saudi Arabia",
"ES": "Spain",
"ER": "Eritrea",
"ME": "Montenegro",
"MD": "Moldova",
"MG": "Madagascar",
"MF": "Saint Martin",
"MA": "Morocco",
"MC": "Monaco",
"UZ": "Uzbekistan",
"MM": "Myanmar",
"ML": "Mali",
"MO": "Macao",
"MN": "Mongolia",
"MH": "Marshall Islands",
"MK": "Macedonia",
"MU": "Mauritius",
"MT": "Malta",
"MW": "Malawi",
"MV": "Maldives",
"MQ": "Martinique",
"MP": "Northern Mariana Islands",
"MS": "Montserrat",
"MR": "Mauritania",
"IM": "Isle of Man",
"UG": "Uganda",
"TZ": "Tanzania",
"MY": "Malaysia",
"MX": "Mexico",
"IL": "Israel",
"FR": "France",
"IO": "British Indian Ocean Territory",
"SH": "Saint Helena",
"FI": "Finland",
"FJ": "Fiji",
"FK": "Falkland Islands",
"FM": "Micronesia",
"FO": "Faroe Islands",
"NI": "Nicaragua",
"NL": "Netherlands",
"NO": "Norway",
"NA": "Namibia",
"VU": "Vanuatu",
"NC": "New Caledonia",
"NE": "Niger",
"NF": "Norfolk Island",
"NG": "Nigeria",
"NZ": "New Zealand",
"NP": "Nepal",
"NR": "Nauru",
"NU": "Niue",
"CK": "Cook Islands",
"XK": "Kosovo",
"CI": "Ivory Coast",
"CH": "Switzerland",
"CO": "Colombia",
"CN": "China",
"CM": "Cameroon",
"CL": "Chile",
"CC": "Cocos Islands",
"CA": "Canada",
"CG": "Republic of the Congo",
"CF": "Central African Republic",
"CD": "Democratic Republic of the Congo",
"CZ": "Czech Republic",
"CY": "Cyprus",
"CX": "Christmas Island",
"CR": "Costa Rica",
"CW": "Curacao",
"CV": "Cape Verde",
"CU": "Cuba",
"SZ": "Swaziland",
"SY": "Syria",
"SX": "Sint Maarten",
"KG": "Kyrgyzstan",
"KE": "Kenya",
"SS": "South Sudan",
"SR": "Suriname",
"KI": "Kiribati",
"KH": "Cambodia",
"KN": "Saint Kitts and Nevis",
"KM": "Comoros",
"ST": "Sao Tome and Principe",
"SK": "Slovakia",
"KR": "South Korea",
"SI": "Slovenia",
"KP": "North Korea",
"KW": "Kuwait",
"SN": "Senegal",
"SM": "San Marino",
"SL": "Sierra Leone",
"SC": "Seychelles",
"KZ": "Kazakhstan",
"KY": "Cayman Islands",
"SG": "Singapore",
"SE": "Sweden",
"SD": "Sudan",
"DO": "Dominican Republic",
"DM": "Dominica",
"DJ": "Djibouti",
"DK": "Denmark",
"VG": "British Virgin Islands",
"DE": "Germany",
"YE": "Yemen",
"DZ": "Algeria",
"US": "United States",
"UY": "Uruguay",
"YT": "Mayotte",
"UM": "United States Minor Outlying Islands",
"LB": "Lebanon",
"LC": "Saint Lucia",
"LA": "Laos",
"TV": "Tuvalu",
"TW": "Taiwan",
"TT": "Trinidad and Tobago",
"TR": "Turkey",
"LK": "Sri Lanka",
"LI": "Liechtenstein",
"LV": "Latvia",
"TO": "Tonga",
"LT": "Lithuania",
"LU": "Luxembourg",
"LR": "Liberia",
"LS": "Lesotho",
"TH": "Thailand",
"TF": "French Southern Territories",
"TG": "Togo",
"TD": "Chad",
"TC": "Turks and Caicos Islands",
"LY": "Libya",
"VA": "Vatican",
"VC": "Saint Vincent and the Grenadines",
"AE": "United Arab Emirates",
"AD": "Andorra",
"AG": "Antigua and Barbuda",
"AF": "Afghanistan",
"AI": "Anguilla",
"VI": "U.S. Virgin Islands",
"IS": "Iceland",
"IR": "Iran",
"AM": "Armenia",
"AL": "Albania",
"AO": "Angola",
"AQ": "Antarctica",
"AS": "American Samoa",
"AR": "Argentina",
"AU": "Australia",
"AT": "Austria",
"AW": "Aruba",
"IN": "India",
"AX": "Aland Islands",
"AZ": "Azerbaijan",
"IE": "Ireland",
"ID": "Indonesia",
"UA": "Ukraine",
"QA": "Qatar",
"MZ": "Mozambique"
}

View File

@ -0,0 +1,269 @@
{
"Asia": "Azië",
"MiddleEast": "Midden-Oosten",
"SoutheastAsia": "Zuidoost-Azië",
"CentralAsia": "Centraal-Azië",
"Europe": "Europa",
"Balkans": "Balkan",
"NorthAmerica": "Noord-Amerika",
"SouthAmerica": "Zuid-Amerika",
"CentralAmerica": "Midden-Amerika",
"Caribbean": "Caraïben",
"Africa": "Afrika",
"NorthAfrica": "Noord-Afrika",
"SouthernAfrica": "Zuid-Afrika",
"WestAfrica": "West-Afrika",
"EastAfrica": "Oost-Afrika",
"CentralAfrica": "Centraal-Afrika",
"Oceania": "Oceanië",
"BD": "Bangladesh",
"BE": "België",
"BF": "Burkina Faso",
"BG": "Bulgarije",
"BA": "Bosnië en Herzegovina",
"BB": "Barbados",
"WF": "Wallis en Futuna",
"BL": "Saint-Barthélemy",
"BM": "Bermuda",
"BN": "Brunei",
"BO": "Bolivia",
"BH": "Bahrein",
"BI": "Burundi",
"BJ": "Benin",
"BT": "Bhutan",
"JM": "Jamaica",
"BV": "Bouveteiland",
"BW": "Botswana",
"WS": "Samoa",
"BQ": "Caribisch Nederland",
"BR": "Brazilië",
"BS": "Bahamas",
"JE": "Jersey",
"BY": "Wit-Rusland",
"BZ": "Belize",
"RU": "Rusland",
"RW": "Rwanda",
"RS": "Servië",
"TL": "Oost-Timor",
"RE": "Réunion",
"TM": "Turkmenistan",
"TJ": "Tadzjikistan",
"RO": "Roemenië",
"TK": "Tokelau-eilanden",
"GW": "Guinee-Bissau",
"GU": "Guam",
"GT": "Guatemala",
"GS": "Zuid-Georgië en Zuidelijke Sandwicheilanden",
"GR": "Griekenland",
"GQ": "Equatoriaal-Guinea",
"GP": "Guadeloupe",
"JP": "Japan",
"GY": "Guyana",
"GG": "Guernsey",
"GF": "Frans-Guyana",
"GE": "Georgië",
"GD": "Grenada",
"GB": "Verenigd Koninkrijk",
"GA": "Gabon",
"SV": "El Salvador",
"GN": "Guinee",
"GM": "Gambia",
"GL": "Groenland",
"GI": "Gibraltar",
"GH": "Ghana",
"OM": "Oman",
"TN": "Tunesië",
"JO": "Jordanië",
"HR": "Kroatië",
"HT": "Haïti",
"HU": "Hongarije",
"HK": "Hongkong",
"HN": "Honduras",
"HM": "Heard- en McDonaldeilanden",
"VE": "Venezuela",
"PR": "Porto Rico",
"PS": "Palestina",
"PW": "Palau",
"PT": "Portugal",
"SJ": "Svalbard en Jan Mayen",
"PY": "Paraguay",
"IQ": "Irak",
"PA": "Panama",
"PF": "Frans-Polynesië",
"PG": "Papoea-Nieuw-Guinea",
"PE": "Peru",
"PK": "Pakistan",
"PH": "Filipijnen",
"PN": "Pitcairneilanden",
"PL": "Polen",
"PM": "Saint-Pierre en Miquelon",
"ZM": "Zambia",
"EH": "Westelijke Sahara",
"EE": "Estland",
"EG": "Egypte",
"ZA": "Zuid-Afrika",
"EC": "Ecuador",
"IT": "Italië",
"VN": "Vietnam",
"SB": "Salomonseilanden",
"ET": "Ethiopië",
"SO": "Somalië",
"ZW": "Zimbabwe",
"SA": "Saoedi-Arabië",
"ES": "Spanje",
"ER": "Eritrea",
"ME": "Montenegro",
"MD": "Moldavië",
"MG": "Madagaskar",
"MF": "Sint-Maarten (Franse Antillen)",
"MA": "Marokko",
"MC": "Monaco",
"UZ": "Oezbekistan",
"MM": "Myanmar",
"ML": "Mali",
"MO": "Macau",
"MN": "Mongolië",
"MH": "Marshalleilanden",
"MK": "Noord-Macedonië",
"MU": "Mauritius",
"MT": "Malta",
"MW": "Malawi",
"MV": "Maldiven",
"MQ": "Martinique",
"MP": "Noordelijke Marianen",
"MS": "Montserrat",
"MR": "Mauritanië",
"IM": "Isle of Man",
"UG": "Oeganda",
"TZ": "Tanzania",
"MY": "Maleisië",
"MX": "Mexico",
"IL": "Israël",
"FR": "Frankrijk",
"IO": "Brits Territorium in de Indische Oceaan",
"SH": "Sint-Helena",
"FI": "Finland",
"FJ": "Fiji",
"FK": "Falklandeilanden",
"FM": "Micronesia",
"FO": "Faeröer",
"NI": "Nicaragua",
"NL": "Nederland",
"NO": "Noorwegen",
"NA": "Namibië",
"VU": "Vanuatu",
"NC": "Nieuw-Caledonië",
"NE": "Niger",
"NF": "Norfolkeiland",
"NG": "Nigeria",
"NZ": "Nieuw-Zeeland",
"NP": "Nepal",
"NR": "Nauru",
"NU": "Niue",
"CK": "Cookeilanden",
"XK": "Kosovo",
"CI": "Ivoorkust",
"CH": "Zwitserland",
"CO": "Colombia",
"CN": "China",
"CM": "Kameroen",
"CL": "Chili",
"CC": "Cocoseilanden",
"CA": "Canada",
"CG": "Congo",
"CF": "Centraal-Afrikaanse Republiek",
"CD": "Democratische Republiek Congo",
"CZ": "Tsjechië",
"CY": "Cyprus",
"CX": "Christmaseiland",
"CR": "Costa Rica",
"CW": "Curacao",
"CV": "Kaapverdië",
"CU": "Cuba",
"SZ": "Swaziland",
"SY": "Syrië",
"SX": "Sint Maarten",
"KG": "Kirgizstan",
"KE": "Kenia",
"SS": "Zuid-Soedan",
"SR": "Suriname",
"KI": "Kiribati",
"KH": "Cambodja",
"KN": "Saint Kitts en Nevis",
"KM": "Comoren",
"ST": "Sao Tomé en Principe",
"SK": "Slovakije",
"KR": "Zuid-Korea",
"SI": "Slovenië",
"KP": "Noord-Korea",
"KW": "Koeweit",
"SN": "Senegal",
"SM": "San Marino",
"SL": "Sierra Leone",
"SC": "Seychellen",
"KZ": "Kazachstan",
"KY": "Caymaneilanden",
"SG": "Singapore",
"SE": "Zweden",
"SD": "Soedan",
"DO": "Dominicaanse Republiek",
"DM": "Dominica",
"DJ": "Djibouti",
"DK": "Denemarken",
"VG": "Britse Maagdeneilanden",
"DE": "Duitsland",
"YE": "Jemen",
"DZ": "Algerije",
"US": "Verenigde Staten",
"UY": "Uruguay",
"YT": "Mayotte",
"UM": "Amerikaanse ondergeschikte afgelegen eilanden",
"LB": "Libanon",
"LC": "Saint Lucia",
"LA": "Laos",
"TV": "Tuvalu",
"TW": "Taiwan",
"TT": "Trinidad en Tobago",
"TR": "Turkije",
"LK": "Sri Lanka",
"LI": "Liechtenstein",
"LV": "Letland",
"TO": "Tonga",
"LT": "Litouwen",
"LU": "Luxemburg",
"LR": "Liberia",
"LS": "Lesotho",
"TH": "Thailand",
"TF": "Franse Gebieden in de zuidelijke Indische Oceaan",
"TG": "Togo",
"TD": "Tsjaad",
"TC": "Turks- en Caicoseilanden",
"LY": "Libië",
"VA": "Vaticaanstad",
"VC": "Saint Vincent en de Grenadines",
"AE": "Verenigde Arabische Emiraten",
"AD": "Andorra",
"AG": "Antigua en Barbuda",
"AF": "Afghanistan",
"AI": "Anguilla",
"VI": "Amerikaanse Maagdeneilanden",
"IS": "IJsland",
"IR": "Iran",
"AM": "Armenië",
"AL": "Albanië",
"AO": "Angola",
"AQ": "Antarctica",
"AS": "Amerikaans-Samoa",
"AR": "Argentinië",
"AU": "Australië",
"AT": "Oostenrijk",
"AW": "Aruba",
"IN": "India",
"AX": "Åland",
"AZ": "Azerbeidzjan",
"IE": "Ierland",
"ID": "Indonesië",
"UA": "Oekraïne",
"QA": "Qatar",
"MZ": "Mozambique"
}

View File

@ -0,0 +1,68 @@
package flags
// WIP
import (
"embed"
"encoding/json"
"git.tijl.dev/tijl/tijl.dev-core/modules/i18n"
log "git.tijl.dev/tijl/tijl.dev-core/modules/logger"
"git.tijl.dev/tijl/tijl.dev-core/modules/web"
"github.com/gofiber/fiber/v2"
)
var supportedTags []string
var countryCodes []CountryCode
type CountryCode struct {
Code string `json:"code"`
Tags []string `json:"tags"`
}
//go:embed locales/* data/*
var Embed embed.FS
func Setup() {
i18n.RegisterTranslations(Embed, "locales")
err := loadData()
if err != nil {
log.Error().Err(err).Msg("error loading country codes data file")
}
web.RegisterAppSetupFunc(func(a *fiber.App) {
a.Get("/app/flags", func(c *fiber.Ctx) error {
data := *web.Common(c)
data["Title"] = "tmp"
data["SupportedTags"] = supportedTags
return c.Render("apps/flags/start", data, "layouts/base")
})
}, 1000)
}
func loadData() error {
countryCodesData, err := Embed.ReadFile("data/country_codes.json")
if err != nil {
return err
}
countryCodes = []CountryCode{}
err = json.Unmarshal(countryCodesData, &countryCodes)
if err != nil {
return err
}
tagsData, err := Embed.ReadFile("data/tags.json")
if err != nil {
return err
}
supportedTags = []string{}
err = json.Unmarshal(tagsData, &supportedTags)
if err != nil {
return err
}
return nil
}

View File

@ -44,7 +44,7 @@ func authHandler(c *fiber.Ctx) error {
func logoutHandler(c *fiber.Ctx) error { func logoutHandler(c *fiber.Ctx) error {
_, err := user.GetSession(c) _, err := user.GetSession(c)
if err == nil { if err == nil {
c.ClearCookie("session") c.ClearCookie("session", "state")
return c.Redirect("/login", http.StatusOK) return c.Redirect("/login", http.StatusOK)
} else { } else {
return c.Redirect("/login", http.StatusUnauthorized) return c.Redirect("/login", http.StatusUnauthorized)

View File

@ -6,6 +6,7 @@ import (
"git.tijl.dev/tijl/tijl.dev-core/internal/config" "git.tijl.dev/tijl/tijl.dev-core/internal/config"
"git.tijl.dev/tijl/tijl.dev-core/internal/oidc" "git.tijl.dev/tijl/tijl.dev-core/internal/oidc"
"git.tijl.dev/tijl/tijl.dev-core/internal/user"
"git.tijl.dev/tijl/tijl.dev-core/modules/i18n" "git.tijl.dev/tijl/tijl.dev-core/modules/i18n"
"git.tijl.dev/tijl/tijl.dev-core/modules/web" "git.tijl.dev/tijl/tijl.dev-core/modules/web"
webf "git.tijl.dev/tijl/tijl.dev-core/web" webf "git.tijl.dev/tijl/tijl.dev-core/web"
@ -15,7 +16,8 @@ import (
func Setup() { func Setup() {
LoadPosts() LoadPosts()
web.RegisterAppSetupFunc(routes) web.RegisterAppSetupFunc(routes, 100)
web.RegisterAppSetupFunc(last, 0)
} }
func routes(app *fiber.App) { func routes(app *fiber.App) {
@ -38,10 +40,10 @@ func routes(app *fiber.App) {
return c.Render("about", data, "layouts/base") return c.Render("about", data, "layouts/base")
}) })
app.Get("/services", func(c *fiber.Ctx) error { app.Get("/services", func(c *fiber.Ctx) error {
/*_, err := user.GetSession(c) _, err := user.GetSession(c)
if err != nil { if err != nil {
return c.Next() return c.Next()
}*/ }
data := *web.Common(c) data := *web.Common(c)
data["Title"] = i18n.Translate(c, "services") data["Title"] = i18n.Translate(c, "services")
return c.Render("services", data, "layouts/base") return c.Render("services", data, "layouts/base")
@ -62,7 +64,10 @@ func routes(app *fiber.App) {
app.Use("/static/", filesystem.New(filesystem.Config{ app.Use("/static/", filesystem.New(filesystem.Config{
Root: http.FS(static), Root: http.FS(static),
})) }))
}
// last function with low priority for 404 handler
func last(app *fiber.App) {
/* /*
404 404
*/ */
@ -70,5 +75,4 @@ func routes(app *fiber.App) {
data := *web.Common(c) data := *web.Common(c)
return c.Render("404", data, "layouts/base") return c.Render("404", data, "layouts/base")
}) })
} }

View File

@ -82,11 +82,9 @@ func HandleCallback(c *fiber.Ctx) error {
} }
redirect := c.Cookies("internal_redirect") redirect := c.Cookies("internal_redirect")
log.Debug().Msg(redirect) c.ClearCookie("internal_redirect", "state")
if redirect != "" { if redirect != "" {
c.ClearCookie("internal_redirect") return c.Redirect(redirect, http.StatusFound)
return c.Redirect(redirect)
} }
return c.Redirect("/loggedin", http.StatusFound)
return c.Redirect("/loggedin")
} }

View File

@ -0,0 +1,9 @@
-- name: CreateFlagsGame :exec
INSERT INTO app_flags_games (uid, tags, question_amount) VALUES ($1, $2, $3) RETURNING (game_id, game_seed);
-- name: GetFlagsGame :one
SELECT * FROM app_flags_games WHERE game_id = $1 LIMIT 1;
-- name: UpdateFlagsGame :exec
UPDATE app_flags_games SET question_current = $1,
last_activity = CURRENT_TIMESTAMP;

View File

@ -0,0 +1,60 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: app_flags.sql
package queries
import (
"context"
"database/sql"
"github.com/google/uuid"
"github.com/lib/pq"
)
const createFlagsGame = `-- name: CreateFlagsGame :exec
INSERT INTO app_flags_games (uid, tags, question_amount) VALUES ($1, $2, $3) RETURNING (game_id, game_seed)
`
type CreateFlagsGameParams struct {
Uid sql.NullString
Tags []string
QuestionAmount int32
}
func (q *Queries) CreateFlagsGame(ctx context.Context, arg CreateFlagsGameParams) error {
_, err := q.db.ExecContext(ctx, createFlagsGame, arg.Uid, pq.Array(arg.Tags), arg.QuestionAmount)
return err
}
const getFlagsGame = `-- name: GetFlagsGame :one
SELECT game_id, game_seed, uid, tags, question_amount, question_current, question_correct, created_at, last_activity FROM app_flags_games WHERE game_id = $1 LIMIT 1
`
func (q *Queries) GetFlagsGame(ctx context.Context, gameID uuid.UUID) (AppFlagsGame, error) {
row := q.db.QueryRowContext(ctx, getFlagsGame, gameID)
var i AppFlagsGame
err := row.Scan(
&i.GameID,
&i.GameSeed,
&i.Uid,
pq.Array(&i.Tags),
&i.QuestionAmount,
&i.QuestionCurrent,
&i.QuestionCorrect,
&i.CreatedAt,
&i.LastActivity,
)
return i, err
}
const updateFlagsGame = `-- name: UpdateFlagsGame :exec
UPDATE app_flags_games SET question_current = $1,
last_activity = CURRENT_TIMESTAMP
`
func (q *Queries) UpdateFlagsGame(ctx context.Context, questionCurrent int32) error {
_, err := q.db.ExecContext(ctx, updateFlagsGame, questionCurrent)
return err
}

View File

@ -7,8 +7,28 @@ package queries
import ( import (
"database/sql" "database/sql"
"time" "time"
"github.com/google/uuid"
) )
type AppFlagsGame struct {
GameID uuid.UUID
GameSeed uuid.NullUUID
Uid sql.NullString
Tags []string
QuestionAmount int32
QuestionCurrent int32
QuestionCorrect sql.NullInt32
CreatedAt time.Time
LastActivity time.Time
}
type AppFlagsGamesAnswer struct {
GameID uuid.NullUUID
Question int32
Correct bool
}
type Session struct { type Session struct {
ID int32 ID int32
Uid string Uid string

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"git.tijl.dev/tijl/tijl.dev-core/internal/apps/flags"
"git.tijl.dev/tijl/tijl.dev-core/internal/assets" "git.tijl.dev/tijl/tijl.dev-core/internal/assets"
"git.tijl.dev/tijl/tijl.dev-core/internal/config" "git.tijl.dev/tijl/tijl.dev-core/internal/config"
"git.tijl.dev/tijl/tijl.dev-core/internal/handlers" "git.tijl.dev/tijl/tijl.dev-core/internal/handlers"
@ -39,6 +40,10 @@ func Listen() {
i18n.RegisterTranslations(locales.Embed, ".") i18n.RegisterTranslations(locales.Embed, ".")
// setup handler // setup handler
handlers.Setup() handlers.Setup()
// setup apps
flags.Setup()
// setup web // setup web
webinternal.Load() webinternal.Load()

View File

View File

@ -0,0 +1,23 @@
CREATE TABLE app_flags_games (
game_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
game_seed UUID DEFAULT gen_random_uuid(),
uid VARCHAR DEFAULT NULL,
tags VARCHAR[] NOT NULL,
question_amount INT NOT NULL,
question_current INT DEFAULT 0 NOT NULL,
question_correct INT GENERATED ALWAYS AS (
(SELECT COUNT(*) FROM app_flags_games_answers a WHERE a.game_id = app_flags_games.game_id AND a.correct = TRUE)
) STORED,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
last_activity TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (uid) REFERENCES users (uid)
);
CREATE TABLE app_flags_games_answers (
game_id UUID,
question INT NOT NULL,
correct BOOLEAN NOT NULL,
FOREIGN KEY (game_id) REFERENCES app_flags_games (game_id),
CONSTRAINT app_flags_games_answers_unique UNIQUE (game_id, question)
);

View File

@ -15,6 +15,7 @@ var translations map[string]map[string]string
const DefaultLang = "en" const DefaultLang = "en"
func RegisterTranslations(embed embed.FS, location string) { func RegisterTranslations(embed embed.FS, location string) {
amountFilesLoaded := 0
if translations == nil { if translations == nil {
translations = make(map[string]map[string]string) translations = make(map[string]map[string]string)
} }
@ -56,8 +57,11 @@ func RegisterTranslations(embed embed.FS, location string) {
translations[lang][key] = value translations[lang][key] = value
} }
log.Debug().Str("filename", file.Name()).Msg("i18n.RegisterTranslations: loaded") amountFilesLoaded++
//log.Debug().Str("filename", file.Name()).Msg("i18n.RegisterTranslations: loaded")
} }
log.Debug().Int("amountFilesLoaded", amountFilesLoaded).Msg("i18n.RegisterTranslations:")
} }
func Translate(c *fiber.Ctx, key string) string { func Translate(c *fiber.Ctx, key string) string {

View File

@ -11,8 +11,7 @@ var (
) )
func Load() { func Load() {
Logger = zerolog.New(os.Stderr).With().Timestamp().Logger().Output(zerolog.ConsoleWriter{Out: os.Stderr}) Logger = zerolog.New(os.Stderr).With().Timestamp().Logger().Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(zerolog.DebugLevel)
Logger.Level(zerolog.DebugLevel)
} }
func Info() *zerolog.Event { func Info() *zerolog.Event {

View File

@ -1,6 +1,8 @@
package web package web
import ( import (
"sort"
log "git.tijl.dev/tijl/tijl.dev-core/modules/logger" log "git.tijl.dev/tijl/tijl.dev-core/modules/logger"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@ -9,17 +11,29 @@ import (
Basic system for being able to add routes from other packages Basic system for being able to add routes from other packages
*/ */
var setupFuncs []func(*fiber.App) type setupFuncWithPriority struct {
function func(*fiber.App)
priority int
}
func RegisterAppSetupFunc(function func(*fiber.App)) { var setupFuncs []setupFuncWithPriority
func RegisterAppSetupFunc(function func(*fiber.App), priority int) {
log.Debug().Msg("web.RegisterAppSetupFunc: registered a function") log.Debug().Msg("web.RegisterAppSetupFunc: registered a function")
setupFuncs = append(setupFuncs, function) setupFuncs = append(setupFuncs, setupFuncWithPriority{
function: function,
priority: priority,
})
} }
// Setup executes all registered functions in order of priority
func Setup(app *fiber.App) { func Setup(app *fiber.App) {
sort.SliceStable(setupFuncs, func(i, j int) bool {
return setupFuncs[i].priority > setupFuncs[j].priority
})
for _, function := range setupFuncs { for _, setupFunc := range setupFuncs {
function(app) // log.Debug().Msg("web.Setup: executing a function")
setupFunc.function(app)
} }
} }

View File

@ -0,0 +1,8 @@
<div>
{{range .SupportedTags}}
<label class="cursor-pointer label">
<span class="label-text">{{index $.T .}}</span>
<input type="checkbox" class="checkbox checkbox-primary" />
</label>
{{end}}
</div>