Skip to content
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

update last_activity when pty_read #680

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions jupyter_server/files/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.utils import ensure_async


AUTH_RESOURCE = "contents"


Expand Down Expand Up @@ -65,9 +64,14 @@ async def get(self, path, include_body=True):
if name.lower().endswith(".ipynb"):
self.set_header("Content-Type", "application/x-ipynb+json")
else:
cur_mime = mimetypes.guess_type(name)[0]
cur_mime, encoding = mimetypes.guess_type(name)
if cur_mime == "text/plain":
self.set_header("Content-Type", "text/plain; charset=UTF-8")
# RFC 6713
if encoding == "gzip":
return "application/gzip"
elif encoding is not None:
return "application/octet-stream"
elif cur_mime is not None:
self.set_header("Content-Type", cur_mime)
else:
Expand Down
3 changes: 3 additions & 0 deletions jupyter_server/terminal/terminalmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,6 @@ async def _cull_inactive_terminal(self, name):
inactivity,
)
await self.terminate(name, force=True)

def pre_pty_read_hook(self, ptywclients):
ptywclients.last_activity = utcnow()