Commit graph

2349 commits

Author SHA1 Message Date
Lukas Fleischer
840ee20f7b Rename translation resources from aur to aurweb
* Rename the aur project to aurweb on Transifex.
* Rename aur.pot to aurweb.pot.
* Update documentation and Makefile.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-07-07 16:05:12 +02:00
Lukas Fleischer
41a4189d20 Sync CSS with archweb
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-07-07 15:57:47 +02:00
Lukas Fleischer
b70f048bc3 Add package base name in request close notifications
Mention both the package base name and the request type in the subject
of request closure notification.

Implements FS#41607.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-20 16:55:58 +02:00
Eli Schwartz
16795eaf46 git-update: accept any arch in arch-dependent metadata
Currently we hardcode the architectures the official repos historically
supported, which seems both inefficient because of hardcoding, and
simply wrong, because many packages support various ARM platforms too.

If we were to say "only officially supported arches will be supported in
the AUR" we'd have to disable i686, which seems silly and arbitrarily
restrictive. Also there's better places to implement such a blacklist
(via die_commit in the main loop, via a config option to list supported
arches, would make much more sense in terms of logic).

As for the metadata extraction itself, there's no reason to hardcode the
arches to check for at all. We can get this information too, from the
.SRCINFO itself. Detecting this dynamically is not incompatible with a
blacklist, should we ever decide to implement such a thing.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-18 17:40:37 +02:00
Lukas Fleischer
d24737f3f5 Update message catalog
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:58:54 +02:00
Lukas Fleischer
6367dfd245 Use modern format strings in notification messages
User modern Python format() strings with curly braces. Also, convert all
placeholders to named arguments. This allows translators to reorder
messages.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:58:54 +02:00
Lukas Fleischer
f7a57c82bc Localize notification emails
Add support for translating notification emails and send localized
notifications, based on the user's language preferences. Also, update
the translations Makefile to add strings from the notification script
to the message catalog.

Implements FS#31850.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:58:54 +02:00
Lukas Fleischer
f3b4c5c6bc Refactor the notification script
Reimplement most of the notification script logic. Create a separate
class for each notification type. Each class provides methods for
generating the list of recipients, the message subject, the message
body, the references to add at the end of the message and the message
headers. Additionally, a method for sending notification emails is
provided.

One major benefit of the new implementation is that both the generation
of recipients and message contents are much more flexible. For example,
it is now easily possible to make user-specific adjustments to every
single notification of a batch.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:05:52 +02:00
Lukas Fleischer
fec253a65d t2500: Add test cases for all notifications
Check that for all kinds of notifications, the generated messages match
what we expect.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-17 22:05:33 +02:00
Lukas Fleischer
7e452fdfb0 notify.py: Do not add stray newlines
Make sure we are consistent with not adding newlines at the end of
notification emails.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-16 20:10:03 +02:00
Lukas Fleischer
4b8b2e3eb1 Stop using each()
The each() function has been deprecated as of PHP 7.2.0. Use foreach
loops instead.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-12 13:35:11 +02:00
Lukas Fleischer
8838490665 Add newline after accept link for orphan requests
Fixes a regression introduced in 0ffa067 (Use a link to accept orphan
requests, 2018-05-10).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-12 12:37:16 +02:00
Lukas Fleischer
5c48302aaf confparser.inc.php: Add missing dollar sign
Fixes a regression introduced in 97c5bce (config: allow reading both the
defaults file and the modified config, 2018-04-15).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-12 12:37:16 +02:00
Lukas Fleischer
ad9422ca19 confparser.inc.php: Add missing semicolon
Fixes a regression introduced in 97c5bce (config: allow reading both the
defaults file and the modified config, 2018-04-15).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-12 12:25:21 +02:00
Eli Schwartz
0ffa0679d2 Use a link to accept orphan requests
Currently, a form is used instead of a link. This forwards to a
confirmation page, and currently drops the "via" parameter in the
process.

As a result, accepted orphan requests usually show:

    Request #XXXXXX has been accepted automatically by the Arch User
    Repository package request system:

    The user YYYYYYY disowned the package.

This is wrong, and should show (will show, if you manually add it or use
the close button instead of the accept button):

    Request #XXXXXX has been rejected by YYYYYYY [1]:

Fixes FS#56606.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-11 11:23:52 +02:00
Lukas Fleischer
ce93360257 Erase login IP addresses after seven days
Add a script to periodically remove old IP addresses from the users
database.

The login IP addresses are stored for spam protection and to prevent
from abuse. It is quite unlikely that we ever need the IP address of a
user whose last login is more than a week old. It makes sense to remove
such IP addresses to protect our users' privacy.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-10 21:38:25 +02:00
Eli Schwartz
4381a0d7c2 Update copyright year in the cgit footer template
Four years just passed in the blink of an eye :)

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-05-10 09:29:03 +02:00
Eli Schwartz
97c5bcec13 config: allow reading both the defaults file and the modified config
In the process, rename config.proto to config.defaults (because that is
what it is now).

Also use dict.get('key', default_value) when querying os.environ, rather
than an if block, as it is more pythonic/readable/concise, and reduces
the number of dict lookups.

This change allows aurweb configuration to be done via either:
- copying config.defaults to config and modifying values
- creating a new config only containing modified values, next to a
  config.defaults containing unmodified values

The motivation for this change is to enable ansible configuration in our
flagship deployment by storing only changed values, and deferring to
config.defaults otherwise.

A side benefit is, it is easier to see what has changed by inspecting
only the site configuration file.

If a config.defaults file does not exist next to $AUR_CONFIG or in
$AUR_CONFIG_DEFAULTS, it is ignored and *all* values are expected to
live in the modified config file.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-04-22 09:26:10 +02:00
Lukas Fleischer
2b280ea3d8 Allow manual breaks and horizontal lines in comments
When sanitizing rendered comments, keep <hr> tags and <br> tags. The
former are generated when using "---" in Markdown comments, the latter
are used when putting two spaces at the end of a line.

Fixes FS#56649.
2018-04-08 09:33:35 +02:00
nodivbyzero
eccd328d42 Handle empty resultset getting recent 10 packages
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-21 07:45:26 +01:00
nodivbyzero
3d90623154 Terminate execution if config file is missing
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-20 19:23:02 +01:00
nodivbyzero
bcd795c339 schema/Makefile: Replace MySQL with SQLite in comment
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-14 17:19:53 +01:00
nodivbyzero
82ef1d09b9 TESTING: Add two required packages
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-14 17:19:39 +01:00
Johannes Löthberg
879db7012c notify: Send vote reminders to TUs that are also devs
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-13 21:05:37 +01:00
Jelle van der Waa
ca6332de6e Update cache code to INI style configuration
Change the defines to config_get and add one cache option and one option
to define memcache_servers. Mention the required dependency to get
memcached working in the INSTALL file.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-10 16:48:14 +01:00
Jelle van der Waa
c3bca45973 Remove unused variable $dbh in pkgbase_display_details
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-03-10 16:47:11 +01:00
Baptiste Jonglez
1ff409874e RPC: Allow to search packages by "*depends" fields
It is now possible to search for packages that depend on a given package,
for instance:

    /rpc/?v=5&type=search&by=depends&arg=ocaml

It is similarly possible to match on "makedepends", "checkdepends" and
"optdepends".

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-02-24 14:57:31 +01:00
Mark Weiman
f15c700ad2 Add capability for co-maintainers to disown packages
Implements FS#53832.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-02-24 14:57:31 +01:00
Florian Pritz
27654afadb Add rate limit support to API
This allows us to prevent users from hammering the API every few seconds
to check if any of their packages were updated. Real world users check
as often as every 5 or 10 seconds.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-02-24 14:57:31 +01:00
Florian Pritz
f51d4c32cd Remove disjunction in pkg_providers query
For some reason, running the SELECT .. WHERE .. OR .. query takes e.g.
58ms on a randomly generated db for some dependency name. Splitting the
OR into two dedicated queries and UNIONing the result takes only 0.42ms.

On the Arch Linux installation, searching for the providers of e.g.
mongodb takes >=110ms when not cached by the query cache. The new query
takes <1ms even when not cached.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-02-24 14:57:31 +01:00
Remy Marquis
34a0d39910 Document required PHP extensions in php.ini
To people unfamiliar with the code, it is not obvious that
the pdo_* PHP extensions must be enabled.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-01-26 20:17:04 +01:00
Johannes Löthberg
e5b43760c2 Move AUR_OVERWRITE privilege check from git/auth to git/update
git/auth is run as an AutherizedKeysCommand which does not get the
environment variables passed to it, so AUR_OVERWRITE always got
hard-set to '0' by it.  Instead we need to perform the actual privilege
check in git/update instead.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2018-01-21 18:09:10 +01:00
Eli Schwartz
ac29097ce8 Fix regression that stopped maintainers from pinning comments
In commit 8c98db0b82 support was added for
package co-maintainers to pin comments in addition to maintainers.

Due to a typo, the SQL query was reset halfway through and only added
the co-maintainer IDs to the list of allowed users.

Fixes FS#56783.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-12-23 22:51:39 +01:00
Lukas Fleischer
a04fe6a13e Add route for /users.gz
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-12-03 13:59:54 +01:00
Lukas Fleischer
4660892e58 Allow setting an empty home page
Since commit 4efba18 (Only allow valid HTTP(s) URLs as home page,
2017-11-05), the home page field in the account settings must be a valid
URL. However, this new check prevents from leaving the field empty. Keep
the check in place but skip it if the home page field is left empty.

Fixes FS#56550.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-12-03 13:52:28 +01:00
Lukas Fleischer
0333d475fa Release 4.6.0
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-12-03 10:23:46 +01:00
Lukas Fleischer
f44705a640 Translation updates from Transifex
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-12-02 21:30:44 +01:00
Lukas Fleischer
d09ee5fdd7 Update message catalog
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-28 08:52:22 +01:00
Lukas Fleischer
3be28d016f Sync CSS with archweb
This partially fixes FS#56472.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-28 08:52:12 +01:00
Lukas Fleischer
efa8da5ca2 Auto-link bug reports in comments
Automatically detect references to Flyspray bug reports in comments and
convert them to links to the Arch Linux bug tracker.

Implements FS#52008.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-08 07:51:09 +01:00
Lukas Fleischer
0aa67b278a Fix sorting order when clicking table headings
A bug introduced in commit 7d7e079 (Hide the table sorting links on the
dashboard, 2017-02-04) resulted in multiple clicks on a table heading in
the package search results table no longer having any effect, instead of
changing the sorting order. Fix this by removing erroneous spaces from
the GET parameters in the search URL.

Fixes FS#56261.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-07 21:36:42 +01:00
Lukas Fleischer
8c98db0b82 Allow package co-maintainers to pin comments
Implements FS#56255.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-06 17:03:37 +01:00
Lukas Fleischer
e2fa5ea6fa login.php: Escape quotes in the referer field
Replace special characters in the referer GET parameter using
htmlspecialchars() before inserting it into the login form fields to
prevent from XSS attacks.

Fixes FS#55286.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-05 11:28:11 +01:00
Lukas Fleischer
4efba18f86 Only allow valid HTTP(s) URLs as home page
The home page specified in the account settings is converted to a
clickable link on the user's profile. Make sure it is a valid URL which
uses the http or https scheme.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-05 08:55:24 +01:00
Lukas Fleischer
c859e371b0 Set X-Frame-Options to DENY for all pages
Do not allow to render aurweb pages in a frame to protect against
clickjacking.

Fixes FS#56168.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-05 08:36:23 +01:00
Lukas Fleischer
6c95fa3d1e Point out that the user name is public when registering
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-11-05 08:24:51 +01:00
Lukas Fleischer
36f26033d8 Add basic Travis CI support
Add a Travis CI configuration file to setup a test environment with all
the required dependencies and run the test suite.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-25 07:04:15 +02:00
Lukas Fleischer
7ef1427678 Fix use of test_must_fail with environment variables
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-25 07:04:15 +02:00
Lukas Fleischer
cb307bf01a Do not hardcode path to the Python interpreter
Use `/usr/bin/env python3` instead of `/usr/bin/python3` in the shebang
of Python scripts. This adds support for non-standard Python interpreter
paths such as the paths used in virtualenv environments.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-25 07:01:12 +02:00
Lukas Fleischer
2d2bef3513 t1100: Test AUR_OVERWRITE
Since c5302d3 (Require TUs to explicitly request to overwrite a pkgbase,
2017-07-24), non-fast-forward pushes require setting the AUR_OVERWRITE
environment variable. Make sure that git-auth passes this variable to
git-serve when it should (and does not pass it if it shouldn't).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-10 15:17:31 +02:00