Commit Graph

1006 Commits

Author SHA1 Message Date
Bauke
cb6c1ea43d Fix the Pyramid debug toolbar not being accessible in the Docker-based Vagrant environment.
Closes tildes-community/tildes-cf#8

See merge request tildes-community/tildes-cf!3
2025-03-10 22:50:43 -06:00
talklittle
6be3688d3c GitLab CI testing
See merge request tildes-community/tildes-cf!2
2025-03-10 22:50:22 -06:00
talklittle
49886af37e Add Docker provider for Vagrant development environment
See merge request tildes-community/tildes-cf!1
2025-03-10 22:49:00 -06:00
Deimos
51a456bcf9 ArrayOfLtree: fix handling of "null" string value
If a topic tag is set to "null", the data in the column will have double
quotes around it (to distinguish it from an actual null value). This
wasn't being handled and would cause a crash when trying to parse the
value.
2025-02-28 13:26:28 -07:00
xzi
2962f0388b Readd Nord + Black reformat topic.py 2024-03-11 14:24:45 -04:00
Deimos
f355bc6a80 robots.txt: Block OpenAI GPTBot 2024-02-17 22:46:50 -07:00
kencx
d0d6b6d3dc Require password when modifying account recovery 2023-07-17 00:26:56 -06:00
Bauke
462dbfb580 Map the content_security_policy header to the request_uri. 2023-07-17 05:24:08 +00:00
Deimos
0bfcea102b Fix groups with subgroups for logged-out viewers 2023-07-11 02:23:27 -06:00
Deimos
a6de9d4880 Order subgroups in sidebar alphabetically 2023-07-10 23:19:40 -06:00
Deimos
11370abe7d Show topics from subscribed subgroups (toggleable)
Now that we have more subgroups, it was an issue that visiting a parent
group would always show the topics from all of the subgroups, regardless
of whether you were subscribed to them or not.

This changes it so that, by default, only topics from subgroups the user
is subscribed to will be shown. There is also a link at the top of the
listing to toggle to the other view (all subgroups or only subscribed
subgroups).
2023-07-10 23:15:42 -06:00
Aeledfyr
991fe087f4 Add ids to settings headings to allow links to sub-sections
Fixes #638
2023-06-23 07:19:26 +00:00
Aeledfyr
5081b86140 Apply proper styling to comments that are both new and by OP
Fixes #371.

Adds `.is-comment-by-op` class even if the comment is new or by
the current user.  This fixes the bolding of the "(OP)" tag and
preserves the colors from `new` or `mine`, which have priority
over `op` due to their ordering in `_comment.scss`.
2023-06-23 07:19:26 +00:00
Aeledfyr
a2599276b2 Keep dropdown menu visible when using keyboard navigation
Part of #747, prevents the dropdown menu from hiding itself
when the user tabs to an item in the list.
2023-06-23 07:19:26 +00:00
Aeledfyr
46cef48be1 Fix theme preview colors for the Zenburn theme
No associated issue, just a minor fix to make the Zenburn theme
use the correct colors for its button in the theme preview page,
rather than the default theme colors.
2023-06-23 07:19:26 +00:00
Aeledfyr
3b20b1f83b Fix visited link coloring hiding subscribed status in groups list
Fixes #720 by making the color explicitly apply in the :visited
case.  (Other specificity hacks could fix this, but this is the
cleanest.)
2023-06-23 07:19:26 +00:00
Aeledfyr
f51e664752 Fix striped table backgrounds within blockquotes
Fixes #659 by defaulting to the primary background color for normal
table rows.  As noted in the issue, this still looks a bit weird,
but it's no longer inconsistent.
2023-06-23 07:19:26 +00:00
Kaleb Elwert
6a8d2753e0 Accept the TOTP token before and after the current 2023-06-21 06:05:29 +00:00
Andrew Shu
996d52b185 Use npm ci for Ansible task
Otherwise Ansible never creates the node_modules directory.
2023-06-20 06:52:21 +00:00
Deimos
0dbb031562 Re-add donations via Stripe
Multiple people have been asking me how they can make a one-time
donation without going through GitHub or Patreon, so I'll re-add this
for now but will need to keep an eye out for fraud and potentially
disable it again soon.
2023-06-08 16:18:07 -06:00
Deimos
b485e15963 Remove ability to accept donations via Stripe
All of the Stripe payments have been fraud for months now, it's not
worth continuing to deal with the refunds and chargebacks.
2023-05-09 00:45:14 -06:00
Deimos
436c3f24f0 Update pypi package versions (requirements.txt)
A few tiny changes needed related to a few of the libraries, but nothing
significant.
2021-07-22 02:19:51 -06:00
Deimos
d928431058 Pin versions for Pyramid and SQLAlchemy
These updates seem like they won't be trivial. I'll come back to them
soon, but I'll need to look at them more carefully and I can update
everything else in the meantime.
2021-07-22 02:18:37 -06:00
Deimos
ff5a3d82cb Update Black to 21.6b0
This found a few docstrings that I had messed up.
2021-07-14 21:34:47 -06:00
Deimos
ed38ce5790 Type annotations: use standard generics (PEP 585)
As of Python 3.9, it's no longer necessary to import things like List
and Dict from the typing module, and we can just use the built-in types
like this.
2021-07-14 21:22:52 -06:00
Deimos
31afe0a8ba Update mypy to 0.910
This also involved installing some new packages for the type stubs for a
few of the major third-party libraries.

I also had to change some of the imports in some model files in strange
ways, I'm not sure why some of these were necessary. I suspect this
might be a bug in mypy, but I'm not sure if I'll be able to build a
reproduction of it to be able to report it.
2021-07-13 22:11:14 -06:00
Deimos
9720040cb9 Use a prospector fork, update dependencies
This is kind of dirty, but the prospector tool was broken after updating
Python to 3.9, and it seems to no longer be maintained. I forked it to
my personal GitHub account, un-pinned its dependencies, fixed a bug that
came up after updating pylint, and deleted a few dependencies that I
don't use (pylint plugins for Django, Flask, and Celery).

This commit also fixes all the new complaints from the updated pylint,
which were mostly explicitly re-raising exceptions, and some places
where I could use a generator instead of an unnecessary list
comprehension.

This will work for now, but I probably don't want to leave it in this
state. I should probably just stick to using the tools like pylint
directly, since this is now the second time I've needed to replace my
"tool runner" when it stopped being maintained (the first one was
pylama).
2021-07-12 23:57:04 -06:00
Deimos
fe42c7a685 Convert all PostgreSQL integer keys to bigint
There is one special exception in here: the unread_user_ids column in
the message_conversations table had to be left as an integer array,
since the PostgreSQL intarray extension doesn't work with bigints. The
trigger that updates that column also needed a minor tweak.

This isn't good, but I don't really like how that was done anyway (it
was for the purpose of group messages that don't even exist), so it
could probably just be eliminated.
2021-07-12 00:20:22 -06:00
Deimos
240621df6a Update Python version to 3.9.5
The minimal updates here were to update pygit2 and pip-tools.

However, prospector is currently broken as well, so the full code style
checks currently will not pass. This is not trivial to fix:

  - Currently, pylint returns errors from some of the mypy annotations
  - Upgrading pylint/astroid to the newest version fixes those errors,
    but breaks prospector
  - There is no newer release of prospector

I'm not totally sure how I want to fix this, I may need to fork
prospector.
2021-07-12 00:20:21 -06:00
Deimos
22039b2f48 Update Redis version to 6.2.4 2021-07-12 00:20:21 -06:00
Deimos
3319e0a179 Update PostgreSQL version to 13 2021-07-12 00:20:20 -06:00
Deimos
4cc100ab02 Switch to Debian 10 and Ansible
This changes the site to run on Debian 10 instead of Ubuntu 16.04. It
also fully converts the previous Salt setup to use Ansible instead.

Most of this was a relatively straightforward conversion, and it should
be very close to equivalent. One notable difference is that I removed
the setup for the "monitoring" server, since I wasn't confident that the
way of setting up self-hosted Sentry and Grafana was working any more.
I'll look to re-add that at some point, but it's not urgent.
2021-06-25 00:08:58 -06:00
Ras Fincher
d91ecf910f Add query params to auto-fill new topic title/link 2021-05-27 00:32:32 -06:00
Gyrfalcon05
9f148b77fe Fix topic log link length overruns 2021-03-31 18:54:51 -05:00
Deimos
6f7618d1a1 Adjust zero-width joiner check to fix IndexError
There was the potential for an IndexError here, with a string that
started with a zero-width joiner and had at least one more character
afterwards.
2021-03-14 18:41:09 -06:00
Flashynuff
70e570b77f Handle zero width joiner unicode chars for emoji
Some emoji variants require a zero-width joiner, and they were being
broken by the current code that stripped them out.
2021-03-14 18:39:17 -06:00
Deimos
348c930133 Fix blank lines at start of Atom/RSS feeds 2021-02-28 14:51:10 -07:00
Deimos
5093fca18e Update feeds to have absolute permalinks 2021-02-27 14:15:16 -07:00
Andrew Shu
a021b96bc7 Add RSS and Atom feeds for topic listings 2021-02-27 14:14:56 -07:00
Andrew Shu
0404d0dfa2 Process tags to left of comma only
If user types "tag1 tag2" then adds a comma between,
it should respect the comma to give "tag1" and "tag2".

We use keydown and setTimeout because keyup
works on a keyboard but not reliably on mobile.

Nonzero timeout is needed or else the comma is sometimes
inserted too late and not seen by addChip(),
tested on desktop Firefox.
2021-02-21 15:25:32 -07:00
Carlos E. Garcia
d00a59ffa4 Fix link re-directing to development page 2021-01-24 22:49:50 +00:00
Deimos
071f1e04f6 Add some margin above a group's sidebar text 2020-12-15 19:38:59 -07:00
Deimos
e685639e84 Apply global rate-limit to Stripe donate endpoint
People are still continuing to try to abuse the donate page to check
stolen credit card numbers, and last night there was a massive burst of
attempts coming from many IPs, so the current rate-limiting wasn't able
to block most of it. Luckily Stripe blocked all of the charges this
time, but I can't keep risking another incident where Tildes is the
source of a bunch of fraudulent charges.

This adds a global rate-limit to the donate page that should never get
hit during normal usage. Hopefully this will be enough to keep the abuse
away from the page when it stops working for them relatively quickly.
2020-12-12 15:48:38 -07:00
Deimos
06764e9bc5 Add support for globally rate-limiting actions
Previously, rate limits had to apply to a particular user or a
particular IP address, or both. This adds support for global
rate-limits, where the limit will apply to everyone trying to perform
the action. This probably won't be used much overall, but might be
necessary for certain cases where something abusive is happening and it
can't be easily blocked by user or IP.

This is a bit ugly and would probably be better implemented by having a
separate class that inherits from RateLimitedAction or something
similar, but it will do the job.
2020-12-12 15:44:09 -07:00
Cassidy Dingenskirchen
91c408c6d8 Drop ic-current-url param in Intercooler requests 2020-12-06 13:07:37 -07:00
Deimos
88944bed17 Run app-related services under the app user 2020-11-30 20:31:14 -07:00
Deimos
5fbc72c44c Add ability to process posts with Lua scripts
This adds the backend pieces (no interface yet) to configure Lua scripts
that will be applied to topics and comments due to different events.
Initially, it only supports running a script when a new topic or comment
is posted. For example, here is a Lua script that would prepend a new
topic's title with "[Text] " or "[Link] " depending on its type, as well
as replace its tags with either "text" or "link":

function on_topic_post (topic)
    if (topic.is_text_type) then
        topic.title = "[Text] " .. topic.title
        topic.tags = {"text"}
    elseif (topic.is_link_type) then
        topic.title = "[Link] " .. topic.title
        topic.tags = {"link"}
    end
end

There can be a global script as well as group-specific scripts, and the
scripts are sandboxed, with limited access to data as well as being
restricted to a subset of Lua's built-in functions. The Lua sandboxing
code comes from Splash (https://github.com/scrapinghub/splash). It will
need to be modified, but this commit keeps it unmodified so that future
changes can be more easily tracked by comparing to the original state of
the file.

The sandboxing also includes some restrictions on number of instructions
and memory usage, but this might be more effectively managed on the OS
level. More research will still need to be done on security and resource
restrictions before this feature can be safely opened to users.
2020-11-30 17:05:00 -07:00
Deimos
8144a8b789 Use postponed evaluation of type annotations
The __future__ import will be able to be removed as of Python 3.10.
2020-11-18 15:33:31 -07:00
Deimos
b6d20340c9 Add action-settings to topic-with-excerpt grid
Whoops, only added it to the ones without excerpts, which causes a minor
layout issue for the with-excerpt ones.
2020-11-16 15:03:13 -07:00
Deimos
dac8ec3a01 Add ability to edit topic title from listing pages
This adds an "Edit title" choice in the actions dropdown for topics on
listing pages, instead of needing to go to the comments page.

Some pieces of this feel a little hack-ish (like needing to reduce the
bottom padding because of the usually-empty div that the title-editing
input gets put into), so I'll probably want to try and find a better
overall approach to this eventually, but it should do the job for now.
2020-11-15 15:49:06 -07:00