Commit Graph

465 Commits

Author SHA1 Message Date
Lephe b3d99b93f8
account: add a theme setting (#14) 2021-07-08 11:43:09 +02:00
Lephe 8f0e15029c
utils: add a simple regex-based CSS validator (#11)
* Property name is [a-zA-Z-]+
* Value is anything but ;{}'"
2021-07-08 10:59:43 +02:00
Lephe 61f48259f2
trophy: fix deleteion 2021-07-08 10:58:53 +02:00
Lephe 5904019048
css: fix the size of XP bars 2021-07-08 10:57:55 +02:00
Lephe cc5f4e481b
account: member deletion, with post anonymization (#57) 2021-07-08 10:39:22 +02:00
Lephe bee912f88c
model: add all deletion methods (except Guest/Member) 2021-07-07 21:23:35 +02:00
Lephe 3c5599adf7
model: avoid the foreign key cycle between Thread and Comment
By specifying use_alter=True on one of the keys, the ORM will generate
an ALTER command to set the second foreign key after inserting both
objects, in case two new objects referring to each other have to be
created.

See: https://docs.sqlalchemy.org/en/14/core/exceptions.html#sqlalchemy.exc.CircularDependencyError
2021-07-07 19:38:28 +02:00
Lephe 3876e3470e
forum: improve responsiveness for viewports < 500px (#75) 2021-07-07 19:23:53 +02:00
Lephe fe039e4092
forum: fix a bug in c59e84485 for forums with no topics
WHERE would be on its own without argument.
2021-07-07 19:22:36 +02:00
Lephe e29c73d09e
utils/render: remove obsolete bug notice
Fixed by e99e45b4c.
2021-07-07 18:57:54 +02:00
Lephe f75f1618bc
add a developer warning for slow requests (#63) 2021-07-07 18:42:17 +02:00
Lephe c59e844852
forum: count comments for all presented topics in a single request (#63)
It appears as though performing a lot of requests is the most costly
aspect of listing comment counts per topic; this change aims to address
that by reading all the counts in a single request.

On my computer, this changes loading times from an absolute 100-200 ms to
50-100 ms most of the time. The request impact is not easy to measure as a
couple ms is small enough to fall in the range of disk access and other
semi-random events.
2021-07-07 17:26:22 +02:00
Lephe b00d44ddc1
model: index comments by thread for faster lookup 2021-07-07 16:30:21 +02:00
Lephe daadd21877
utils/converters: use ValidationError instead of Exception
This ensures that after validation the page is resolved as a 404 instead
of displaying a 500.
2021-07-07 15:23:55 +02:00
Eragon 6cbf5a51f9
Implémentation du "skip to content" #94 2021-04-28 19:30:41 +02:00
Darks 55beccf7f4
widgets: humanize sizes of attachements 2021-04-27 19:35:37 +02:00
Darks 9afdc63a8e
filters: add humanize filter 2021-04-27 19:33:21 +02:00
Lephe 4be0e1572c
alembic: track string field lengths 2021-04-25 22:52:30 +02:00
Darks d7d8244da9
polls: small fix on template 2021-03-16 18:51:11 +01:00
Lephenixnoir 40aeb1674e Merge pull request 'Login as' (#90) from login_as into dev
Reviewed-on: https://gitea.planet-casio.com/devs/PCv5/pulls/90
2021-03-10 16:15:02 +01:00
Darks 8bdf3909ea
login_as: fixed some issues
See https://gitea.planet-casio.com/devs/PCv5/issues/90#issuecomment-1131
2021-03-06 11:36:35 +01:00
Darks 87ef91b9e3
login_as: add function to login as arbitrary account 2021-03-05 23:56:03 +01:00
Darks d783feb7d0
PEP8: removed trailing spaces 2021-03-05 23:56:03 +01:00
Lephe 284e8986fa
forum: random improvements to overflows on the forum
* Wrap long usernames
* Prevent images from overflowing to the right
2021-03-05 13:52:55 +01:00
Lephe 07a91c4663
admin: show group CSS on user editor 2021-02-27 11:50:40 +01:00
Lephe 1d63d05c1e
admin: show trophy icons on user editor 2021-02-27 11:42:29 +01:00
Lephe f5f1a445ea
master: update special privilege names for GLaDOS 2021-02-27 10:14:59 +01:00
Lephe 6f98cba65e
review of privileges and forum permissions
* Sorted privileges into categories, similar to the v4.3 style

Added privilege check utilities:
* Forum: is_news(), is_default_accessible() and is_default_postable()
* Member: can_access_forum(), can_post_in_forum(), can_edit_post(),
  and can_delete_post()

Unfortunately current_user is not a Guest when logged out, so one
cannot usually write current_user.can_*() without checking for
authentication first, so the checks are still somewhat verbose.

Reviewed forum permissions; the following permission issues have been
fixed (I have tested most but not all of them prior to fixing):

* app/routes/forum/index.py: Users that were not meant to access a
  forum could still obtain a listing of the topics
* app/routes/forum/topic.py: Users that were not meant to see topics
  could still read them by browsing the URL
* app/routes/forum/topic.py: Authenticated users could post in any
  topic, including ones that they should not have access to
* app/routes/posts/edit.py: Users with edit.posts (eg. mods) could edit
  and delete messages in forums they can't access (eg. creativecalc)

* app/templates/account/user.html: Users with admin panel access would
  see account editing links they can't use (affects developers)
* app/templates/base/navbar/forum.html: The "Forum" tab would list all
  forums including ones the user doesn't have access to
* app/templates/forum/index.html: Users would see every single forum,
  including ones they can't access
* app/template/widgets/thread.html: Anyone would see Edit/Delete links
  on every message, even though most were unusable

Miscellaneous changes:
* app/routes/forum/topic.py: Ordered comments by date as intended,
  which I assume worked by chance until now
* Removed the old assets/privs.txt files which is now superseded by the
  list implemented in app/data/groups.yaml

This commit changes group and forum information, run master.py with:
@> forums update
@> groups update
2021-02-26 18:32:45 +01:00
Lephe d50b58cd24
(random improvements on texts) 2021-02-26 18:31:10 +01:00
Lephe 3ee3794818
master: fix groups not fully updating
Fixes c8661ca50.
2021-02-26 18:31:10 +01:00
Darks 0edc996287
markdown: add linkify extension 2021-02-24 00:38:26 +01:00
Darks 41d1411f86
markdown: add hard breaks with \\
Plus some PEP8 enhancements
2021-02-24 00:06:49 +01:00
Darks f722d700c2
markdown: add some tags to bleach allowlist 2021-02-23 23:25:20 +01:00
Darks 53afccf2a3
markdown: fixed allowlists 2021-02-23 13:49:14 +01:00
Darks 6136c6e9bf
markdown: add better sanitization
And disable nl2br extension
2021-02-23 13:30:09 +01:00
Darks eba1b7dd3b
markdown: better input sanitization 2021-02-23 12:00:34 +01:00
Eldeberen 7e7e865430
Merge branch 'dev' of gitea.planet-casio.com:devs/PCv5 into dev 2021-02-22 23:54:51 +01:00
Eldeberen fecbdffee8
polls: add link in admin panel 2021-02-22 23:54:47 +01:00
Eldeberen 938516cb3f
polls: added admin panel and deletion form 2021-02-22 23:50:19 +01:00
Eldeberen d6512bb197
polls: added multi-choices polls 2021-02-22 22:49:11 +01:00
Eldeberen b23fc15b6e
polls: changes in template, display results when user has voted 2021-02-21 21:15:54 +01:00
Eldeberen 5958605d2b
forum: fix message for necropost warning 2021-02-21 20:29:55 +01:00
Eldeberen f10d5404c2
forum: fix #84 2021-02-21 20:17:48 +01:00
Eragon f3bb8858f0
Vérification de l'existence d'une signature pour l'afficher 2021-02-21 12:17:55 +01:00
Eldeberen 0c7474d8ba
pclink: add handle for topics
rewrite some handles in french
2021-02-21 12:02:12 +01:00
Eldeberen cd8ce4f5bc
admin: fix name edition through admin panel (#85) 2021-02-20 19:32:18 +01:00
Eldeberen 894a0b6549
pclink: fix link for users 2021-02-20 19:09:30 +01:00
Lephe 1d457d7e65
topic: fix model preventing Post from polymorphic loading as Topic 2021-02-20 19:03:14 +01:00
Eldeberen d0714d87b0
poll: phoque it. XML is much more restrictive than html 2021-02-20 18:43:37 +01:00
Eldeberen e2c84df6e3
poll: fixed a ***** bug 2021-02-20 18:31:40 +01:00