Commit graph

3211 commits

Author SHA1 Message Date
Hunter Wittenborn
eff7d478ab Updated CI tests for pip dependencies; Changed styling in install-deps.sh 2021-08-28 20:12:35 -05:00
Hunter Wittenborn
85b1a05d01 Removed pip dependencies from docker/scripts/install-deps.sh 2021-08-28 19:51:05 -05:00
Hunter Wittenborn
e61050adcf Added env/ to .gitignore
Folder will be used under virtualenv for pip dependencies
2021-08-28 19:31:11 -05:00
Hunter Wittenborn
e69004bc4a Alphabetized .gitignore file so it looks prettier 2021-08-28 19:29:44 -05:00
Hunter Wittenborn
0075ba3c33 Added .python-version from Pyenv 2021-08-28 19:27:36 -05:00
Hunter Wittenborn
b88fa8386a Removed pyalpm and srcinfo from pip requirements; Changed section title
Changed 'Generic' to 'General'
2021-08-28 19:25:51 -05:00
Hunter Wittenborn
fb908189b6 Began port of dependencies to pip
Adds Python dependencies to requirements list to allow installation via 
pip
2021-08-28 17:18:32 -05:00
Kevin Morris
f147ef3476
models.account_type: remove duplicated constants
Clearly made in mistake, removing to keep things organized.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-25 17:08:19 -07:00
Kevin Morris
a72ab61902
[FastAPI] fix dashboard template
Some columns should only be shown when a user is authenticated.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-25 16:57:19 -07:00
Kevin Morris
6eafb457ec
aurweb.util: fix code style violation
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-25 16:36:55 -07:00
Kevin Morris
f086457741
aurweb.redis: Reduce logging
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 21:59:15 -07:00
Kevin Morris
5a175bd92a
routers.html: add authenticated dashboard to homepage
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 21:59:13 -07:00
Kevin Morris
af51b5c460
User: add several utility methods
Added:
- User.voted_for(package)
    - Has a user voted for a particular package?
- User.notified(package)
    - Is a user being notified about a particular package?
- User.packages()
    - Entire collection of Package objects related to User.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 21:59:11 -07:00
Kevin Morris
5bd3a7bbab
RequestType: add name_display() and record constants
Just like some of the other tables, we have some constant
records that we use to denote types of things. This commit
adds constants which correlate with these record constants.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 21:59:10 -07:00
Kevin Morris
eb8ea53a44
PackageRequest: add status_display()
A helper function which provides a textual string conversion
of a particular Status column.

In a PackageRequest, Status is split up into four different types:
- PENDING  : "Pending", PENDING_ID: 0
- CLOSED   : "Closed", CLOSED_ID: 1
- ACCEPTED : "Accepted", ACCEPTED_ID: 2
- REJECTED : "Rejected", REJECTED_ID: 3

This commit adds constants for the textual strings and the
IDs. It also adds a PackageRequest.status_display() function which
grabs the proper display string for a particular Status ID.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 21:59:08 -07:00
Kevin Morris
469c141f6b [FastAPI] bugfix: remove use of scalar() in plural context
Anything where we can have more than one of something, scalar()
cannot be used.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 20:59:38 -07:00
Kevin Morris
d9cdd5faef
[FastAPI] Modularize homepage and add side panel
This puts one more toward completion of the homepage
overall; we'll need to still implement the authenticated
user dashboard after this.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 19:58:32 -07:00
Kevin Morris
9e73936c4e
add aurweb.cache, a redis caching utility module
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 19:58:31 -07:00
Kevin Morris
968ed736c1
add python-orjson dependency
python-orjson speeds up a lot of JSON serialization steps,
so we choose to use it over the standard library json module.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 19:58:29 -07:00
Kevin Morris
91e769f603
FastAPI: add redis integration
This includes the addition of the python-fakeredis package,
used for stubbing python-redis when a user does not have a
configured cache.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 19:58:28 -07:00
Kevin Morris
96d1af9363
docker-compose: add redis service
Now, the fastapi docker-compose service uses the new redis
service for a cache option.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-17 19:58:26 -07:00
Kevin Morris
35851d5533
Docker: add service 'memcached'
Additionally, setup memcached for php-fpm.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-16 22:09:09 -07:00
Kevin Morris
ae0f69a5e4
Docker: remove intervals and timeouts
These weren't needed at all and provided false negatives in
general. Removed them to let Docker deal with them.

Additionally. 'exit 0' -> 'echo' for ca's command; 'exit 0'
happens to depend on the shell running Docker (it seems).
echo is quite a bit more agnostic.

Moreso, added mariadb deps to php-fpm and fastapi.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-16 20:07:25 -07:00
Kevin Morris
4ade8b0539 routers.packages: Simplify some existence checks
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-09 23:42:54 -07:00
Kevin Morris
bace345da4
Docker: support both '%' and 'localhost' in mariadb
This is needed to be able to reach the mysql service from
other hosts or through localhost. Handling both cases here
means that we can support both localhost access and host access.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-08-08 21:46:46 -07:00
Kevin Morris
04d1c81d3d bugfix: fix extra dependency annotations
These were being displayed regardless of the dep type
and state of DepDesc. This is fixed with this commit.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 22:05:42 -07:00
Kevin Morris
88569b6d09 add /pkgbase/{name} route
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 20:48:40 -07:00
Kevin Morris
ae3d302c47 implement /packages/{name} as its own route
A few things added with this commit:

- aurweb.packages.util
    - A module providing package and pkgbase helpers.
- aurweb.template.register_filter
    - A decorator that can be used to register a filter:
      @register_filter("some_filter") def f(): pass

Additionally, template partials have been split off a bit
differently. Changes:

- /packages/{name} is defined in packages/show.html.
- partials/packages/package_actions.html is now
  partials/packages/actions.html.
- partials/packages/details.html has been added.
- partials/packages/comments.html has been added.
- partials/packages/comment.html has been added.
- models.dependency_type additions: name and id constants.
- models.relation_type additions: name and id constants.
- models.official_provider additions: base official url constant.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 20:48:40 -07:00
Kevin Morris
2d3d03e01e templates: Translate pkgbase.html and partials
+ Include the `is_maintainer` context key.
+ Use `is_maintainer` in more locations.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 20:48:40 -07:00
Leonidas Spyropoulos
1e1c0c3fe5 [FastAPI] Basic pkgbase template
Co-author: Kevin Morris <kevr@0cost.org>

Signed-off-by: Leonidas Spyropoulos <artafinde@gmail.com>
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 20:48:40 -07:00
Kevin Morris
9197f86a03 .dockerignore: ignore user-produced configs
We don't want these to even enter the Docker environment.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 20:38:59 -07:00
Kevin Morris
53391bec1a sharness: do not use spaces in trash directory
With a recent curl update, it now rejects URLs with spaces in it.
We should probably fix this so that we can sanitize urls with spaces
to be used properly, but for now, just remove spaces in the directory.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-27 16:24:34 -07:00
Kevin Morris
4959f62cf5 rendercomment: move Repository init to __init__
This makes rendercomment a slight bit more lazy. Now,
it will only actually initialize a pygit2.Repository
when it needs to produce a Git commit inline.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 18:48:28 -07:00
Kevin Morris
a6ca345af4 Docker: Fix git clone url in fastapi/php-fpm
Signed-off-by: Kevin Morris <kevr@0cost.org>

Docker: fix php-entrypoint git clone uri

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 18:47:36 -07:00
Kevin Morris
d57dfd4d36
PackageBase: test Popularity conversion
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 14:16:32 -07:00
Kevin Morris
c05fafea0e PackageComment: default RenderedComment to str()
With this, `bool(PackageComment.RenderedComment) == False`

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 12:47:08 -07:00
Kevin Morris
13b4dbf541 PackageRelation: fix primary key relationships
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 12:46:59 -07:00
Kevin Morris
b4e46450b5 PackageDependency: fix primary key relationships
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 12:46:34 -07:00
Kevin Morris
ec38d2f5a0 PackageBase: automatically cast Popularity to float
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-20 12:46:19 -07:00
Kevin Morris
3f1ea7d31a Merge branch 'pu_rss' into pu 2021-07-13 22:38:26 -07:00
Kevin Morris
ae953ce19b Merge branch 'pu_accounts' into pu 2021-07-13 21:57:06 -07:00
Kevin Morris
77d54b5e1b Merge branch 'pu_tu_addvote' into pu 2021-07-13 21:16:41 -07:00
Kevin Morris
e0ee881b67 Docker: fix mariadb-entrypoint user host
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-10 15:05:09 -07:00
Kevin Morris
c54000045c add [pycodestyle] config to setup.cfg
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-10 15:03:07 -07:00
Kevin Morris
7542798335 .gitignore: add more user configs and Python build files
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-10 14:57:19 -07:00
Kevin Morris
80ce10eb0f add /pyrightconfig.json to .gitignore
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-02 11:29:00 -07:00
Kevin Morris
eec09dec3e [FastAPI] add /rss and /rss/modified
There are slight differences in that, with `python-feedgen`,
an empty description field completely omits the description,
but includes the description when there is one.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-01 11:09:09 -07:00
Kevin Morris
8d6e782ba1 add python-feedgen dependency
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-01 11:09:09 -07:00
Kevin Morris
021a1c8fb6 add /accounts/ (get, post) routes
Slight markup changes, same style overall and same
form parameters as the PHP implementation.

In addition, we've disabled the "left" and "right"
navigation buttons when we're at the border of the
table.

CSS Changes:

- Added similar styling to submit `<buttons>` that submit `<input>` had.
- Added .results tr td[align="{left,right}"] styling to align
  the result table's `More -->` button to the right of the table.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-01 11:08:56 -07:00
Kevin Morris
450469e3d6 add /addvote/ (get, post) routes
Another part of the "Trusted User" collection of routes.
This allows a Trusted User to create a proposal.

New Routes:

- get `/addvote/`
- post `/addvote/`

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-07-01 11:08:44 -07:00