Commit graph

3436 commits

Author SHA1 Message Date
Kevin Morris
040bb0d7f4
Revert "feat(PHP): add aurweb Prometheus metrics"
This reverts commit 986fa9ee30.
2021-10-15 13:19:07 -07:00
Kevin Morris
5bfc1e9094
Revert "fix(PHP): sanitize and produce metrics at shutdown"
This reverts commit 22b3af61b5.
2021-10-15 13:18:58 -07:00
Kevin Morris
22b3af61b5
fix(PHP): sanitize and produce metrics at shutdown
This change now requires that PHP routes do not return HTTP 404
to be considered for the /metrics population. Additionally,
we make a small sanitization here to avoid trailing '/'
characters, unless we're on the homepage route.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-13 17:20:29 -07:00
Kevin Morris
748faca87d
fix(FastAPI): translate some untranslated strings
Affects: templates/partials/packages/search_actions.html

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-12 18:04:07 -07:00
Kevin Morris
3d971bfc8d
add Bug.md GitLab issue template
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-11 14:48:00 -07:00
Kevin Morris
68383b79e2
add Feature.md GitLab issue template
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-11 14:13:29 -07:00
Kevin Morris
4525a11d92
fix(FastAPI): change a deep copy instead of original
This was updating offsets and causing unintended behavior.
We should be a bit more functional anyway.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-10 01:00:36 -07:00
Kevin Morris
27fbda5e7b
feat(FastAPI): add get_(errors|successes) testing HTML helpers
These functions will allow us to more easily check errors or success
messages when testing routes.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-09 22:04:48 -07:00
Kevin Morris
34c96ed81b
add Feedback.md GitLab issue template
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-09 20:50:41 -07:00
Kevin Morris
d9ab65cb6f
add Feedback.md GitLab issue template
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-09 20:49:11 -07:00
Kevin Morris
5bbc94f2ef
fix(FastAPI): add /pkgbase/{name}/flag (get)
This was missed in the [un]flag (post) commit.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-09 18:41:32 -07:00
Kevin Morris
305d077973
feat(FastAPI): add /pkgbase/{name}/adopt (post)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-08 15:58:00 -07:00
Kevin Morris
72d6016da4
Merge branch 'pu_popupdate' into pu 2021-10-08 15:42:50 -07:00
Kevin Morris
63498f5edd
fix(FastAPI): use popupdate when [un]voting
The `aurweb.scripts.popupdate` script is used to maintain
the NumVotes and Popularity field. We could do the NumVotes
change more simply; however, since this is already a long-term
implementation, we're going to use it until we move scripts
over to ORM.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-08 15:29:47 -07:00
Kevin Morris
27c5d17fc8
Merge branch 'fix-email-input' into pu 2021-10-07 23:32:27 -07:00
Kevin Morris
4b95ec41ed
Merge branch 'fix-merge-type' into pu 2021-10-07 23:21:28 -07:00
Kevin Morris
01fb42c5d9
fix(scripts.popupdate): use forced-utc timestamp
Additionally, clean up some controversial PEP-8 warnings by
removing the '+' string concatenation.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 22:46:07 -07:00
Kevin Morris
d38abd7832
feat(FastAPI): add /pkgbase/{name}/delete (get, post)
In addition, we've had to add cascade arguments to backref so
sqlalchemy treats the relationships as proper cascades.

Furthermore, our pkgbase actions template was not rendering
actions properly based on TU credentials.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 20:36:24 -07:00
Kevin Morris
4e7d2295da
fix(FastAPI): add package-related missing backref cascades
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 20:25:24 -07:00
Kevin Morris
0ddc969bdc
feat(FastAPI-dev): add package_delete helper
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 20:25:23 -07:00
Kevin Morris
ed68fa2b57
feat(FastAPI): add aurweb.db.delete_all(iterable)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 20:25:23 -07:00
Kevin Morris
c8d01cc5e8
feat(FastAPI): add aurweb.util.apply_all(iterable, fn)
A helper which allows us to apply a specific function to each
item in an iterable.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 20:25:20 -07:00
Kevin Morris
16d516c221
feat(FastAPI): add /pkgbase/{name}/disown (get, post)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 20:13:40 -07:00
Kevin Morris
0a02df363a
feat(FastAPI): add /pkgbase/{name}/[un]vote (post)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 18:22:04 -07:00
Kevin Morris
0dfff2bcb2
feat(FastAPI): add /pkgbase/{name}/[un]notify (post)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 17:23:14 -07:00
Kevin Morris
8eadb4251d
feat(FastAPI): add /pkgbase/{name}/[un]flag (post)
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 16:04:54 -07:00
Kevin Morris
55ebfa0d01
Merge branch 'pu_auth_redirect_vars' into pu 2021-10-07 12:42:53 -07:00
Kevin Morris
2e6f8cb9f4
change(FastAPI): @auth_required login kwarg defaulted to True
We pretty much want @auth_required to send users to login
if we enforce auth requirements but don't otherwise specify
a way to deal with it.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 12:38:34 -07:00
Kevin Morris
a756691d08
change(FastAPI): user_developer_or_trusted_user always True
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 10:00:46 -07:00
Kevin Morris
dc11a88ed3
change(FastAPI): depend on auth_required redirect for pkgbase actions
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 00:40:22 -07:00
Kevin Morris
8bc1fab74d
change(FastAPI): automate request login requirement
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 00:27:51 -07:00
Kevin Morris
75c49e4f8a
feat(FastAPI): support {named} fmt in auth_required redirect
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-07 00:27:47 -07:00
Kevin Morris
e5299b5ed4
fix(FastAPI): pkgbase/package tests
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-06 23:17:08 -07:00
Kevin Morris
33b18907eb
feat(FastAPI): add CRED_PKGBASE_MERGE
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-06 22:30:15 -07:00
Kevin Morris
889c5b1e21
fix(FastAPI): pkgbase actions template
Display Delete, Merge and Disown actions based on user credentials.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-06 22:09:58 -07:00
Steven Guikal
a54a09f61d fix(FastAPI): fix padding on email inputs
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-05 17:50:22 -04:00
Steven Guikal
1bce53bbb7 fix(FastAPI): mark user and passwd as required fields 2021-10-05 14:36:46 -04:00
Steven Guikal
1956be0f46 fix(FastAPI): prefill login fields with entered data 2021-10-05 14:13:48 -04:00
Kevin Morris
82a3349649
Merge branch 'fix-reqname-tr' into pu 2021-10-05 01:48:14 -07:00
Kevin Morris
aac13cd123
Merge branch 'fix-key-case' into pu 2021-10-05 01:38:18 -07:00
Steven Guikal
f392b3607e fix(FastAPI): add missing translation filter for request type
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-04 17:42:55 -04:00
Steven Guikal
9af76a73a3 fix(FastAPI): include MergeBaseName in merge request type
This was done on the dedicated requests page, but missed on the
dashboard.

Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-04 17:36:10 -04:00
Steven Guikal
5c179dc4d3 fix(FastAPI): use consistent ordering on dashboard and request page
Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-04 17:11:29 -04:00
Steven Guikal
08068e0a5c fix(FastAPI): use configured letter case for SSH fingerprints
Currently, the config parser converts all keys to lowercase which is
inconsistent with the old PHP behavior. This has been fixed and relevant
fingerprint-getting functions have been simplified without changes in
behavior.

Signed-off-by: Steven Guikal <void@fluix.one>
2021-10-04 18:00:50 +00:00
Kevin Morris
7bfc2bf9b4
fix(FastAPI): Improve sqlite testing speed
This commit adds a new Arch dependency: `libeatmydata`, which
provides the `eatmydata` executable that stubs out fsync() operations.
We use `eatmydata` to run our sharness and pytests in Docker now.

With `autocommit=True`, required by SQLAlchemy to keep the
session up to date with external DB modifications, many fsync
calls are used in the SQLite backend; especially because we're wiping
and creating records in every DB-bound test.

**Before:**

- mysql: 1m42s (elapsed during pytest run)
- sqlite: 3m06s (elapsed during pytest run)

**After:**

- mysql: 1m40s (elapsed during pytest run)
- sqlite: 1m50s (elapsed during pytest run)

Shout out to @klausenbusk, who suggested this as a possible fix,
and it was. Thanks, Kristian!

Closes #120

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-03 15:59:52 -07:00
Kevin Morris
b5f8e69b8a
feat(FastAPI): use SQLAlchemy's scoped_session
Closes #113

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-03 10:47:15 -07:00
Kevin Morris
f6141ff177
feat(FastAPI): add /requests/{id}/close (get, post)
Changes from PHP:

- If a user submits a POST request with an invalid reason,
  they are returned back to the closure form with a BAD_REQUEST status.
- Now, users which created a PackageRequest have the ability to close
  their own.
- Form action has been changed to `/requests/{id}/close`.

Closes https://gitlab.archlinux.org/archlinux/aurweb/-/issues/20

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 22:47:05 -07:00
Kevin Morris
1c031638c6
feat(FastAPI): add /pkgbase/{name}/request (post)
This change implements the FastAPI version of the
/pkgbase/{name}/request form's action.

Changes from PHP:

- Additional errors are now displayed for the **merge_into** field,
  which are only displayed when the Merge type is selected.
    - If the **merge_into** field is empty, a new error is displayed:
      'The "Merge into" field must not be empty.'
    - If the **merge_into** field is given the name of a package base
      which does not exist, a new error is displayed:
      "The package base you want to merge into does not exist."
    - If the **merge_into** field is given the name of the package
      base that a request is being created for, a new error is
      displayed: "You cannot merge a package base into itself."
- When an error is encountered, users are now brought back to
  the request form which they submitted and an error is displayed
  at the top of the page.
- If an invalid type is provided, users are returned to a BAD_REQUEST
  status rendering of the request form.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 22:46:49 -07:00
Kevin Morris
ad8369395e
feat(FastAPI): add /pkgbase/{name}/request (get)
This change brings in the package base request form
for new submissions.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 22:46:48 -07:00
Kevin Morris
1cf9420997
feat(FastAPI): allow reporters to cancel their own requests (1/2)
This change required a slight modification of how we handle
the Requests page. It is now available to all users.

This commit provides 1/2 of the implementation which actually
satisfies this feature. 2/2 will contain the actual implementation
of closures of requests, which will also allow users who created
the request to decide to close it.

Issue: https://gitlab.archlinux.org/archlinux/aurweb/-/issues/20

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-10-02 22:46:38 -07:00