Commit Graph

113 Commits

Author SHA1 Message Date
Lephe 8ff21c615d
program: add infrastructure for the progrank job (#114)
* Add an automatic job every day at 4 AM to recompute the progrank of
  every program. Currently everyone gets progrank 0.

[MIGRATION] This commit contains a new version of the schema.

[SETUP]
* Install flask-crontab (with pip)
* Run `flask crontab add` to register the jobs
2022-06-15 11:27:29 +01:00
Lephe db0e42d285
programs: add tag input and display (#114)
* Add a TagListField which automatically validates its input against the
  TagInformation database, and has a richer .selected_tags() method
* Add a dynamic tag input widget, available through a macro (*import
  with context*), that supports both JS and non-JS input
* Add a TagInformation.all_tags() function
* Add colored tag display to all themes
* Fix a bug causing programs to have no names
* Add tags: games.action, games.narrative, courses.informatics

[MASTER] Run the 'update-tags' command of master.py.
2022-06-14 23:19:41 +01:00
Lephe b047ed97af
programs: program creation + view + comments
This is very much a work in progress, but the main ideas are here.

[MIGRATION] This commit contains a new version of the schema.
2022-05-19 20:34:46 +01:00
Darks f64e3a2c39
debugger: add some style to enhance it 2022-05-12 20:07:28 +02:00
Darks eb5ce1bd5c
attachement: switch to uuid + check permission in dl widget (#109)
Also added is_default_accessible() to Thread class as its owner may be a 
Topic with forum access restrictions or public main content (like 
Program)

[MIGRATION] This commit contains a new version of the schema. /!\ This 
migration breaks all attachments
2022-04-26 23:29:11 +02:00
Darks 3e399fb4c4
gallery: second prototype, evolving into a beta 2022-04-26 01:38:33 +02:00
Darks 17f5e82a2a
pclinks: switched to <> as delimiters (#108)
And some other enhancements
2022-04-24 17:50:46 +02:00
Darks 2119329997
widgets: add '[[f: 123]]' pclink widget 2022-04-24 17:24:47 +02:00
Lephe f53032fc88
markdown: add an extension for image/video galleries
This will be used on program pages. Currently there is no check that
list elements are images and videos.
2022-04-21 22:07:49 +01:00
Lephe 610fe6f1fd
markdown: allow videos with size and positioning
Same options as for images, except for [pixelated]. Supported sources
are standard videos and YouTube, and there is basic auto-detection which
avoids the need to set the [video] attribute.
2022-04-21 20:43:50 +01:00
Lephe 48d6c1c03c
markdown: allow positioning attributes on images
New attributes
  * left, center, right: Exactly what you expect
  * float-left, float-right: Also just what you expect

Currently there is no way to force a clear.
2022-04-21 20:03:22 +01:00
Lephe e9c1f04f42
markdown: add a MediaExtension that allows attributes on images
Supported attributes:
  * size=<WIDTH>x<HEIGHT>, both being optional
  * pixelated

In the near future it will also support audio files and videos.
2022-04-21 19:31:18 +01:00
Darks dda7cce5d5
Updated WTForms imports 2022-04-14 20:01:45 +02:00
Lephe 19586f9087
fix incorrect date display omitting years 2021-10-03 17:34:30 +02:00
Darks 87d795959f
less (#97): first shot to Less
Quick switch, still may need some refacto and delete unused code
2021-07-14 16:30:45 +02:00
Lephe 7fc4424812
forum: use a more readable date format 2021-07-10 17:54:07 +02:00
Lephe 1837f8f9a6
forum: anti-bot fields for guest topics and comments (#51) 2021-07-10 12:30:12 +02:00
Lephe 888006cf86
theme: add Tituya's v43 theme 2021-07-10 09:28:36 +02:00
Lephe c4c9421beb
utils: allow empty CSS in validator 2021-07-08 17:47:01 +02:00
Lephe 619ea85eeb
css: add dark mode code, and improve code tables 2021-07-08 16:50:28 +02:00
Lephe 7301aa954b
theme: update dark theme, override SimpleMDE (#14)
This commit updates the dark theme by FlamingKite, and adds a
simplemde-override.css file which overrides most of SimpleMDE's styling
for the edition area (CodeMirror) to replace fixed, bright-style values
with references to theme variables.
2021-07-08 14:09:17 +02:00
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 e29c73d09e
utils/render: remove obsolete bug notice
Fixed by e99e45b4c.
2021-07-07 18:57:54 +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
Darks 9afdc63a8e
filters: add humanize filter 2021-04-27 19:33:21 +02: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
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
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 0c7474d8ba
pclink: add handle for topics
rewrite some handles in french
2021-02-21 12:02:12 +01:00
Eldeberen 894a0b6549
pclink: fix link for users 2021-02-20 19:09:30 +01:00
Eldeberen b5630e0079
md: add pclink for users 2021-02-20 17:36:36 +01:00
Eldeberen 9d08f81342
poll,md: adds pclink for polls 2021-02-20 17:17:33 +01:00
Eldeberen 85dfde3811
md: improved markdown 2021-02-20 15:39:52 +01:00
Darks 63baae9683
Merge branch 'glados' of gitea.planet-casio.com:devs/PCv5 into dev 2020-11-11 13:47:24 +01:00
Darks 98de289ea1
glados: added glados socket and example wrapper 2020-11-11 13:28:53 +01:00
Lephe 1d38f906ee
admin/members: add a dynamic regex/logic filter for the member list
This commit introduces a client-side table filter that supports regexes
and propositional logic to filter table rows.

A table can be filtered if it has the [filter-target] class and its
first row has <th> tags with a [data-filter] attribute specifying column
names.

The filter itself is a div with the [form] and [filter] classes, and a
[data-target] attribute pointing to the table to filter. The filter
contains a text <input> which is passed to filter_update() when the
filter expression is validated.

The client-side filter code runs the expression through a basic lexer
and parser, then matches the result for every row in the target table.
The [textContent] of each cell is used for string and regex matching.
2020-11-02 14:38:28 +01:00
Darks 0d8dd70956
security: add CSRF protection globally
The decorator @check_csrf can be used to check CSRF protection when 
using GET links (like delete a post or logout)
2020-09-26 14:48:30 +02:00
Darks 9409113167
markdown: add markdown rendering 2020-09-18 19:43:10 +02:00
Eragon b5f1ea1d1d
Un seul chargement du script même avec plusieurs textarea
Le script est chargé de manière standard, comme les autres scripts.
L'init du script est lancé seulement après le chargement complet
de toute les dépendances de la page.
2020-09-18 11:53:50 +02:00
Eragon c419716806
Utilisation de https://github.com/sparksuite/simplemde-markdown-editor comme éditeur
Ajout des fichiers dans les fichiers statiques. (min.css & min.js).
Supression des scripts custom d'édition.
Remplacement par les bon appels de fonctions dans app/templates/widgets/editor.html
2020-09-17 22:41:32 +02:00
Darks df745fd4a6
ldap: add sub-organization feature 2020-08-25 23:05:54 +02:00
Darks c5e99807e3
fix a typo in many files 2020-08-25 22:57:45 +02:00
Darks 7395835e71
refact: models files are nom uniform (all singular) 2020-08-06 21:19:01 +02:00