-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
37 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
import sirepo.sim_data | ||
import sirepo.sim_run | ||
import sirepo.srschema | ||
import sirepo.srtime | ||
import sirepo.uri | ||
import sirepo.util | ||
import urllib | ||
|
@@ -32,7 +33,6 @@ | |
): | ||
import h5py | ||
|
||
_ROBOTS_TXT = None | ||
|
||
#: Global app value (only here so instance not lost) | ||
_app = None | ||
|
@@ -393,20 +393,20 @@ async def api_pythonSource( | |
@sirepo.quest.Spec("allow_visitor") | ||
async def api_robotsTxt(self): | ||
"""Disallow the app (dev, prod) or / (alpha, beta)""" | ||
global _ROBOTS_TXT | ||
if not _ROBOTS_TXT: | ||
# We include dev so we can test | ||
if pkconfig.channel_in("prod", "dev"): | ||
u = [ | ||
self.uri_for_app_root(x) | ||
for x in sorted(sirepo.feature_config.cfg().sim_types) | ||
] | ||
else: | ||
u = ["/"] | ||
_ROBOTS_TXT = "".join( | ||
# We include dev so we can test | ||
if pkconfig.channel_in("prod", "dev"): | ||
u = [ | ||
self.uri_for_app_root(x) | ||
for x in sorted(sirepo.feature_config.cfg().sim_types) | ||
] | ||
else: | ||
u = ["/"] | ||
return self.reply( | ||
content="".join( | ||
["User-agent: *\n"] + ["Disallow: {}\n".format(x) for x in u], | ||
) | ||
return self.reply(content=_ROBOTS_TXT, content_type="text/plain") | ||
), | ||
content_type="text/plain", | ||
) | ||
|
||
@sirepo.quest.Spec("allow_visitor", path_info="PathInfo") | ||
async def api_root(self, path_info=None): | ||
|
@@ -432,6 +432,20 @@ async def api_saveSimulationData(self): | |
), | ||
) | ||
|
||
@sirepo.quest.Spec("allow_visitor") | ||
async def api_securityTxt(self): | ||
d = sirepo.srtime.utc_now() | ||
d = d.replace(year=d.year + 1, hour=0, minute=0, second=0, microsecond=0) | ||
return self.reply( | ||
content="".join( | ||
[ | ||
"Contact: mailto:[email protected]\n", | ||
f"Expires: {d.isoformat()}Z\n", | ||
] | ||
), | ||
content_type="text/plain", | ||
) | ||
|
||
@sirepo.quest.Spec( | ||
"require_user", simulation_id="SimId", pretty="Bool optional", section="Section" | ||
) | ||
|
File renamed without changes.
File renamed without changes
File renamed without changes.