Skip to content

Commit

Permalink
Merge pull request #147 from OpenPecha/chore/PECHA-185-browser_cache_…
Browse files Browse the repository at this point in the history
…clear

Chore/pecha 185 browser cache clear
  • Loading branch information
Lungsangg authored May 30, 2024
2 parents 02c7d67 + b246471 commit 0d9eb8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion reader/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3199,7 +3199,7 @@ def topics_list_api(request):
topics = get_all_topics(limit)
response = [t.contents() for t in topics]
response = jsonResponse(response, callback=request.GET.get("callback", None))
response["Cache-Control"] = "max-age=0"
response["Cache-Control"] = "max-age=5"
return response


Expand Down
10 changes: 5 additions & 5 deletions sourcesheets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ def tag_list_api(request, sort_by="count"):
"""
response = public_tag_list(sort_by)
response = jsonResponse(response, callback=request.GET.get("callback", None))
response["Cache-Control"] = "max-age=0"
response["Cache-Control"] = "max-age=5"
return response


Expand All @@ -958,7 +958,7 @@ def user_tag_list_api(request, user_id):
# return jsonResponse({"error": "You are not authorized to view that."})
response = sheet_topics_counts({"owner": int(user_id)})
response = jsonResponse(response, callback=request.GET.get("callback", None))
response["Cache-Control"] = "max-age=0"
response["Cache-Control"] = "max-age=5"
return response


Expand All @@ -968,7 +968,7 @@ def trending_tags_api(request):
"""
response = trending_topics(ntags=18)
response = jsonResponse(response, callback=request.GET.get("callback", None))
response["Cache-Control"] = "max-age=0"
response["Cache-Control"] = "max-age=5"
return response


Expand Down Expand Up @@ -1016,7 +1016,7 @@ def story_form_sheets_by_tag(request, tag):
sheets = [sheet_to_story_dict(request, s["id"]) for s in sheets]
response = {"tag": tag, "sheets": sheets}
response = jsonResponse(response, callback=request.GET.get("callback", None))
response["Cache-Control"] = "max-age=0"
response["Cache-Control"] = "max-age=5"
return response


Expand All @@ -1028,7 +1028,7 @@ def sheets_by_tag_api(request, tag):
sheets = [sheet_to_dict(s) for s in sheets]
response = {"tag": tag, "sheets": sheets}
response = jsonResponse(response, callback=request.GET.get("callback", None))
response["Cache-Control"] = "max-age=0"
response["Cache-Control"] = "max-age=5"
return response


Expand Down
11 changes: 0 additions & 11 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
<title>{% block title %}{{ title|striptags }}{% endblock %}</title>
<meta charset="utf-8"/>
<meta name="description" content="{% block description %}{{ desc|striptags }}{% endblock %}"/>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

{% if noindex or DEBUG %}
<meta name="robots" content="noindex, nofollow">
Expand Down Expand Up @@ -93,14 +90,6 @@
}
});
</script>
<script>
if ('caches' in window) {
caches.keys().then((names) => {
for (let name of names) {
caches.delete(name);
}
});}
</script>
<script src="https://www.gstatic.com/charts/loader.js"></script>

<link rel="stylesheet" href="{% static 'css/common.css' %}">
Expand Down

0 comments on commit 0d9eb8f

Please sign in to comment.