Fixed proxy/browser caching issues in admin pages

This commit is contained in:
Matias Griese
2020-09-14 13:46:59 +03:00
parent af314f789d
commit 8b6679855c
29 changed files with 39 additions and 3 deletions

View File

@@ -2,7 +2,8 @@
## mm/dd/2020
1. [](#bugfix)
* Fixed issue that would force a page reload when failing to install/update a plugin or theme.
* Fixed issue that would force a page reload when failing to install/update a plugin or theme
* Fixed proxy/browser caching issues in admin pages
# v1.9.16
## 09/01/2020

View File

@@ -451,6 +451,8 @@ class AdminPlugin extends Plugin
// Replace page service with admin.
$this->grav['page'] = function () use ($self) {
$page = new Page();
// Plugins may not have the correct Cache-Control header set, force no-store for the proxies.
$page->expires(0);
if ($this->grav['user']->authorize('admin.login')) {
@@ -467,6 +469,7 @@ class AdminPlugin extends Plugin
if (file_exists(__DIR__ . "/pages/admin/{$self->template}.md")) {
$page->init(new \SplFileInfo(__DIR__ . "/pages/admin/{$self->template}.md"));
$page->slug(basename($self->template));
return $page;
}

View File

@@ -1,6 +1,7 @@
---
title: Generic Ajax
template: default
expires: 0
access:
admin.login: true

View File

@@ -1,6 +1,7 @@
---
title: Backup
template: default
expires: 0
access:
admin.maintenance: true

View File

@@ -1,6 +1,7 @@
---
title: Cache
template: default
expires: 0
access:
admin.cache: true

View File

@@ -1,5 +1,6 @@
---
title: Config
expires: 0
access:
admin.configuration: true

View File

@@ -1,5 +1,6 @@
---
title: Dashboard
expires: 0
access:
admin.login: true

View File

@@ -1,4 +1,5 @@
---
title: Access Denied
expires: 0
---

View File

@@ -4,6 +4,7 @@ robots: noindex,nofollow
template: error
routable: false
http_response_code: 404
expires: 0
---
Woops! Looks like this page doesn't exist.

View File

@@ -1,6 +1,7 @@
---
title: News Feed
template: ajax
expires: 0
access:
admin.login: true

View File

@@ -1,5 +1,6 @@
---
title: Forgot password
expires: 0
form:
fields:

View File

@@ -1,6 +1,8 @@
---
title: PHP Info
template: config
expires: 0
access:
admin.settings: true
admin.super: true

View File

@@ -1,5 +1,6 @@
---
title: Installer
expires: 0
access:
admin.install: true

View File

@@ -1,5 +1,6 @@
---
title: Admin Login
expires: 0
forms:
login:
@@ -13,7 +14,7 @@ forms:
autofocus: true
validate:
required: true
password:
type: password
placeholder: PLUGIN_ADMIN.PASSWORD
@@ -33,5 +34,5 @@ forms:
type: text
id: twofa-code
autofocus: true
placeholder: PLUGIN_ADMIN.2FA_CODE_INPUT
placeholder: PLUGIN_ADMIN.2FA_CODE_INPUT
---

View File

@@ -1,6 +1,7 @@
---
title: Media
template: default
expires: 0
access:
admin.pages: true

View File

@@ -1,6 +1,7 @@
---
title: Notifications
template: default
expires: 0
access:
admin.login: true

View File

@@ -1,6 +1,7 @@
---
title: Pages Filter
template: default
expires: 0
access:
admin.pages: true

View File

@@ -1,5 +1,6 @@
---
title: Pages
expires: 0
access:
admin.pages: true

View File

@@ -1,5 +1,6 @@
---
title: Plugins
expires: 0
access:
admin.plugins: true

View File

@@ -1,5 +1,6 @@
---
title: Preview
expires: 0
access:
admin.pages: true

View File

@@ -1,4 +1,6 @@
---
expires: 0
form:
fields:
- name: username

View File

@@ -1,5 +1,6 @@
---
title: Reset password
expires: 0
form:
fields:

View File

@@ -1,6 +1,8 @@
---
title: Site Settings
template: config
expires: 0
access:
admin.settings: true
admin.super: true

View File

@@ -1,5 +1,6 @@
---
title: Statistics
expires: 0
access:
admin.statistics: true

View File

@@ -1,6 +1,8 @@
---
title: Configuration
template: config
expires: 0
access:
admin.configuration: true
admin.super: true

View File

@@ -1,5 +1,6 @@
---
title: Grav Themes
expires: 0
access:
admin.themes: true

View File

@@ -1,5 +1,7 @@
---
title: Grav Tools
expires: 0
access:
admin.login: true
---

View File

@@ -1,6 +1,7 @@
---
title: Updates
template: default
expires: 0
access:
admin.maintenance: true

View File

@@ -1,5 +1,6 @@
---
title: User
expires: 0
access:
admin.users: true