Commit Graph

219 Commits

Author SHA1 Message Date
a91abc5800 Fix cauthreceiver for flask in python3
This has been logging errors since forever -- but still worked in
practice :)
2024-04-09 14:18:01 +02:00
addaef2bd1 fix typo in comment 2023-12-15 14:51:15 +01:00
071aad3e6c Add some load-time validation of PGAUTH_KEY in the django sample
Will result in a nicer error when the key is wrong, and in particular a
startup error instead of a runtime error.

Reviewed-by: Célestin Matte
2023-08-28 20:49:33 +02:00
e08139df48 Fix arguments in signal calling 2023-06-07 22:17:55 +02:00
cb6076778f Give nicer error message when URL data is corrupt 2023-06-07 21:54:42 +02:00
1b7c1c922b Add new signal auth_user_created_from_upstream to sample
This signal fires when a new user has been created either from the user
logging in the first time or from an import.
2023-06-07 21:46:04 +02:00
ef5ae7db30 Import subscribe_to_user_changes function to sample auth.py
This was used on git.postgresql.org, but hadn't been propagated
upstream.
2023-06-07 21:38:16 +02:00
a484c9fd6b Fix typo in comment 2022-06-20 21:12:27 +02:00
c234a6a654 Refactor docsload and add support for loading from directory
Break out the tar parsing parts into a function for just that and create
a new one that knows how to load directly from the html directory in the
postgresql source tree, for more efficient snapshot loading.
2022-06-20 21:12:21 +02:00
e6f529dd4e Store the git hash of developer docs loaded
This will require some further updates on the loading side of things
before it's fully valid, but for now track and show a link to the git
hash used to build developer docs *if* one is specified.

We only track it for devel (because releases have release numbers) and
we only show it in the cases where we would already show the loading
time.
2022-06-20 20:32:05 +02:00
e9f4454444 Use the proper set of arguments in docs loader
We parsed it out using the options parser, but then when using it
required a hardcoded order on the commandline. That made no sense...
2022-06-20 20:32:05 +02:00
29c4bad677 Fix data.sql sample for search
The fix in 52455885 broke the data.sql preloading of example data.

Fix the insert for the main website (patch from Célestin Matte), and
also delete those parts of the file that are no longer relevant.
2021-10-27 15:45:36 +02:00
524558856c Add baseurl field to sites table in the search system
This table isn't used beyond a single row at this time, so there is a
lot to be done for simplifying things around it, but for a quick-fix
just add the field that actually should be there.

Spotted by Célestin Matte
2021-10-23 16:03:50 +02:00
291511b5b1 Add verbose mode to docs loading and tweak defaults
Instead of printing every single page loaded, print the start of the
process and the statitics by default.

The existing --quiet parameter continues to work to make the process
completely quiet.

Add a new parameter --verbose that makes it run in the old way, printing
everything.
2021-08-11 14:46:35 +02:00
822e156942 Purge PDF listings page when new PDFs are uploaded
This will update which versions have PDFs as well as their sizes.
2021-05-18 09:59:10 +02:00
2f969bff76 Make documentation purges use xkey 2021-05-18 09:54:18 +02:00
60aadf65d9 Handle varnish purges for the static repo as well
By calling the purge notifier script with --static, the paths wil be
taken as part of the pgweb-static repostory instead, and purged with a
prefix of files/
2021-05-17 12:03:35 +02:00
dc04f41c14 Make sure Host: header is included in varnish purges 2021-02-24 21:43:53 +01:00
80a2bb8634 Remove old archives_search function
This function hasn't been used since we switched tot he new archives
system that does the search through a http api.
2021-02-22 11:13:42 +01:00
2a22df2c5d Retire search for "community sites"
This hasn't worked for a few years (since 900946df) and nobody has
complained. Getting rid of it allows similifying a few things on the
search server side as well.
2021-02-22 11:13:25 +01:00
e24e987c29 Only flag docs as loaded when they've actually changed
We already avoided the actual updates (by filtering the UPDATE
statement), but since we set the load date we'd trigger a change to
every page and kick it ouf of the caches even when not chagned, which is
wasteful. So instead only do that if something has changed. When it has,
we still reset that whole version of the docs since we want the load
date to be consistent across them.
2020-11-23 11:58:51 +01:00
3e62af803e Fix typo in comment 2020-09-28 17:31:49 +02:00
9afa08b2f9 Exclude the pgAdmin repos from the FTP crawl. 2020-09-16 11:44:31 +01:00
0355560517 Simplify transaction handling in the changetracker daemon
Previously we used a combination of optimistic concurrency control
(by DELETEing with both the id and the date included in the WHERE
clause) and REPEATABLE READ transactions. This would create
serialization conflicts when completely unnecessary. Since in this case
it doesn't matter if we happen to push the same thing twice, switch
completely to optimistic concurrency control. That gets rid of having to
deal with serialization issues.
2020-08-12 17:17:32 +02:00
1ffc1f3d6d Update nagios monitor to check for duplicated email addresses
This should not be possible if things are done through the appropriate
interfaces, and those interfaces are bug-free (right..). But really bad
things can probably happen if they don't, so put a monitor in place to
check for it.

This also adds a view in the db that shows all registered email
addresses and their accounts, regardless of if it's primary or secondary
address. This is used by the nagios check but can of course be useful to
manual checks as well.
2020-08-12 17:14:19 +02:00
76de9ca108 Tweak mediawiki to handle NULL in email fields
It really shouldn't exist, but we clearly have cases where the community
auth plugin sets the email to NULL, so we need to handle that case when
looking for what to update.
2020-08-12 12:45:33 +02:00
47e87e31b9 Use unbuffered output by default in changetracker 2020-08-11 12:00:48 +02:00
accbd2bab6 Add cauth push receiver plugins for mediawiki and redmine 2020-08-11 11:33:46 +02:00
c1fb5de080 Implement synchronization for community authentication
This adds the concept of an apiurl to each site that uses community
authentication, that the main website server can make calls to and send
updates. This URL will receive POSTs from the main website when a user
account that has been used on this site gets updated, and can then
optionally update it's local entries with it (the django plugin sample
is updated to handle this fully).

Updates are only sent for users that have a history of having logged
into the specific site -- this way we avoid braodcasting user
information to sites requiring specific constent that the user hasn't
given, and also decreases the amount of updates that have to be sent.

Updates are queued by the system in a table and using listen/notify a
daemon that's running picks up what needs to be updated and posts it to
the endpoints. If this daemon is not running, obviously nothing gets
sent.

Updates are tracked using triggers in the database which push
information into this queue.
2020-08-11 11:33:46 +02:00
d969bd33d8 Make django community auth plugin only save changed fields 2020-08-11 11:33:46 +02:00
b97aa1d581 Make user_import in the django auth plugin return the new user
It's useful to be able to directly get at the user record that was
returned instead of having to re-query it from the database. Since
nothing was previously returned, this is not backwards incompatible.
2020-08-10 13:15:50 +02:00
4f1bf70ea0 Remove unused imports 2020-07-13 14:53:07 +02:00
ccb1282531 Update authentication to be django 2 compatible 2020-04-03 19:05:26 +02:00
fa32eff8ae Sync community auth plugin to be the latest-and-greatest
Combine changes from downstream projects (which were not that many
anymore)
2020-02-26 18:04:40 +01:00
e384b4c917 Fix a number of incorrect escapes
Pointed out by newer versions of pep8, but they were never correct.
2020-01-09 13:25:59 +01:00
69923c7190 Stop using bare exceptions
This is frowned upon in newer versions of pep8, so fix it once and for
all.
2020-01-09 13:14:32 +01:00
d2e91e2b8f Fix unicode bug from python3 conversion 2019-11-01 14:55:05 +01:00
12306255ad Switch to using pycryptodome instead of pycrypto
pycrypto is not being maintained, and pycryptodome is theoretically
a drop-in replacement (in practice, it seems it was close)
2019-11-01 14:52:35 +01:00
3be328a995 Save away copy of all ovailable oauth buttons
Including a reference to where we got them from.
2019-06-25 16:28:55 +02:00
18c7292eaa Update yum spider and download page for new reporpms
The yum project has switched to single-reporpm-for-multiple-versions as
well as putting them in a dedicated directory. This makes a lot of the
cruft in the code to deal with the distribution of reporpms unnecessary,
so change it.

We still need to keep track of which platforms exist for which versions,
so we do still need some spidering, but it's  alot simpler.

Since all versions are also always availeble, the javascript that
populates the version list can now just use the list of supported
versions. This could be rendered directly in the HTML, but we might need
to restrict versions-per-platform at some point in the future, and
javascript is needed anyway for the rest of the page, so we keep doing
it the old way.
2019-05-16 17:13:13 +02:00
7aab2eac7c Fix filemode for temporary files in yum spider
This was broken in the python3 update, but it's only used when testing
via temporary files and never in production, and thus went unnoticed.
2019-05-16 17:13:13 +02:00
b8038754aa Add Bootstrap grid classes to images referenced in the HTML docs. 2019-04-25 17:21:44 -04:00
3d3339249a Add a lot more code documentation to the documentation loader. 2019-03-31 17:02:43 -04:00
1f4c74c2c2 Do not use libtidy on content from SVG files. 2019-03-31 16:38:12 -04:00
a05801ba81 Remove global variable reference that increments the page count in the docloader.
This is primarily to remove some old code to allow for future changes
to how certain types of doc files can be loaded in the future.
2019-03-31 16:20:51 -04:00
3c3a117b66 Added pycodestyle to requirements.txt and pre-commit hook. 2019-03-10 11:40:05 -07:00
b332933b72 Explicitly use python3 in githook validation 2019-03-10 08:17:41 -07:00
c028ce47ea Load docs using COPY instead of INSERT
Issuing individual INSERTs for each line in the docs works decently when
local, but it slow when loading across The Tubes Of The Internet.
Switching to using COPY takes the load time from the buildfarm animal
from just over 2 minutes to about 6-7 seconds.
2019-02-22 16:39:41 +01:00
cbdb937597 Update docsload to use tidylib instead of tidy
The old library is not supported on py3. This is the same migration
we've done for other projects like pgarchives.
2019-01-26 17:21:37 +01:00
b74fa2146a Fix datatype and encoding for yum spider 2019-01-26 16:45:59 +01:00