From lfleischer at archlinux.org Sun Aug 2 13:23:50 2020 From: lfleischer at archlinux.org (Lukas Fleischer) Date: Sun, 02 Aug 2020 09:23:50 -0400 Subject: [PATCH] Remove the per-user session limit In-Reply-To: <20200729114610.GA646215@tsubame.mg0.fr> References: <20200729114610.GA646215@tsubame.mg0.fr> Message-ID: <159637463070.156716.11643008060716092512@typhoon> On Wed, 29 Jul 2020 at 07:46:10, Fr?d?ric Mangano-Tarumi wrote: > This feature was originally introduced by > f961ffd9c7f2d3d51d3e3b060990a4fef9e56c1b as a fix for FS#12898 > . > > As of today, it is broken because of the `q.SessionID IS NULL` condition > in the WHERE clause, which can\u2019t 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\u2019t caused any issue so > far, and hadn\u2019t even been noticed, suggests the feature is unneeded. > --- > aurweb/routers/sso.py | 2 +- > conf/config.defaults | 1 - > web/lib/acctfuncs.inc.php | 17 ----------------- > 3 files changed, 1 insertion(+), 19 deletions(-) Merged into pu, thanks! From lfleischer at archlinux.org Sun Aug 2 13:33:03 2020 From: lfleischer at archlinux.org (Lukas Fleischer) Date: Sun, 02 Aug 2020 09:33:03 -0400 Subject: [PATCH] Redirect to referer after SSO login In-Reply-To: <20200729152544.GA660646@tsubame.mg0.fr> References: <20200729152544.GA660646@tsubame.mg0.fr> Message-ID: <159637518358.156716.9178799312284346560@typhoon> On Wed, 29 Jul 2020 at 11:25:44, Fr?d?ric Mangano-Tarumi wrote: > 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. > --- > aurweb/routers/sso.py | 23 +++++++++++++++++------ > web/html/login.php | 18 ++++++++++++------ > 2 files changed, 29 insertions(+), 12 deletions(-) Thanks! I merged the patch into pu but we need to be careful here. It probably makes sense to have all the code go through a security review before we enable this feature in production in any case, so I am not too worried now. From lains at archlinux.org Thu Aug 13 14:45:58 2020 From: lains at archlinux.org (=?UTF-8?q?Filipe=20La=C3=ADns?=) Date: Thu, 13 Aug 2020 15:45:58 +0100 Subject: [PATCH 1/4] spawn: expand AUR_CONFIG to the full path Message-ID: <20200813144600.3703433-1-lains@archlinux.org> This allows using a relative path for the config. PHP didn't play well with it. Signed-off-by: Filipe La?ns --- aurweb/spawn.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aurweb/spawn.py b/aurweb/spawn.py index 46d534d9..3c5130d7 100644 --- a/aurweb/spawn.py +++ b/aurweb/spawn.py @@ -11,6 +11,7 @@ configuration anyway. import argparse import atexit import os +import os.path import subprocess import sys import tempfile @@ -87,6 +88,9 @@ def start(): return atexit.register(stop) + if 'AUR_CONFIG' in os.environ: + os.environ['AUR_CONFIG'] = os.path.realpath(os.environ['AUR_CONFIG']) + try: terminal_width = os.get_terminal_size().columns except OSError: -- 2.28.0 From lains at archlinux.org Thu Aug 13 14:46:00 2020 From: lains at archlinux.org (=?UTF-8?q?Filipe=20La=C3=ADns?=) Date: Thu, 13 Aug 2020 15:46:00 +0100 Subject: [PATCH 2/4] doc: fix AUR_CONFIG in TESTING In-Reply-To: <20200813144600.3703433-1-lains@archlinux.org> References: <20200813144600.3703433-1-lains@archlinux.org> Message-ID: <20200813144600.3703433-2-lains@archlinux.org> Signed-off-by: Filipe La?ns --- TESTING | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TESTING b/TESTING index d7df3672..17c6fbc7 100644 --- a/TESTING +++ b/TESTING @@ -29,7 +29,7 @@ INSTALL. 4) Prepare the testing database: $ cd /path/to/aurweb/ - $ python -m aurweb.initdb + $ AUR_CONFIG=conf/config python -m aurweb.initdb $ cd /path/to/aurweb/schema $ ./gendummydata.py out.sql @@ -37,4 +37,4 @@ INSTALL. 5) Run the test server: - $ AUR_CONFIG='/path/to/aurweb/conf/config' python -m aurweb.spawn + $ AUR_CONFIG=conf/config python -m aurweb.spawn -- 2.28.0 From lains at archlinux.org Thu Aug 13 14:46:01 2020 From: lains at archlinux.org (=?UTF-8?q?Filipe=20La=C3=ADns?=) Date: Thu, 13 Aug 2020 15:46:01 +0100 Subject: [PATCH 3/4] doc: add missing gendummydata.py dependencis in TESTING In-Reply-To: <20200813144600.3703433-1-lains@archlinux.org> References: <20200813144600.3703433-1-lains@archlinux.org> Message-ID: <20200813144600.3703433-3-lains@archlinux.org> Signed-off-by: Filipe La?ns --- TESTING | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TESTING b/TESTING index 17c6fbc7..d666b3ca 100644 --- a/TESTING +++ b/TESTING @@ -14,7 +14,8 @@ INSTALL. # pacman -S --needed php php-sqlite sqlite words fortune-mod \ python python-sqlalchemy python-alembic \ python-fastapi uvicorn nginx \ - python-authlib python-itsdangerous python-httpx + python-authlib python-itsdangerous python-httpx \ + words fortune-mod Ensure to enable the pdo_sqlite extension in php.ini. -- 2.28.0 From lains at archlinux.org Thu Aug 13 14:46:02 2020 From: lains at archlinux.org (=?UTF-8?q?Filipe=20La=C3=ADns?=) Date: Thu, 13 Aug 2020 15:46:02 +0100 Subject: [PATCH 4/4] doc: simplify database setup instructions in TESTING In-Reply-To: <20200813144600.3703433-1-lains@archlinux.org> References: <20200813144600.3703433-1-lains@archlinux.org> Message-ID: <20200813144600.3703433-4-lains@archlinux.org> Signed-off-by: Filipe La?ns --- TESTING | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TESTING b/TESTING index d666b3ca..972bce2c 100644 --- a/TESTING +++ b/TESTING @@ -30,11 +30,11 @@ INSTALL. 4) Prepare the testing database: $ cd /path/to/aurweb/ + $ AUR_CONFIG=conf/config python -m aurweb.initdb - $ cd /path/to/aurweb/schema - $ ./gendummydata.py out.sql - $ sqlite3 path/to/aurweb.sqlite3 < out.sql + $ schema/gendummydata.py data.sql + $ sqlite3 aurweb.sqlite3 < data.sql 5) Run the test server: -- 2.28.0 From lfleischer at archlinux.org Fri Aug 14 01:02:54 2020 From: lfleischer at archlinux.org (Lukas Fleischer) Date: Thu, 13 Aug 2020 21:02:54 -0400 Subject: [PATCH 1/4] spawn: expand AUR_CONFIG to the full path In-Reply-To: <20200813144600.3703433-1-lains@archlinux.org> References: <20200813144600.3703433-1-lains@archlinux.org> Message-ID: <159736697425.16440.17084209168632872357@typhoon> On Thu, 13 Aug 2020 at 10:45:58, Filipe La?ns wrote: > This allows using a relative path for the config. PHP didn't play well > with it. > > Signed-off-by: Filipe La?ns > --- > aurweb/spawn.py | 4 ++++ > 1 file changed, 4 insertions(+) Merged into pu (with a typo fix for the commit message of patch 3/4). Thanks! From lfleischer at archlinux.org Thu Aug 27 11:14:59 2020 From: lfleischer at archlinux.org (Lukas Fleischer) Date: Thu, 27 Aug 2020 07:14:59 -0400 Subject: [PATCH] Deliver emails to Cc in smtplib code path Message-ID: <20200827111459.57672-1-lfleischer@archlinux.org> 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 --- aurweb/scripts/notify.py | 18 ++++++++++++------ test/t2500-notify.t | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/aurweb/scripts/notify.py b/aurweb/scripts/notify.py index 79cf633..b698bd7 100755 --- a/aurweb/scripts/notify.py +++ b/aurweb/scripts/notify.py @@ -14,10 +14,6 @@ import aurweb.l10n aur_location = aurweb.config.get('options', 'aur_location') -def headers_cc(cclist): - return {'Cc': str.join(', ', cclist)} - - def headers_msgid(thread_id): return {'Message-ID': thread_id} @@ -53,6 +49,9 @@ class Notification: def get_headers(self): return {} + def get_cc(self): + return [] + def get_body_fmt(self, lang): body = '' for line in self.get_body(lang).splitlines(): @@ -80,6 +79,8 @@ class Notification: msg['From'] = sender msg['Reply-to'] = reply_to msg['To'] = to + if self.get_cc(): + msg['Cc'] = str.join(', ', self.get_cc()) msg['X-AUR-Reason'] = reason msg['Date'] = email.utils.formatdate(localtime=True) @@ -116,6 +117,7 @@ class Notification: server.login(user, passwd) server.set_debuglevel(0) + deliver_to = [to] + self.get_cc() server.sendmail(sender, to, msg.as_bytes()) server.quit() @@ -450,6 +452,9 @@ class RequestOpenNotification(Notification): def get_recipients(self): return [(self._to, 'en')] + def get_cc(self): + return self._cc + def get_subject(self, lang): return '[PRQ#%d] %s Request for %s' % \ (self._reqid, self._reqtype.title(), self._pkgbase) @@ -478,7 +483,6 @@ class RequestOpenNotification(Notification): # Use a deterministic Message-ID for the first email referencing a # request. headers = headers_msgid(thread_id) - headers.update(headers_cc(self._cc)) return headers @@ -509,6 +513,9 @@ class RequestCloseNotification(Notification): def get_recipients(self): return [(self._to, 'en')] + def get_cc(self): + return self._cc + def get_subject(self, lang): return '[PRQ#%d] %s Request for %s %s' % (self._reqid, self._reqtype.title(), @@ -538,7 +545,6 @@ class RequestCloseNotification(Notification): def get_headers(self): thread_id = '' headers = headers_reply(thread_id) - headers.update(headers_cc(self._cc)) return headers diff --git a/test/t2500-notify.t b/test/t2500-notify.t index 5ef64c1..713b31e 100755 --- a/test/t2500-notify.t +++ b/test/t2500-notify.t @@ -277,13 +277,18 @@ test_expect_success 'Test subject and body of merge notifications.' ' test_cmp actual expected ' -test_expect_success 'Test subject and body of request open notifications.' ' +test_expect_success 'Test Cc, subject and body of request open notifications.' ' cat <<-EOD | sqlite3 aur.db && /* Use package request IDs which can be distinguished from other IDs. */ - INSERT INTO PackageRequests (ID, PackageBaseID, PackageBaseName, UsersID, ReqTypeID, Comments, ClosureComment) VALUES (3001, 1001, "foobar", 1, 1, "This is a request test comment.", ""); + INSERT INTO PackageRequests (ID, PackageBaseID, PackageBaseName, UsersID, ReqTypeID, Comments, ClosureComment) VALUES (3001, 1001, "foobar", 2, 1, "This is a request test comment.", ""); EOD >sendmail.out && "$NOTIFY" request-open 1 3001 orphan 1001 && + grep ^Cc: sendmail.out >actual && + cat <<-EOD >expected && + Cc: user at localhost, tu at localhost + EOD + test_cmp actual expected && grep ^Subject: sendmail.out >actual && cat <<-EOD >expected && Subject: [PRQ#3001] Orphan Request for foobar @@ -324,9 +329,14 @@ test_expect_success 'Test subject and body of request open notifications for mer test_cmp actual expected ' -test_expect_success 'Test subject and body of request close notifications.' ' +test_expect_success 'Test Cc, subject and body of request close notifications.' ' >sendmail.out && "$NOTIFY" request-close 1 3001 accepted && + grep ^Cc: sendmail.out >actual && + cat <<-EOD >expected && + Cc: user at localhost, tu at localhost + EOD + test_cmp actual expected && grep ^Subject: sendmail.out >actual && cat <<-EOD >expected && Subject: [PRQ#3001] Deletion Request for foobar Accepted -- 2.28.0 From marcus at tojoma.se Sun Aug 30 21:40:59 2020 From: marcus at tojoma.se (Marcus Andersson) Date: Sun, 30 Aug 2020 23:40:59 +0200 Subject: Highlight orphaned packages in table Message-ID: Hi! One minor feature that i personally would find helpful, is when you're scrolling thru the package list and "accidentally" find an orphaned package that you end up adopting; Unless you're specifically looking for packages to adopt, it's pretty hard to tell an orphaned package from a maintained one. Therefore I suggest a highlighting feature, making orphaned packages easier to spot as you scroll. Fore example, out of date package's version numbers is red when they are flagged like so, that behavior would be helpful for orphaned packages too. I am happy to implement this if it seems like a reasonable addition. Thanks! mackilanu