summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-02-20RSS: Make sure image title matches channel titleJustin Kromlinger1-1/+1
https://validator.w3.org/feed/docs/warning/ImageTitleDoesntMatch.html Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20RSS: Set proper content type headerJustin Kromlinger1-0/+2
https://validator.w3.org/feed/docs/warning/UnexpectedContentType.html Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20RSS: Add atom self linkJustin Kromlinger1-1/+2
https://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Fix WHERE clause for keyword search queries with empty keywordsJakub Klinkovský1-5/+5
When the keyword parameter is empty, the AND clause has to be omitted, otherwise we get an SQL syntax error: ... WHERE PackageBases.PackagerUID IS NOT NULL AND () ... This got broken in commit 9e30013aa4fc6ce3a3c9f6f83a6fe789c1fc2456 Author: Kevin Morris <kevr.gtalk@gmail.com> Date: Sun Jul 5 18:19:06 2020 -0700 Support conjunctive keyword search in RPC interface Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20gendummydata.py: optimize iteration for big numbers of pkgsJakub Klinkovský1-4/+7
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20gendummydata.py: set MAX_USERS and MAX_PKGS to more realistic valuesJakub Klinkovský1-3/+3
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20gendummydata.py: set exit code to 1 when there is an errorJakub Klinkovský1-3/+3
Of course the default exit code is 0... Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20gendummydata.py: remove unused database connection variablesJakub Klinkovský1-4/+0
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20doc: simplify database setup instructions in TESTINGFilipe Laíns1-3/+3
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20doc: add missing gendummydata.py dependencies in TESTINGFilipe Laíns1-1/+2
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20doc: fix AUR_CONFIG in TESTINGFilipe Laíns1-2/+2
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20spawn: expand AUR_CONFIG to the full pathFilipe Laíns1-0/+4
This allows using a relative path for the config. PHP didn't play well with it. Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Redirect to referer after SSO loginFrédéric Mangano-Tarumi2-12/+29
Introduce a `redirect` query argument to SSO login endpoints so that users are redirected to the page they were originally on when they clicked the Login link. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Remove the per-user session limitFrédéric Mangano-Tarumi3-17/+1
This feature was originally introduced by f961ffd9c7f2d3d51d3e3b060990a4fef9e56c1b as a fix for FS#12898 <https://bugs.archlinux.org/task/12898>. As of today, it is broken because of the `q.SessionID IS NULL` condition in the WHERE clause, which can’t be true because SessionID is not nullable. As a consequence, the session limit was not applied. The fact the absence of the session limit hasn’t caused any issue so far, and hadn’t even been noticed, suggests the feature is unneeded. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Guard OAuth exceptions to provide better messagesFrédéric Mangano-Tarumi1-3/+13
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20HTML error pages for FastAPIFrédéric Mangano-Tarumi1-1/+15
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Update last login information on SSO loginFrédéric Mangano-Tarumi1-1/+7
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Stop redirecting stderr with proc_openFrédéric Mangano-Tarumi2-4/+0
Error outputs were piped to a temporary buffer that wasn’t read by anyone, making debugging hard because errors were completely silenced. By not explicitly redirecting stderr on proc_open, the subprocess inherits its parent stderr. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20aurweb.spawn: Support stdout redirections to non-ttyFrédéric Mangano-Tarumi1-1/+5
Only ttys have a terminal size. If we can’t obtain it, we’ll just use 80 as a sane default. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Exclude suspended Users from being notifiedKevin Morris1-10/+18
The existing notify.py script was grabbing entries regardless of user suspension. This has been modified to only send notifications to unsuspended users. This change was written as a solution to https://bugs.archlinux.org/task/65554. Signed-off-by: Kevin Morris <kevr.gtalk@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Support conjunctive keyword search in RPC interfaceKevin Morris3-24/+43
Newly supported API Version 6 modifies `type=search` for _by_ type `name-desc`: it now behaves the same as `name-desc` search through the https://aur.archlinux.org/packages/ search page. Search for packages containing the literal keyword `blah blah` AND `haha`: https://aur.archlinux.org/rpc/?v=6&type=search&arg="blah blah"%20haha Search for packages containing the literal keyword `abc 123`: https://aur.archlinux.org/rpc/?v=6&type=search&arg="abc 123" The following example searches for packages that contain `blah` AND `abc`: https://aur.archlinux.org/rpc/?v=6&type=search&arg=blah%20abc The legacy method still searches for packages that contain `blah abc`: https://aur.archlinux.org/rpc/?v=5&type=search&arg=blah%20abc https://aur.archlinux.org/rpc/?v=5&type=search&arg=blah%20abc API Version 6 is currently only considered during a `search` of `name-desc`. Note: This change was written as a solution to https://bugs.archlinux.org/task/49133. PS: + Some spacing issues fixed in comments. Signed-off-by: Kevin Morris <kevr.gtalk@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Build a translation facility for FastAPIFrédéric Mangano-Tarumi2-9/+33
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20SSO: Port account suspensionFrédéric Mangano-Tarumi1-1/+10
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20SSO: Port IP ban checkingFrédéric Mangano-Tarumi1-2/+17
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Save id_token for the SSO logoutFrédéric Mangano-Tarumi1-4/+15
As far as I can see, Keycloak ignores it entirely. I can login in as SSO user A, then disconnect from the SSO directly and reconnect as user B, but when I disconnect user A from AUR, Keycloak disconnects B even though AUR passed it an ID token for A. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Implement SSO logoutFrédéric Mangano-Tarumi2-1/+31
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20SSO: Add an SSO option in the login pageFrédéric Mangano-Tarumi1-0/+3
We’ll probably change the whole login page in the future, but this makes development easier. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20SSO: Explain the rationale behind prompt=loginFrédéric Mangano-Tarumi1-0/+7
We might reconsider it in the future. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Fix typos in CONTRIBUTING.mdFrédéric Mangano-Tarumi1-3/+3
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Open AUR sessions from SSOFrédéric Mangano-Tarumi1-2/+49
Only the core functionality is implemented here. See the TODOs. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Integrate SQLAlchemy into FastAPIFrédéric Mangano-Tarumi1-0/+30
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Add SSO account ID in table UsersFrédéric Mangano-Tarumi2-0/+31
This column holds a user ID issed by the single sign-on provider. For Keycloak, it is an UUID. For more flexibility, we will be using a standardly-sized VARCHAR field. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20aurweb.l10n: Translate without side effectsFrédéric Mangano-Tarumi1-2/+1
The install method in Python’s gettext API aliases the translator’s gettext method to an application-global _(). We don’t use that anywhere, and it’s clear from aurweb’s Translator interface that we want to translate a piece of text without affecting any global namespace. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Guide to setting up Keycloak for the SSOFrédéric Mangano-Tarumi2-1/+39
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Crude OpenID Connect client using AuthlibFrédéric Mangano-Tarumi8-2/+72
Developers can go to /sso/login to get redirected to the SSO. On successful login, the ID token is displayed. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20aurweb.spawn: Fix isort errorsFrédéric Mangano-Tarumi1-2/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Remove the FastAPI /hello test routeFrédéric Mangano-Tarumi2-8/+0
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Introduce conf/config.dev for developmentFrédéric Mangano-Tarumi3-15/+38
conf/config.dev’s purpose is to provide a lighter configuration template for developers, and split development-specific options off the default configuration file. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20aurweb.spawn: Integrate FastAPI and nginxFrédéric Mangano-Tarumi5-14/+86
aurweb.spawn used to launch only PHP’s built-in server. Now it spawns a dummy FastAPI application too. Since both stacks spawn their own HTTP server, aurweb.spawn also spawns nginx as a reverse proxy to mount them under the same base URL, defined by aur_location in the configuration. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Add CONTRIBUTING.mdFilipe Laíns1-0/+10
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20pre-commit: add initial configFilipe Laíns1-0/+24
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20isort: add initial configFilipe Laíns1-0/+4
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20flake8: add initial configFilipe Laíns1-0/+4
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Refactor code to comply with flake8 and isortFilipe Laíns11-201/+210
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20ci: remove Travis CIFilipe Laíns1-23/+0
We are are moving to Gitlab CI. Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20Create aurweb.spawn for spawing the test serverFrédéric Mangano-Tarumi3-3/+114
This program makes it easier for developers to spawn the PHP server since it fetches automatically what it needs from the configuration file, rather than having the user explicitly pass arguments to the php executable. When the setup gets more complicated as we introduce Python, aurweb.spawn will keep providing the same interface, while under the hood it is planned to support running multiple sub-processes. Its Python interface provides an way for the test suite to spawn the test server when it needs to perform HTTP requests to the test server. The current implementation is somewhat weak as it doesn’t detect when a child process dies, but this is not supposed to happen often, and it is only meant for aurweb developers. In the long term, aurweb.spawn will eventually become obsolete, and replaced by Docker or Flask’s tools. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20ci: add cache to gitlab ciFilipe Laíns1-1/+7
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20ci: add gitlab ciFilipe Laíns1-0/+12
Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20rewrite query to support both mysql/sqliteEli Schwartz1-9/+5
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20prevent running mysql-specific query in sqliteEli Schwartz1-1/+3
We usually guard such queries and have both mysql and sqlite branches. But I have not implemented the sqlite branch. Given sqlite is typically used for local dev setups, the fact that "users with more than the configured max simultaneous logins" can avoid getting some logins annulled is probably not a huge risk. And this always *used* to fail on sqlite, silently. Now, in php 8, it raises PDOException, which prevents running the test server Document this as a FIXME for now, until someone reimplements the query for sqlite. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>