-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add ETag to NavigationController #8652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Julius Härtl <[email protected]>
| $navigation = $this->rewriteToAbsoluteUrls($navigation); | ||
| } | ||
| return new DataResponse($navigation); | ||
| $etag = md5(json_encode($navigation)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get everytime a new etag, because the logout URL is dynamic:
[
{
"type": "settings",
"id": "settings",
"order": 1,
"href": "/index.php/settings/user",
"name": "Einstellungen",
"icon": "/settings/img/admin.svg",
"active": false,
"classes": ""
},
{
"type": "settings",
"id": "core_apps",
"order": 3,
"href": "/index.php/settings/apps",
"icon": "/settings/img/apps.svg",
"name": "Apps",
"active": false,
"classes": ""
},
{
"type": "settings",
"id": "core_users",
"order": 4,
"href": "/index.php/settings/users",
"name": "Benutzer",
"icon": "/settings/img/users.svg",
"active": false,
"classes": ""
},
{
"type": "settings",
"id": "help",
"order": 5,
"href": "/index.php/settings/help",
"name": "Hilfe",
"icon": "/settings/img/help.svg",
"active": false,
"classes": ""
},
{
"type": "settings",
"id": "logout",
"order": 99999,
"href": "http://localhost:8000/index.php/logout?requesttoken=0uDLjqUDfmx/MzvQzZhbmOqIlhEksOYx10axFnRuTI4%3D%3AhKiJwulSCwgMBhCz//8P7N6%2B/0BDgJ50sgXfTBMhNuc%3D",
"name": "Abmelden",
"icon": "/core/img/actions/logout.svg",
"active": false,
"classes": ""
}
]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, thanks. I've pushed a fix to just use the list of 'id' entries to generate the ETag.
Codecov Report
@@ Coverage Diff @@
## master #8652 +/- ##
=============================================
- Coverage 51.81% 34.99% -16.82%
- Complexity 25354 25366 +12
=============================================
Files 1606 1606
Lines 95077 95101 +24
Branches 1378 1378
=============================================
- Hits 49260 33284 -15976
- Misses 45817 61817 +16000
|
| } | ||
| return new DataResponse($navigation); | ||
|
|
||
| $etag = md5(json_encode(array_column($navigation, 'id'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But now changed names (especially for external sites entries) or changed URLs don't trigger anymore. I would just have a blacklist of entries that get cleared because they basically kill the etag and remove them before generating the etag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, makes sense. Fixed.
ec91e9c to
6e4424c
Compare
Signed-off-by: Julius Härtl <[email protected]>
6e4424c to
11b6cc3
Compare
MorrisJobke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works 👍
|
CI fails, for example: |
Signed-off-by: Julius Härtl <[email protected]>
Add ETag to NavigationController and return proper not modified status.
For nextcloud/desktop#195