47 Commits

Author SHA1 Message Date
tecc
5e3c287e51
feat(rewrite): Users, tokens, authentication, etc.
This is essentially a codedump because there are too many interweaved changes for me to keep track of or separate into smaller, more comprehensible commits.
So, enjoy! This maelstrom of code, torrent of implementations, and other minor changes.
2024-04-17 05:10:02 +02:00
tecc
7f31ee8898
feat(rewrite): Authenticator utilities and social lookup definitions (plus other changes)
authenticators: Authenticator utilities are now provided. Most of them are reimplementations of functions found in `src/user.js`.
util-emails: Clarified the intended use case and the function purpose duplication for `validateEmail`.
v1-ApiError: API errors now have an `id` field that may  in the future be used for localising error messages. Some documentation was also added.
2024-04-17 04:57:08 +02:00
tecc
7f45ea00df
feat(rewrite): Mailer (and mail utilities)!
mailer: The mailer is here! The equivalent of `src/mailer.js` has been implemented as `src/util/mailer.ts`, but with a few major differences: it uses Handlebars for templating, and minifies the results.
mailer-tests: Some tests were implemented for the mailer. More need to be made, but that can be done later.
2024-04-17 04:57:08 +02:00
tecc
2c0746cb42
change(rewrite)!: Social lookup uniqueness and other small changes
prisma-SocialLookup: `SocialLookup` is now supported through adding a unique index on every field.
Awaitable:  `Awaitable<T>` is a small global type that just means "anything that can be awaited. It's a counterpart to the default `Awaited` type, for when you want something that will be treated as an async value.
test-tsconfig: The `global.d.ts` file is now included by `backend`'s test tsconfig file. The same has not been done to `common` as it isn't necessary at the moment.
2024-04-17 04:57:07 +02:00
tecc
66168bcca3
feat(rewrite): Static data and key loading
static-data: Static data is now loaded. For now only the logos are loaded, but more may be added in the future. The logos are loaded in a similar fashion to how locale-specific logos are.
keys: Keys can now be loaded. They aren't
2024-04-17 04:57:07 +02:00
tecc
990aabf6d8
feat(rewrite): Locale class toJSON + lastLoaded property, etc.
locale-lastLoaded: `lastLoaded` allows code that uses locales to cache certain values until the locale is reloaded. Useful for hot-reloading locales.
locale-toJSON: The `Locale` class now has a generic `toJSON` implementation should that be necessary, provided by the new `toJSONGeneric` utility.
locale-logo: Locale-specific logos are now stored twice: once as the actual loaded data, and again as a URL. The `locale.logo` property resolves to the URL versions, whereas `locale.logoSource` resolves to the source data.

refreshLocaleDescriptionCaches: `refreshLocaleDescriptionCaches` allows reloading all derived values from the actual loaded data separately from loading everything again. Mainly used in test code but useful nonetheless.
getActiveLocaleDescriptions: The `activeLocaleDescriptions` array is now computed alongside the other cache values in `refreshLocaleDescriptionCaches`.
2024-04-17 04:57:07 +02:00
tecc
3e0ac36204
change(rewrite): Time and identifier utilities + watch script for common, 2024-04-17 04:57:07 +02:00
tecc
e3cbddf294
feat(locales): Fallback locales, translation keys
fallback-locales: Locales can now specify fallbacks. For now these fallbacks are global and not individually configurable, but the code has been written so that adding individual fallbacks will be simple.

dep/dependency-graph: `dependency-graph` was added as a library to prevent locale loading issues where they would be loaded out of order. It might be overkill at the moment, and *definitely* slows down start times, but it's very future-proof.
2024-04-17 04:57:07 +02:00
tecc
d352a1c8d1
test(rewrite): Add tests to backend, update common test config 2024-04-17 04:57:06 +02:00
tecc
392597023d
fix(rewrite-filters): Make username regex not global, add email validation
regex-not-global: Global regexs are stateful, which is bad.
email-validation: Email validation has been added. It does not do this according to specification, but according to a subset of industry standards. Subject to change.
user-login: The init route now checks if the identifier is an email or a username.
2023-10-28 17:21:10 +02:00
tecc
6f119b4232
feat(rewrite): Users and captchas: begin! 2023-10-28 15:18:05 +02:00
tecc
ee8b8d4043
feat(rewrite): Load expectedTranslations in locales.ts 2023-10-03 05:30:25 +02:00
tecc
887498daed
feat(rewrite): Initial database and /inclusive endpoints code
#prisma: Instead of using `.prisma/client` and `@prisma/client` (which re-exports `.prisma/client`, the rewrite now just uses the generated code directly through `#prisma` (see package.json and tsconfig.json).
inclusive: The `/inclusive` endpoint has started to be written. Right now the code is untested as I don't have sample data, but I'll test it soon enough.
2023-10-03 05:29:44 +02:00
tecc
581d6e7da3
change(rewrite): Small changes in rewrite
history-generator: The `historyDefaultsToWeirdGeneratorThing` has been renamed to `isUserGenerated`, and the expression for setting `history` to `__generator__` has been changed. See https://gitlab.com/PronounsPage/PronounsPage/-/merge_requests/373#note_1577573480.
cleaning: Formatted a few files and cleaned them up.
2023-10-03 05:24:49 +02:00
tecc
679f11633f
change(rewrite): Use detail field instead for second line of UNKNOWN_PRONOUN message field 2023-10-03 05:08:35 +02:00
tecc
6b43ac64f5
change(rewrite): Pronouns routes now 100% compatible 2023-09-20 02:22:26 +02:00
tecc
33dd2cbb7d
fix(rewrite): Allow for pronoun form variants 2023-09-20 02:15:34 +02:00
tecc
e854a89303
fix(rewrite): Use Math.min instead of max, remove logs 2023-09-20 01:57:10 +02:00
tecc
bc2abe50fa
feat(rewrite): Start implementing name algorithm 2023-09-19 23:47:49 +02:00
tecc
29fe79bdf7
test(rewrite): Forgot the Jest config file! 2023-09-19 23:45:43 +02:00
tecc
de9f5c1c06
test(rewrite): Tests using TS-Jest for common package, fix isNotBlank 2023-09-19 23:45:02 +02:00
tecc
5a899ac0a5
change(rewrite): Loading morphemes.js with a hack 2023-09-19 21:13:56 +02:00
tecc
ef05cba7d7
feat(rewrite): setup.mjs now sets up everything 2023-09-16 13:51:47 +02:00
tecc
c115908fbf
change(rewrite): Add .prisma/client as a linked dependency 2023-09-16 13:50:52 +02:00
tecc
571add052b
change: Add prisma as dependency, add DATABASE_URL env variable 2023-09-16 12:29:49 +02:00
tecc
1e2b321bd8
fix(rewrite): Fix setup.mjs on Unix-like systems 2023-09-15 23:25:11 +02:00
tecc
555cecb58f
change(rewrite): Add /locales and .vscode/ to .gitignore 2023-09-15 23:20:29 +02:00
tecc
a9c63b6cbd
docs(rewrite): Add @experimental to LocaleDescriptions symbol and family properties
@experimental: It's not that widely supported but it gets the point across effectively.
2023-09-15 15:25:36 +02:00
tecc
93f0d5065f
change(rewrite)!: Rename SECRET to SECURITY_SECRET for consistency 2023-09-15 15:17:19 +02:00
tecc
6748ac1a53
change(rewrite): Add FAQ link to the UNKNOWN_PRONOUN error. 2023-09-15 15:15:11 +02:00
tecc
1515bac363
docs(rewrite): Remove unnecessary doc comments in suml.ts 2023-09-15 15:14:29 +02:00
tecc
336ddb9408
change(rewrite): Rename parseIntOrThrow to parseInteger 2023-09-15 15:04:58 +02:00
tecc
c1d6551301
fix(rewrite): setup.mjs should work on both Unix-like and Windows, fixed message function 2023-09-15 15:04:22 +02:00
tecc
1d3bfe52db
change(rewrite): Remove license field pending internal discussion 2023-09-15 15:02:17 +02:00
tecc
e1d951be8d
refactor(rewrite): Reformat files 2023-09-14 18:21:31 +02:00
tecc
fbacef16ec
docs(rewrite): Better setup instructions that *should* work, etc. 2023-09-14 18:20:24 +02:00
tecc
cc32163e19
feat(rewrite): Move /pronouns endpoints into separate file 2023-09-10 20:28:59 +02:00
tecc
017e669416
feat(rewrite): Implementation of /pronouns/:pronoun route 2023-09-10 08:08:15 +02:00
tecc
0ff1a90f79
fix(rewrite): /pronouns endpoint now 100% compatible 2023-09-10 07:50:48 +02:00
tecc
b469865fd7
refactor(rewrite): Reformat using prettier 2023-09-09 22:38:15 +02:00
tecc
9b7579aaae
feat(rewrite): More locale data, implementation of /pronouns endpoint (yay!) 2023-09-09 22:37:24 +02:00
tecc
3557f69743
change(config): LOG_LEVEL environment variable, fixed erroneous port for default HTTP_PUBLIC_URL 2023-09-09 19:25:00 +02:00
tecc
b2c43f084b
docs(rewrite): Add documentation for setup.mjs 2023-08-31 21:40:41 +02:00
tecc
5ead881f09
feat(rewrite): Loading locales, ping route, and easter eggs 2023-08-31 21:36:22 +02:00
tecc
4ec2a5ab43
feat(rewrite): Implement basic configuration, use Fastify 2023-08-27 01:02:44 +02:00
tecc
8f0dda8c57
change(rewrite): Add common package, do some build setup, add some docs 2023-08-26 10:16:41 +02:00
tecc
3da9069920
feat(rewrite): Initial commit of the rewrite, I guess 2023-08-26 04:40:16 +02:00