hamn.git
13 months agoUpdates for django 4.2 master
Magnus Hagander [Wed, 10 Apr 2024 09:18:18 +0000 (11:18 +0200)]
Updates for django 4.2

13 months agoBackfill migration with changed ordering
Magnus Hagander [Wed, 10 Apr 2024 09:16:22 +0000 (11:16 +0200)]
Backfill migration with changed ordering

This was missed in dbdbe6a when ordering of moderator notes was changed
on the model.

13 months agoUse an appropriate top title when adding a new feed.
Dave Page [Tue, 2 Apr 2024 14:39:24 +0000 (15:39 +0100)]
Use an appropriate top title when adding a new feed.

13 months agoUse an appropriate title when adding a new feed.
Dave Page [Tue, 2 Apr 2024 14:36:22 +0000 (15:36 +0100)]
Use an appropriate title when adding a new feed.

13 months agoDon't show moderation notes when adding a new field.
Dave Page [Tue, 2 Apr 2024 14:35:58 +0000 (15:35 +0100)]
Don't show moderation notes when adding a new field.

13 months agoAdd explicit redirect after adding a moderator note
Magnus Hagander [Mon, 1 Apr 2024 16:41:39 +0000 (18:41 +0200)]
Add explicit redirect after adding a moderator note

This way we can avoid potential duplicate-postings on a refresh, and it
makes tracking the code a bit more clear.

13 months agoDon't redirect to complete page on invalid form
Magnus Hagander [Mon, 1 Apr 2024 16:40:49 +0000 (18:40 +0200)]
Don't redirect to complete page on invalid form

Indentation missed in a12e1b97 made it try that. Instead, it should fall
through and render the form, which will then show the proper error
message.

13 months agoFix ordering of notes so they are more naturally readable.
Dave Page [Tue, 19 Mar 2024 17:00:03 +0000 (17:00 +0000)]
Fix ordering of notes so they are more naturally readable.

13 months agoFix ordering of notes so they are more naturally readable.
Dave Page [Tue, 19 Mar 2024 16:56:04 +0000 (16:56 +0000)]
Fix ordering of notes so they are more naturally readable.

13 months agoAdd the ability to include moderator notes on feeds.
Dave Page [Tue, 19 Mar 2024 14:52:24 +0000 (14:52 +0000)]
Add the ability to include moderator notes on feeds.

17 months agoRemove twitteruser field from blog registration
Magnus Hagander [Thu, 23 Nov 2023 14:35:39 +0000 (15:35 +0100)]
Remove twitteruser field from blog registration

We can't verify it anymore, and this blocks anybody from saving a blog
that has twitteruser on it.

Twitter does not provide any way to verify the existance of a user
anymore, other than paying $$$$. So we'll just cut the field for now, to
make things work again.

This does not remove *existing* registrations of twitter users, but it
does make it impossible to register new ones.

Issues reported by several different people.

20 months agoHTML un-escape Twitter messages.
Dave Page [Thu, 24 Aug 2023 09:02:52 +0000 (10:02 +0100)]
HTML un-escape Twitter messages.

21 months agoFix over-enthusiastic search/replace in previous commit
Magnus Hagander [Mon, 17 Jul 2023 16:01:26 +0000 (18:01 +0200)]
Fix over-enthusiastic search/replace in previous commit

22 months agoFix templates for upgrade to bootstrap 4
Magnus Hagander [Fri, 14 Jul 2023 14:39:39 +0000 (16:39 +0200)]
Fix templates for upgrade to bootstrap 4

Commit c9f68d5f upgraded the site to bootstrap 4, amongst other things,
but completely missed that "labels" are now called "badges", and thus
need new CSS classes.

22 months agoUpdate twitter posting to use api v2
Magnus Hagander [Mon, 26 Jun 2023 09:47:15 +0000 (11:47 +0200)]
Update twitter posting to use api v2

This is the only API version supported by free clients now. Also, the
list syncing doesn't work, because that requires a paid client. We don't
care about  that one for now.

23 months agoSync up to latest version of pgweb auth plugin
Magnus Hagander [Wed, 7 Jun 2023 20:19:18 +0000 (22:19 +0200)]
Sync up to latest version of pgweb auth plugin

2 years agoAdd to log message the old blogurl
Stephen Frost [Fri, 5 May 2023 20:17:50 +0000 (16:17 -0400)]
Add to log message the old blogurl

For debugging, it's helpful to know what the old value was of a given
blogurl, to make sure we are updating things correctly and only what
should be getting updated is getting updated.

2 years agoAlways set new_blogurl if blogurl different from feed.link
Stephen Frost [Fri, 5 May 2023 20:09:32 +0000 (16:09 -0400)]
Always set new_blogurl if blogurl different from feed.link

Previously, we set blogurl if the prior blogurl was set to empty-string
('') but that change wasn't picked up as part of what needed to be
updated, so instead always use new_blogurl if we need to set the blogurl
as this ensures that we'll realize there was a change and will update
the database accordingly.

At the same time, also send an email in every case that the blogurl is
changed, even when it's being changed from being empty.  This is perhaps
a bit noisy but it's been broken for so long that it's worth it to make
sure people are aware that it's now working and folks don't register new
blogs over and over again anyway.

Lastly, move the block that does the update and sets the new blogurl
value up higher so that if a new blogurl is set then the emails that are
generated from that run will use that new blogurl instead of the old
one (which could be confusing).

2 years agoAdd override styles for <h*> tags in planet posts
Magnus Hagander [Wed, 3 May 2023 19:24:37 +0000 (21:24 +0200)]
Add override styles for <h*> tags in planet posts

It looks bad on the site when the headlines inside posts are larger than
the headlines outside them. So force them down to a smaller sice.

It's not very pretty, but it's better than before. More could definitely
still be done to separate wrapping from content more.

2 years agoBlind attempt to restore the old image sanitisation.
Dave Page [Mon, 23 Jan 2023 15:07:36 +0000 (15:07 +0000)]
Blind attempt to restore the old image sanitisation.

2 years agoName the exception, so we will actually have it to print.
Stephen Frost [Wed, 11 Jan 2023 20:32:03 +0000 (15:32 -0500)]
Name the exception, so we will actually have it to print.

2 years agoLog if there is an exception when setting blogurl
Stephen Frost [Wed, 11 Jan 2023 20:19:06 +0000 (15:19 -0500)]
Log if there is an exception when setting blogurl

2 years agoAdd a border for clarity, per Jonathan
Dave Page [Thu, 5 Jan 2023 15:23:44 +0000 (15:23 +0000)]
Add a border for clarity, per Jonathan

2 years agoUpdate Planet to the modern postgresql.org website styling.
Dave Page [Thu, 5 Jan 2023 10:38:57 +0000 (10:38 +0000)]
Update Planet to the modern postgresql.org website styling.

2 years agoProperly tag 404s from redirector with xkeys
Magnus Hagander [Wed, 5 Oct 2022 15:19:26 +0000 (17:19 +0200)]
Properly tag 404s from redirector with xkeys

If the 404s are beceause an item is hidden, we need them to be tagged
with the appropriate xkeys so we can automatically unhide them.

2 years agoFix silly copy/paste error
Magnus Hagander [Wed, 5 Oct 2022 15:08:51 +0000 (17:08 +0200)]
Fix silly copy/paste error

2 years agoBand-aid fix for newer python in imported module
Magnus Hagander [Wed, 5 Oct 2022 14:59:19 +0000 (16:59 +0200)]
Band-aid fix for newer python in imported module

2 years agoStore the id of the tweet when a post has been tweeted
Magnus Hagander [Wed, 5 Oct 2022 14:53:41 +0000 (16:53 +0200)]
Store the id of the tweet when a post has been tweeted

2 years agoAdd xkey and other headers for redirect, use for purge
Magnus Hagander [Wed, 5 Oct 2022 14:37:51 +0000 (16:37 +0200)]
Add xkey and other headers for redirect, use for purge

This way we'll purge the redirect whenever a post is hidden, so we'll
stop redirecting to it.

2 years agoSpelling correction
Stephen Frost [Tue, 6 Sep 2022 19:38:30 +0000 (15:38 -0400)]
Spelling correction

retreiving -> retrieving

3 years agoAdd DEFAULT_AUTO_FIELD for Django 3.2
Magnus Hagander [Sun, 7 Nov 2021 13:37:50 +0000 (14:37 +0100)]
Add DEFAULT_AUTO_FIELD for Django 3.2

3 years agoSpelling fix
Magnus Hagander [Sat, 6 Nov 2021 17:19:05 +0000 (18:19 +0100)]
Spelling fix

Spotted by Jonathan Katz

3 years agoForce timestamp check into join condition
Magnus Hagander [Tue, 17 Aug 2021 10:38:28 +0000 (12:38 +0200)]
Force timestamp check into join condition

Unfortunately, 6c44b60 very clearly de-optimized the query when running
on a system with millions of log-rows. Oops. So force the django ORM to
put the filter on the join clause thereby making it possible to use an
index, which should make it actually optimized.

3 years agoDon't show list of personal teams in admin view
Magnus Hagander [Tue, 17 Aug 2021 10:09:26 +0000 (12:09 +0200)]
Don't show list of personal teams in admin view

In admin view we are looking at others people's blogs, so it is
confusing to have the bottom part of the page reflect the administrators
personal setup.

3 years agoOptimize some db queries
Magnus Hagander [Tue, 17 Aug 2021 09:52:11 +0000 (11:52 +0200)]
Optimize some db queries

Basically make django generate the joins/prefetches/subqueries instead
of firing of hundreds of queries on the db. Probably doesn't actually
matter that much given how seldom these queries are run, but still.

3 years agoShow blog username/email in listing
Magnus Hagander [Tue, 17 Aug 2021 08:14:00 +0000 (10:14 +0200)]
Show blog username/email in listing

For the regular user view, just show which account and email is used for
info.

For the administration view, show the username and email for each
individual blog, to help with tracking down misbehaving blogs.

And finally, in the moderation view, also include the email (it already
had the account name) to make it easier to contact an author.

3 years agoDon't forward links for posts that have been hidden
Magnus Hagander [Tue, 1 Jun 2021 14:37:53 +0000 (16:37 +0200)]
Don't forward links for posts that have been hidden

4 years agoSet proper mail headers to indicate auto-generated mails
Magnus Hagander [Sun, 17 Jan 2021 15:08:00 +0000 (16:08 +0100)]
Set proper mail headers to indicate auto-generated mails

4 years agoHave redirector generate a robots.txt file if requested
Magnus Hagander [Fri, 25 Dec 2020 15:16:11 +0000 (16:16 +0100)]
Have redirector generate a robots.txt file if requested

4 years agoGenerate proper 404's in redirector
Magnus Hagander [Fri, 25 Dec 2020 15:15:51 +0000 (16:15 +0100)]
Generate proper 404's in redirector

Instead of generating a 500 error, because that is both wrong and will
prevent caching.

4 years agoFix text for top lists time range
Magnus Hagander [Tue, 1 Sep 2020 14:04:46 +0000 (16:04 +0200)]
Fix text for top lists time range

We are counting the number of posts in the past two months, but the
website said 1 month (and has since forever).

Spotted by Bruce Momjian

4 years agoFix title for field lastget
Magnus Hagander [Sun, 30 Aug 2020 14:24:47 +0000 (16:24 +0200)]
Fix title for field lastget

In particular it was terribly labeled in the moderation interface. Make
it better and more consistent between the two interfaces.

4 years agoImport latest version of the community auth plugin
Magnus Hagander [Tue, 11 Aug 2020 12:14:55 +0000 (14:14 +0200)]
Import latest version of the community auth plugin

This includes receiving updates using the new push api.

4 years agoMake use of the lastsuccess parameter to improve some messages
Magnus Hagander [Sat, 11 Jul 2020 17:22:12 +0000 (19:22 +0200)]
Make use of the lastsuccess parameter to improve some messages

In particular, it is interesting to know when a blog that has failed
multiple times has actually succeeded more recent than the most recent
failure. So show this both on the dashbaord and on the individual blog
details, and include it in the email that's sent when a blog generates
large amounts of errors.

4 years agoTrack timestamp for last successful fetch of a blog
Magnus Hagander [Sat, 11 Jul 2020 16:36:08 +0000 (18:36 +0200)]
Track timestamp for last successful fetch of a blog

4 years agoOnly update actually changed fields in most places
Magnus Hagander [Sat, 11 Jul 2020 16:35:27 +0000 (18:35 +0200)]
Only update actually changed fields in most places

4 years agoMisc fixes to make pep8 happy
Magnus Hagander [Sat, 11 Jul 2020 16:25:40 +0000 (18:25 +0200)]
Misc fixes to make pep8 happy

Mostly whitespace fixes, but also some bare-exception fixes.

Add a setup.cfg that specifies which pep8 settings we normally run with.

4 years agoClean up imports
Magnus Hagander [Sat, 11 Jul 2020 16:24:27 +0000 (18:24 +0200)]
Clean up imports

Remove unused imports, and stop using "import *"

4 years agoFix incorrect classname
Magnus Hagander [Sat, 11 Jul 2020 16:22:19 +0000 (18:22 +0200)]
Fix incorrect classname

4 years agoConvert tabs to spaces
Magnus Hagander [Sat, 11 Jul 2020 16:01:06 +0000 (18:01 +0200)]
Convert tabs to spaces

Finally time to clean this repo up

5 years agoDon't list archived blogs as members of teams
Magnus Hagander [Fri, 8 May 2020 15:17:40 +0000 (17:17 +0200)]
Don't list archived blogs as members of teams

Spotted by Guillaume Lelarge

5 years agoUser.is_authenticated is no longer a callable in Django 2.2
Magnus Hagander [Wed, 1 Apr 2020 13:55:03 +0000 (15:55 +0200)]
User.is_authenticated is no longer a callable in Django 2.2

5 years agoUpdate to be compatible with django 2.2
Magnus Hagander [Tue, 31 Mar 2020 20:10:40 +0000 (22:10 +0200)]
Update to be compatible with django 2.2

5 years agoFix spelling error
Magnus Hagander [Wed, 25 Mar 2020 17:52:25 +0000 (18:52 +0100)]
Fix spelling error

5 years agoSync up community auth plugin to latest-and-greatest
Magnus Hagander [Wed, 26 Feb 2020 17:11:40 +0000 (18:11 +0100)]
Sync up community auth plugin to latest-and-greatest

5 years agoApply feedparser fix for python 3.7
Magnus Hagander [Thu, 9 Jan 2020 14:42:52 +0000 (15:42 +0100)]
Apply feedparser fix for python 3.7

5 years agoUse vendored version of feedparser
Magnus Hagander [Thu, 9 Jan 2020 14:42:43 +0000 (15:42 +0100)]
Use vendored version of feedparser

5 years agoVendor feedparser 5.2.1
Magnus Hagander [Thu, 9 Jan 2020 14:33:00 +0000 (15:33 +0100)]
Vendor feedparser 5.2.1

We're going to need to make small modifications, and the new 6.x release
isn't ready and doesn't appear to be close.

5 years agoFix spelling error
Magnus Hagander [Tue, 10 Dec 2019 09:53:40 +0000 (10:53 +0100)]
Fix spelling error

5 years agoUnicode fixes in old migrations
Magnus Hagander [Fri, 5 Jul 2019 20:27:59 +0000 (22:27 +0200)]
Unicode fixes in old migrations

Missed to update the migrations in the py3 update

5 years agoEncode URL
Magnus Hagander [Fri, 28 Jun 2019 17:07:01 +0000 (19:07 +0200)]
Encode URL

5 years agoFlask responses need to be bytestrings, not real strings
Magnus Hagander [Fri, 28 Jun 2019 17:02:56 +0000 (19:02 +0200)]
Flask responses need to be bytestrings, not real strings

Seems if a string is returned, flask just turns it into an empty
response (rather than converting it to utf8 as expected). These are
trivial hardcoded strings though, so just use bytestrings.

5 years agoBand-aid fix for feed as well
Magnus Hagander [Fri, 28 Jun 2019 14:51:21 +0000 (16:51 +0200)]
Band-aid fix for feed as well

5 years agoBand-aid fix for broken html tidy parsing
Magnus Hagander [Fri, 28 Jun 2019 14:49:30 +0000 (16:49 +0200)]
Band-aid fix for broken html tidy parsing

5 years agoReplace old version of Tidy with new one
Magnus Hagander [Fri, 28 Jun 2019 14:22:00 +0000 (16:22 +0200)]
Replace old version of Tidy with new one

5 years agoFix integer division for python 3
Magnus Hagander [Fri, 28 Jun 2019 14:21:53 +0000 (16:21 +0200)]
Fix integer division for python 3

5 years agoUpdate redirector to python 3
Magnus Hagander [Fri, 28 Jun 2019 14:13:36 +0000 (16:13 +0200)]
Update redirector to python 3

5 years agoImport latest version of community auth plugin
Magnus Hagander [Fri, 28 Jun 2019 13:26:26 +0000 (15:26 +0200)]
Import latest version of community auth plugin

5 years agoProeperly use requests to format URL parameters
Magnus Hagander [Fri, 28 Jun 2019 13:03:53 +0000 (15:03 +0200)]
Proeperly use requests to format URL parameters

5 years agoSwitch to using requests for varnish calls
Magnus Hagander [Fri, 28 Jun 2019 13:02:16 +0000 (15:02 +0200)]
Switch to using requests for varnish calls

5 years agoEnsure list is printed as list in python 3
Magnus Hagander [Fri, 28 Jun 2019 12:59:55 +0000 (14:59 +0200)]
Ensure list is printed as list in python 3

5 years agoFix has_key accesses for python 3
Magnus Hagander [Fri, 28 Jun 2019 12:59:17 +0000 (14:59 +0200)]
Fix has_key accesses for python 3

5 years agoFix unicode and printing for python 3
Magnus Hagander [Fri, 28 Jun 2019 12:57:20 +0000 (14:57 +0200)]
Fix unicode and printing for python 3

5 years agoUpdate exception handling for python 3
Magnus Hagander [Fri, 28 Jun 2019 12:55:57 +0000 (14:55 +0200)]
Update exception handling for python 3

5 years agoFix imports for python 3
Magnus Hagander [Fri, 28 Jun 2019 12:55:07 +0000 (14:55 +0200)]
Fix imports for python 3

6 years agoUpdate links to planet policy
Magnus Hagander [Mon, 29 Apr 2019 17:12:30 +0000 (19:12 +0200)]
Update links to planet policy

The policy lives on the main website these days, not the wiki.

6 years agoFix result variable name
Magnus Hagander [Fri, 8 Feb 2019 08:45:48 +0000 (09:45 +0100)]
Fix result variable name

6 years agoProperly include hostname to twitter api when posting
Magnus Hagander [Fri, 8 Feb 2019 08:42:50 +0000 (09:42 +0100)]
Properly include hostname to twitter api when posting

6 years agoUpdate twitter poster to use new API as well
Magnus Hagander [Tue, 5 Feb 2019 10:13:17 +0000 (11:13 +0100)]
Update twitter poster to use new API as well

6 years agoUpdate twitter sync code to use requests_oauthlib
Magnus Hagander [Tue, 5 Feb 2019 09:47:19 +0000 (10:47 +0100)]
Update twitter sync code to use requests_oauthlib

This simplifies the code a lot, and also adds the functionality to not
get stuck in a cron-loop when somebody specifies a non-public twitter
account as their twitter account. Instead when that happens just remove
the twitter account from the feed (storing it in a new field,
oldtwitteraccount, just to be on the safe side in case twitter does evil
things to us at some point)

Code mostly stolen from the pgeu website code.

6 years agoMake sort by name the default behaviour for teams
Magnus Hagander [Sun, 23 Sep 2018 14:09:28 +0000 (16:09 +0200)]
Make sort by name the default behaviour for teams

6 years agoFix incorrect string formatting specifier
Magnus Hagander [Tue, 26 Jun 2018 11:07:56 +0000 (13:07 +0200)]
Fix incorrect string formatting specifier

7 years agoFix template loaders for django 1.11
Magnus Hagander [Sun, 25 Mar 2018 14:56:56 +0000 (16:56 +0200)]
Fix template loaders for django 1.11

Seems django 1.11 automatically enables caching template loader, which
of course breaks the ability to make any changes to the pages of a
website without restarting it. And there is no way to turn it off other
than to explicitly configure individual loders (the logic to turn it on
in non-debug configurations is hardcoded and cannot be changed).

7 years agoDetect excessive blog fetches
Magnus Hagander [Mon, 19 Mar 2018 11:55:43 +0000 (12:55 +0100)]
Detect excessive blog fetches

If a single fetch from a blog grabs more than <n> entries (the default
being 4), this usually indicates a misconfigured blog and it will end up
spamming the outgoing feed and twitter, even if later corrected. For
that reason, when this happens, mark all the newly fetched entries as
hidden, and send a notification as such. In the event that they are
actually correct, the user can go in and manually unhide those entries,
which will make them show up again.

7 years agoFix tracing messages
Magnus Hagander [Mon, 19 Mar 2018 11:52:56 +0000 (12:52 +0100)]
Fix tracing messages

Shouldn't use print directly, since it doesn't respect the verbosity
setting.

7 years agoAutomatically follow http->https redirects
Magnus Hagander [Mon, 19 Mar 2018 11:26:04 +0000 (12:26 +0100)]
Automatically follow http->https redirects

We only follow the redirect if the URL is *exactly* the same except it
has https intead of http in it. But this is a very common scenario these
days, so let's simplify that one.

In particular, it makes no sense to re-moderate a blog after that change
has been made.

7 years agoTreat http:// and https:// guid as being the same when fetching
Magnus Hagander [Mon, 19 Mar 2018 11:11:03 +0000 (12:11 +0100)]
Treat  and https:// guid as being the same when fetching

This means that if the same blog post shows up both under http:// and
https:// (for example when somebody changes their URL from http to
https, but it still contains the old posts), we will treat them as being
the same and not fetch a second copy of it.

We handle both http->https (common) and https->http (would probably
indicate a misconfiguration) scenarios.

7 years agoRemove old leftover debugging code
Magnus Hagander [Sun, 25 Feb 2018 13:43:39 +0000 (14:43 +0100)]
Remove old leftover debugging code

7 years agoReplace render_to_response with render
Magnus Hagander [Sun, 25 Feb 2018 13:39:25 +0000 (14:39 +0100)]
Replace render_to_response with render

Required in newer django, and still works in the old one.

7 years agoUpdate URL configurations for newer django
Magnus Hagander [Sun, 25 Feb 2018 13:39:05 +0000 (14:39 +0100)]
Update URL configurations for newer django

7 years agoRemove app not used
Magnus Hagander [Sun, 25 Feb 2018 13:38:47 +0000 (14:38 +0100)]
Remove app not used

7 years agoUpdate template configuration for newer django
Magnus Hagander [Sun, 25 Feb 2018 13:38:37 +0000 (14:38 +0100)]
Update template configuration for newer django

7 years agoDon't just delete successful logs
Magnus Hagander [Thu, 8 Feb 2018 19:39:52 +0000 (20:39 +0100)]
Don't just delete successful logs

MOst of what we end up keeping aren't..

7 years agoAdd command to purge old logs
Magnus Hagander [Thu, 8 Feb 2018 19:36:07 +0000 (20:36 +0100)]
Add command to purge old logs

7 years agoAdd missing import
Magnus Hagander [Sat, 9 Dec 2017 10:37:49 +0000 (11:37 +0100)]
Add missing import

7 years agoProperly format email headers with non-ascii
Magnus Hagander [Fri, 8 Dec 2017 14:31:20 +0000 (15:31 +0100)]
Properly format email headers with non-ascii

When sending an email to non-ascii names, the actual email address
should not be part of the encoded section. It should have a separate
section that's not encoded.

Ported over from the pgeu install

7 years agoUpdate listsync script to sync with pglister instead of mj2
Magnus Hagander [Fri, 8 Dec 2017 13:13:31 +0000 (14:13 +0100)]
Update listsync script to sync with pglister instead of mj2

7 years agoEncode URLs to handle even worse formatted twitter links
Magnus Hagander [Sat, 18 Nov 2017 15:00:34 +0000 (16:00 +0100)]
Encode URLs to handle even worse formatted twitter links

7 years agoValidate twitter accounts when submitting a new blog
Magnus Hagander [Sat, 18 Nov 2017 14:54:19 +0000 (15:54 +0100)]
Validate twitter accounts when submitting a new blog

Do this by connecting to the twitter API and actually validate both that
the account exists, and that it's not protected. Protected accounts will
cause the follower-sync script to keep trying over and over again for
following, and there's not any point in promoting those anyway.

This adds a dependency on requests_oauthlib, but that's already used in
other pgweb projects so shouldn't be a problem.

7 years agoDon't crash when feedurl is not given
Magnus Hagander [Sat, 18 Nov 2017 14:53:59 +0000 (15:53 +0100)]
Don't crash when feedurl is not given

Instead, give a proper error message as intended.