-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
(Partially) Fix #2100: add cache slugs. #2208
Changes from all commits
126df37
8125aa9
e0f0ff3
7e5a68f
5be7fdd
d9e18a4
35bb24b
10df46d
77da86a
1350392
4b49a9b
1d3c232
60f33a4
5f8bf7f
9d85731
48c4039
883e1c5
aa4be4e
b165745
88c91e7
bbc31fb
9daa7b0
89a0196
c5aa6c6
1312642
55d1b29
f8d95ed
57f6fdb
8cb8624
eeb9b5b
74781cb
238c896
ad26ae9
3b83d27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,34 +15,36 @@ inbound_services: | |
|
||
handlers: | ||
- url: /favicon.ico | ||
static_files: static/images/favicon.ico | ||
upload: static/images/favicon.ico | ||
static_files: assets/common/favicon.ico | ||
upload: assets/common/favicon.ico | ||
secure: always | ||
http_headers: | ||
Cache-Control: 'public, max-age=2592000' | ||
Vary: Accept-Encoding | ||
- url: /images | ||
static_dir: static/images | ||
- url: /robots.txt | ||
static_files: assets/common/robots.txt | ||
upload: assets/common/robots.txt | ||
secure: always | ||
http_headers: | ||
Cache-Control: 'public, max-age=600' | ||
- url: /static/pages | ||
static_dir: static/pages | ||
Cache-Control: 'public, max-age=2592000' | ||
Vary: Accept-Encoding | ||
- url: /build | ||
static_dir: build | ||
secure: always | ||
http_headers: | ||
Cache-Control: 'public, max-age=600' | ||
- url: /robots.txt | ||
static_files: static/pages/robots.txt | ||
upload: static/pages/robots.txt | ||
Cache-Control: 'public, max-age=2592000' | ||
- url: /assets/common | ||
static_dir: assets/common | ||
secure: always | ||
http_headers: | ||
Cache-Control: 'public, max-age=2592000' | ||
Vary: Accept-Encoding | ||
- url: /scripts | ||
static_dir: static/scripts | ||
# WARNING TO DEVELOPERS: Files in this folder may be stale for | ||
# up to 10 mins after a code release. | ||
Cache-Control: 'public, max-age=600' | ||
- url: /assets | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we caching this directory? I thought all the cached stuff goes in /build. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But, stuff for dev? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question still stands. Why cache dev for 30 days? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep for dev we should make it something like 4-5 mins or even lesser. The other folder is assets/common, which is required for prod as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM. How about 600 seconds, like before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds fine. |
||
static_dir: assets | ||
secure: always | ||
http_headers: | ||
Cache-Control: 'no-cache' | ||
Cache-Control: 'public, max-age=60' | ||
- url: /css | ||
# NB: not minified. TODO(sll): fix. | ||
static_dir: core/templates/dev/head/css | ||
|
@@ -53,11 +55,6 @@ handlers: | |
http_headers: | ||
Cache-Control: 'public, max-age=2592000' | ||
Vary: Accept-Encoding | ||
- url: /i18n | ||
static_dir: i18n | ||
secure: always | ||
http_headers: | ||
Cache-Control: 'no-cache' | ||
- url: /third_party/generated | ||
static_dir: third_party/generated | ||
secure: always | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<h2>v0.0.0</h2> | ||
<p>For instructions: see the README file in /static/dev/scripts.</p> | ||
|
||
<h3>Standard embedding of the latest version</h3> | ||
<oppia oppia-id="0"></oppia> | ||
<script src="http://localhost:8181/assets/scripts/oppia-player-0.0.0.js"></script> | ||
|
||
<h3>Standard embedding of version 1 of the exploration</h3> | ||
<oppia oppia-id="0" exploration-version="1"></oppia> | ||
<script src="http://localhost:8181/assets/scripts/oppia-player-0.0.1.js"></script> | ||
|
||
<h3>ERROR: No oppia id specified</h3> | ||
<oppia></oppia> | ||
<script src="http://localhost:8181/assets/scripts/oppia-player-0.0.0.js"></script> | ||
|
||
<h3>ERROR: 404 error</h3> | ||
<oppia oppia-id="fake_id"></oppia> | ||
<script src="http://localhost:8181/assets/scripts/oppia-player-0.0.0.js"></script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h2>v0.0.1 (unminified)</h2> | ||
<p>For instructions: see the README file in /assets/scripts.</p> | ||
|
||
<script src="/assets/scripts/oppia-player-0.0.1.js"></script> | ||
<script src="/assets/scripts/embedding_tests.js"></script> | ||
|
||
<div class="protractor-test-embedded-exploration"> | ||
<h3>Standard embedding of the latest version</h3> | ||
<oppia oppia-id="12"></oppia> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Cache slug is a prefix that is attached to static resource paths such as | ||
# images, scripts and css. It should only contain alphanumeric characters. | ||
# It will be automatically updated when deploy.py is run. | ||
cache_slug: | ||
default |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
|
||
from extensions.dependencies import dependencies_config | ||
import feconf | ||
import jinja_utils | ||
import utils | ||
|
||
|
||
|
@@ -54,6 +55,12 @@ def get_deps_html_and_angular_modules(cls, dependency_ids): | |
""" | ||
html = '\n'.join([ | ||
cls.get_dependency_html(dep) for dep in set(dependency_ids)]) | ||
# Html content for interactions is loaded using get_dependency_html | ||
# method. This content is then interpolated using Jinja. Interactions | ||
# such as logicproof contain jinja like variables that need to be | ||
# interpolated. LogicProof contains a cache slug variable that is | ||
# interpolated using interpolate_cache_slug method. | ||
html = jinja_utils.interpolate_cache_slug(html) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment explaining why, in detail (making particular reference to LogicProof.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
angular_modules_for_each_dep = [ | ||
cls.get_angular_modules(dep) for dep in set(dependency_ids)] | ||
deduplicated_angular_modules = list(set(list( | ||
|
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.
Let's organize this file a bit -- how about putting this rule next to favicon.ico?
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.
Yep. Done.