Commit Graph

94 Commits

Author SHA1 Message Date
76900b7657 Teach varnish purging code about xkey purges
It's just another  type of purge, so it's added as an extra option with
'K' as the key (as 'X' was already taken).
2018-07-06 15:32:14 +02:00
406a120a54 Pass pg context to render when rendering static pages
This is where we set both the gitrev and the do_esi, both of which are
needed. This means that gitrev has been broken on static pages since
forever - oops.
2018-06-29 19:40:45 +02:00
3e2b9ee6e2 Only call datetime.date.today once on the homepage. 2018-05-18 13:18:53 -04:00
5c3f229e44 Update homepage event display algorithm.
The event display algorithm shows up to two non-badged events
that take place over the next three months.  Subsequently, up to
seven minus |non-badged events| are returned.
2018-05-18 13:16:09 -04:00
8a74e5d14a Put ordering on event querysets on homepage.
As we are getting the first X of each event queryset, we need to
ensure there is ordering so it is the first X by date.
2018-05-18 09:55:49 -04:00
d252bdedf3 Updated event display algorithm on home page.
The homepage will now display seven events, allowing up to two
events that are not community badged to be present.
2018-05-17 12:25:27 -04:00
e91630c42e Homepage redesign utilizing new CSS and base HTML.
The new look of the homepage is optimized for both desktop and
mobile views and is setup to help guide new and returning users
to appropriate PostgreSQL content.

Authors: Sarah Conway <sarah.conway@crunchydata.com> and me
2018-04-17 13:43:12 -04:00
9256e2f00d New base HTML for PostgreSQL.org
The base HTML structure enables the responsiveness for the
website. In addition to the primary base template, the generic
page and form templates are also modernized.

Authors: Sarah Conway <sarah.conway@crunchydata.com> and me
2018-04-17 13:43:04 -04:00
f89d0d9b61 Allow "About" page to be render dynamically.
In prep for the new "About" page to serve dynamic (though
periodically cached) content.
2018-04-15 22:05:59 -04:00
487d86bee3 Fix that HttpServerError now takes a request as parameter 2018-03-10 10:54:13 -05:00
890f85be76 Show django version in system_information 2018-03-10 10:47:00 -05:00
fd37389a3b Replace NavContext and render_to_response with render_pgweb
render_to_response does not work on newer django, so it needs to be
replaced. And using a speicfic context actually overcomplicates things,
it's easier to just use a wrapper function. For those cases where we
don't need NavContext, just use render() (the new shortcut function from
django), which also removes the need to use RequestContext.
2018-03-10 10:38:11 -05:00
2e1b4a5f08 Add explicit group permissions check for varnish purge and pending mod
Previously we just used "is member of staff", but for better granuality
explicitly also check membership of groups. This introduces the new
group "varnish purgers" for that permission.
2018-01-26 11:03:10 +01:00
9bd151082e Add tag support for news items
This lets us separate things like project news from other OSS and from
commercial postings, for example, allowing for people to subscribe to
different feeds with just the parts they are interested in.
2017-12-13 20:55:07 +01:00
e7014d7ecc Enable events to be badged.
Adds the "badged" flag to the Event model in order to distinguish
community badged events from other PostgreSQL oriented events.
Seven total events will be displayed on the homepage, with up to
four community events displayed. If there are no upcoming
community events then, then the header "Events" is shown.

The event submission interface allows a user to opt-in to
listing an event as a "community" event and provide an
explanation for moderators as to why the event should be
considered a community event.

Expands the list of News and Planet PostgreSQL blog entries to 10.
2017-12-06 12:06:37 +09:00
0354a5ec0f Remove support for repo updated trigger
This was never actually completed, and we have other ways to deal with
the deployments now that are faster.
2017-06-27 15:14:20 +02:00
428f299f48 Generate internal sitemap including devel docs
We'll use this to index some things in our own search engine without
exposing it to external sitemap parsers. Not from a security standpoint
of course, but something that will lead to it being possible to search
the devel docs again.
2017-03-23 12:11:22 +01:00
7fc34e9eaf Replace login_required decorator with a validating one
This one will validate that the url is under /accounts/, which is
the only part we are going to be excluding from caching once we
move the website to https-only.
2016-05-24 21:14:34 +02:00
9bcaa6ab33 Remove the "is behind cache" functionality
We're always behind cache now (we may or may not be cached, but that's
not what this check was about)
2016-05-24 21:14:33 +02:00
fd904ebc27 Fix robots.txt in https only scenario
We now allow all searching
2016-05-24 21:14:33 +02:00
3c089cd09a Remove SSL decorators and middleware
The site is now served regardless of SSL, and assumes that the webserver
or web cache ensures that things rae always SSL.
2016-05-24 21:13:00 +02:00
753d20545a Remove SSL optional tag 2016-05-24 21:13:00 +02:00
a126594260 Update sitemap URLs for https 2016-05-24 21:13:00 +02:00
59166227fd today() is a function
Callables in querysets are deprecated, so make sure we don't end
up using them unintentionally...
2016-05-14 21:29:59 +02:00
da812e682b mimetype is now called content_type 2016-05-14 19:49:12 +02:00
350b936e58 Prefix cross-application imports with pgweb
As required by the new project layout.
2016-05-14 19:49:12 +02:00
856dbd31a2 Update for new transaction handling in newer django versions 2016-05-14 19:49:12 +02:00
498e786c0e Move files and directories for new project layout
Move manage.py up one step, set up a new wsgi.py file, and adjust
relative paths that refer to other directories for the new project
layout that we need to use in django 1.8.
2016-05-14 19:49:12 +02:00
2f8bbc40dd Replace pgq with trivial local queue implementation
The queue used for varnish purges has so few entries that it's really
not worth paying the management overhead for skytools/pgq. Instead we
can use a very simple local deamon using LISTEN/NOTIFY to fire them off.

Now include a proper nagios plugin in this package, so we can get rid
of the not-very-nice munin plugin currently used in the deployment.
2016-05-14 19:49:12 +02:00
9c8006364e Add a system_information view available through SSL 2015-12-17 17:34:31 +01:00
40d3ed798e IP restrictions don't currently work on SSL
Since we pipe all SSL through frontends, and explicitly reject directly
accessing the main host. However, this call has no payload, so we can
safely allow it without SSL through the frontends. Do that for now, while
we should look at fixing the SSL issue sometime in the future
2014-04-13 14:53:48 +02:00
b39a87fa5f Add API url that drops a trigger file for updates
The idea is a git repository hook will send a POST to this URL, which
will drop a trigger file somewhere. A cronjob (or inotify listener if
we want to be really fancy sometiem in the future) will pick up that
cronjob and run the update script. The goal being to shorten the time
required to process an update.
2014-04-13 14:11:19 +02:00
c2b6d459e9 Wrong order of decorators
We really need to clean the code up so this does not matter...
2014-01-02 12:04:54 +01:00
048a17ae4b Don't redirect dynamic CSS from https to http
This can break things (d'uh).

Do this by introducing a new decorator, @ssl_optional. When this is
present, no SSL redirection will happen, regardless of whether the
access comes in over http or https.

This decorator overrides @ssl_required, but for redability's sake,
never use both at the same time.
2014-01-02 12:00:32 +01:00
137d4295f3 Remove unused code causing warnings 2014-01-01 16:41:27 +01:00
756aa6ffbe Clean up imports
Remove unused imports and some other completely unused code.
2014-01-01 15:42:30 +01:00
48410d04fa Enable cache-busting URLs for CSS and JS
This will allow us to increase the cache times in the browser for our
CSS, which almost never changes.

Enables a new value to be used in templates, {{gitrev}}, which can be
used to bust pretty much any URL. We could do this for all the images
in the templates as well, but since most of them almost never change,
we'll just enable it manually for each individual image as it becomes
necessray - or just use a ?1, ?2 etc for those.

Enabled by default for CSS and JavaScript links, since those are much
more likely to be changed without having the URL changed.

Cache times aren't increased yet - we'll do that later one we're sure
that all existing caches are expired first.
2014-01-01 15:24:51 +01:00
6dfd884f16 Dynamically merge CSSes into a single one
This will make CSS downloading a single request, instead of making
6-7 requests for each page as it is now. It also moves all the definitions
of URLs for CSS into the templates and not in the raw CSS itself, which
will make it possible to enable client side caching in the future.

Fixes #91
2013-12-28 17:24:47 +01:00
3c543b357e List 5 events on homepage; move navigation / RSS feed links for events above "Upcoming Training"
List 5 events on homepage; move navigation / RSS feed links for events above "Upcoming Training"
To maintain the balance of the end columns, this patch also extends the list of
News articles and Planet postings to 7
2013-10-29 15:55:23 +00:00
d1535febb9 Make the varnish queue id configurable
This is required if the queue is dropped and recreated in pgq as it
gets a new id, which needs to be used when viewing the current status
of the queue in the admin interface.
2013-09-10 13:54:54 +02:00
bacb51e839 Don't have bots index /search/
We don't link statically to it anywhere, but people can link to it from
emails or other places around the world, that sets the search engines
on it's trail.
2013-09-05 18:16:43 +02:00
f31c58ddaa Fix beta versioning to be more generic test versioning
This allows us to specify both beta and rc versions.

Requires SQL:

ALTER TABLE core_version RENAME COLUMN beta TO testing;
ALTER TABLE core_version ALTER COLUMN testing TYPE integer USING CASE WHEN testing THEN 2 ELSE 0 END;
2013-08-22 14:45:33 +02:00
beaa87f162 Don't generate broken links to /docs/0.0/ in the sitemap
Generate proper /devel/ URLs, and then exclude them again in robots.txt
so we don't include them in google results, but we do include them in
our own.
2013-08-17 16:32:37 +02:00
8be717d99d Use a proper database field for beta releases
This replaces the previous ugly hack where beta versions had a negative number
as latestminor, giving a much cleaner model.

Requires SQL:
ALTER TABLE core_version ADD COLUMN beta boolean NOT NULL DEFAULT 'f';
ALTER TABLE core_version ALTER COLUMN beta DROP DEFAULT;

(Yes, we really need to move to something that can do automatic migrations)
2013-08-17 15:37:45 +02:00
4d773d447f Exclude some URLs from the archives in robots.txt
This makes no major changes from what was there before from a pure search
perspective:

* /message-id/flat/ was already flagged with a META tag to  be excluded from
  indexing, since it's the same data as /message-id/.
* /list/ was already flagged with a META tag to be excluded from indexing,
  since it carries no actual content, just links, and the links and descriptions
  of the lists is already available under /community/ as well.
* /message-id/raw/ required a login so it produced a bunch of 401's anyway,
  but this way we don't need to probe for that.

It's more efficient to block these things in robots.txt so we don't have to
spend the processing power to render a page that's not going to get indexed
anyway.
2013-07-10 09:59:23 +02:00
53cd5a83f5 Show purge type in list of recent varnish purges 2012-11-30 16:23:54 +09:00
a923f93b17 CSRF verification failure now returns HTTP 403 Forbidden, not 200 OK 2012-11-11 16:07:42 +01:00
6008f93843 Fix small bug in api_varnish_purge error path
HttpServerError is a function that returns HttpResponse, not an
exception.
2012-11-11 16:07:40 +01:00
6ba4f789ed Fix CSRF verification in /admin/mergeorg/ and /admin/purge/
All templates using {% csrf_token %} need to be rendered with a
RequestContext.

This reverts most of commit 58a08f2590

Also permit POST requests to /search/ -- these aren't relevant to the
site itself, but this used to be allowed before.
2012-11-11 13:19:29 +01:00
0a69f0b831 Add specific view for handling CSRF failures
This generates the error in a bit nicer way inside our framework,
instead of throwing the default django error.
2012-11-07 20:57:22 +01:00