summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
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>
2021-02-20fix broken SQL query that always failedEli Schwartz1-1/+1
Due to missing whitespace at the end of strings during joining, we ended up with the query fragment "DelTS IS NULLAND NOT PinnedTS" which should be "DelTS IS NULL AND NOT PinnedTS" So the check for pinned comments > 5 likely always failed. In php 7, a completely broken query that raises exceptions in the database engine was silently ignored... in php 8, it raises Uncaught PDOException: SQLSTATE[HY000]: General error: 1 near "PinnedTS": syntax error in <file> and aborts the page building. End result: users with permission to pin comments cannot see any comments, or indeed page content below the first comment header Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-10-14Fix requests not being sent to the Cc recipientsFrederik Schwan1-1/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-09-05pkg_search_page: Limit number of results on package searchMorten Linderud1-4/+3
The current package search query is quite poorly optimized and becomes a resource hog when the offsets gets large enough. This DoSes the service. A quick fix is to just ensure we have some limit to the number of hits we return. The current hardcoding of 2500 is based on the following: * 250 hits per page max * 10 pages We can maybe consider having it lower, but it seems easier to just have this a multiple of 250 in the first iteration. Signed-off-by: Morten Linderud <morten@linderud.pw> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-08-27Deliver emails to Cc in smtplib code pathLukas Fleischer2-9/+25
When using the sendmail() function with smtplib.SMTP or smtplib.SMTP_SSL, the list of actual recipients for the email (to be translated to RCPT commands) has to be provided as a parameter. Update the notification script and add all Cc recipients to that parameter. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-08-26Call sendmail with to, not recipientJelle van der Waa1-1/+1
After f7a57c8 (Localize notification emails, 2018-05-17), the server.sendmail line was not updated to now send the to the email address but instead sends to (email, 'en') and as sendmail accepts an iterable an email is also send to 'en'. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-04-05Fix PHP notices in the account formorigin/liveLukas Fleischer1-5/+5
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-04-05Fix invalid session ID checkLukas Fleischer1-1/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-03-27Release 5.0.0v5.0.0Lukas Fleischer1-1/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-03-27Add new upgrade instructionsLukas Fleischer1-0/+8
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-03-27Translation updates from TransifexLukas Fleischer2-282/+282
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-03-22Map BIGINT to INTEGER for SQLiteFrédéric Mangano-Tarumi1-0/+11
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-29Write test/README.md to help working with testsFrédéric Mangano-Tarumi1-0/+37
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-29test/Makefile: Run tests with prove when availableFrédéric Mangano-Tarumi1-0/+7
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-29Support running tests from any directoryFrédéric Mangano-Tarumi11-13/+12
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27Change the extension of TAP test suites to .tFrédéric Mangano-Tarumi11-1/+1
This is the common convention for TAP, and makes harnesses like prove automatically detect them. Plus, test suites don’t have to be shell scripts anymore. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27Disable Alembic support on test databasesFrédéric Mangano-Tarumi2-4/+10
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27Create an initial Alembic migrationFrédéric Mangano-Tarumi1-0/+24
This way the database will get stamped, and Git will create the `versions` directory without which Alembic won’t work. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27Set up Alembic for database migrationsFrédéric Mangano-Tarumi8-3/+252
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27Migrate the database schema to SQLAlchemyFrédéric Mangano-Tarumi10-482/+481
The new schema was generated with sqlacodegen and then manually adjusted to fit schema/aur-schema.sql faithfully, both in the organisation of the code and in the SQL generated by SQLAlchemy. Initializing the database now requires the new tool aurweb.initdb. References to aur-schema.sql have been updated and the old schema dropped. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27Properly escape passwords in the account edit formLukas Fleischer1-2/+2
Addresses FS#65639. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-26Fix HTML code in the account search results tableLukas Fleischer1-15/+5
Do not add an opening <tbody> tag for every row. Instead, wrap all rows in <tbody></tbody>. While at it, also simplify the code used to color the rows. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-26README.md: add references to TransifexLukas Fleischer1-0/+8
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-26README.md: fix a small typoYaron Shahrabani1-1/+1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-13Fix more PHP 7.4 warningsEli Schwartz1-0/+1
The try_login() function documents it returns an array containing an 'error' key, and our only caller *only* consults the 'error' key. Then the function returns null instead of an array, if the login succeeded! I question why we bother returning the new SID if we never use it, surely we could either return the error or return default null. But, for now, I'm just going to fix it to return what it's actually supposed to, without changing the API. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-13Fix PHP 7.4 warningsEli Schwartz2-8/+24
If a db query returned NULL instead of an array, then accessing $row[0] now throws a warning. The undocumented behavior of evaluating to NULL is maintained, and we want to return NULL anyway, so add a check for the value and fall back on the default function return type. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-11Use relative URIs for {source_file,log,commit}_uriLukas Fleischer1-3/+3
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-11Make SMTP port and authentication configurableLukas Fleischer2-1/+24
Add more options to configure the smtplib implementation for sending notification emails. The port can be changed using the new smtp-port option. Encryption can be configured using smtp-use-ssl and smtp-use-starttls. Keep in mind that you usually also need to change the port when enabling either of these options. Authentication can be configured using smtp-user and smtp-password. Authentication is disabled if either of these values is empty. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-11Support smtplib for sending emailsLukas Fleischer2-5/+20
Support mail delivery without a local MTA. Instead, an SMTP server can now be configured using the smtp-server option in the [notifications] section. In order to use this option, the value of the sendmail option must be empty. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-11Update README and convert to Markdown syntaxLukas Fleischer1-26/+8
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-10Translation updates from TransifexLukas Fleischer29-980/+4002
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02rendercomment: use python-markdown's new registration APIFrédéric Mangano-Tarumi2-6/+10
First, this gets rid of the deprecation warnings Python displayed. Second, this fixes the case where a link contained a pair of underscores, which used to be interpreted as an emphasis because the linkify processor ran after the emphasis processor. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02rendercomment: test headings loweringFrédéric Mangano-Tarumi1-0/+26
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02rendercomment: safer Flyspray task linkificationFrédéric Mangano-Tarumi2-7/+40
When an FS#123 is part of a code block, it must not be converted into a link. FS#123 may also appear inside an URL, in which case regular linkifaction of URLs must take precedence. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02rendercomment: safer auto-linkification of URLsFrédéric Mangano-Tarumi2-10/+24
Fixes a few edge cases: - URLs within code blocks used to get redundant <> added, breaking bash code snippets like `curl https://...` into `curl <https://...>`. - Links written with markdown's <https://...> syntax also used to get an extra pair of brackets. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02rendercomment: add a test for Git commit linksFrédéric Mangano-Tarumi1-0/+29
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02rendercomment: respectful linkification of Git commitsFrédéric Mangano-Tarumi1-16/+20
Turn the git-commits markdown processor into an inline processor, which is smart enough not to convert Git hashes contained in code blocks or links. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02Update message catalogLukas Fleischer1-21/+125
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>