Skip to content

Commit

Permalink
Merge remote-tracking branch 'amun-ai/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Mar 4, 2024
2 parents 603881c + 4441984 commit e7e6e7c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion hypha/built-in/echo-service.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>ImJoy Plugin Template</title>
<meta name="description" content="Template for ImJoy plugin">
<meta name="author" content="ImJoy-Team">
<script src="https://cdn.jsdelivr.net/npm/[email protected].44/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].48/dist/hypha-rpc-websocket.min.js"></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion hypha/built-in/imjoy-plugin-parser.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>ImJoy Plugin Template</title>
<meta name="description" content="Template for ImJoy plugin">
<meta name="author" content="ImJoy-Team">
<script src="https://cdn.jsdelivr.net/npm/[email protected].44/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].48/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/pluginParser.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion hypha/built-in/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="description" content="A playground for developing ImJoy plugins">
<meta name="author" content="ImJoy-Team">
<link rel="stylesheet" data-name="vs/editor/editor.main" href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs/editor/editor.main.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected].44/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].48/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/pluginParser.js"></script>
<script>
window.default_plugin = `
Expand Down
2 changes: 1 addition & 1 deletion hypha/built-in/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>ImJoy Plugin Template</title>
<meta name="description" content="Template for ImJoy plugin">
<meta name="author" content="ImJoy-Team">
<script src="https://cdn.jsdelivr.net/npm/[email protected].44/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].48/dist/hypha-rpc-websocket.min.js"></script>
</head>

<body>
Expand Down
23 changes: 12 additions & 11 deletions hypha/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from hypha.triton import TritonProxy
from hypha.utils import GZipMiddleware, GzipRoute, PatchedCORSMiddleware
from hypha.websocket import WebsocketServer
from contextlib import asynccontextmanager

try:
# For pyodide, we need to patch http
Expand Down Expand Up @@ -152,17 +153,6 @@ async def liveness(req: Request) -> JSONResponse:

return JSONResponse({"status": "DOWN"}, status_code=503)

@app.on_event("startup")
async def startup_event():
# Here we can register all the startup functions
args.startup_functions = args.startup_functions or []
args.startup_functions.append("hypha.core.auth:register_login_service")
await store.init(args.reset_redis, startup_functions=args.startup_functions)

@app.on_event("shutdown")
def shutdown_event():
store.get_event_bus().emit("shutdown", target="local")


def mount_static_files(app, new_route, directory, name="static"):
# Get top level route paths
Expand Down Expand Up @@ -200,8 +190,19 @@ def create_application(args):
else:
args.allow_origins = env.get("ALLOW_ORIGINS", "*").split(",")

@asynccontextmanager
async def lifespan(app: FastAPI):
# Here we can register all the startup functions
args.startup_functions = args.startup_functions or []
args.startup_functions.append("hypha.core.auth:register_login_service")
await store.init(args.reset_redis, startup_functions=args.startup_functions)
yield
# Emit the shutdown event
store.get_event_bus().emit("shutdown", target="local")

application = FastAPI(
title="Hypha",
lifespan=lifespan,
docs_url="/api-docs",
redoc_url="/api-redoc",
description=(
Expand Down
2 changes: 1 addition & 1 deletion hypha/templates/web-python-plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
async def run():
try:
await micropip.install(["imjoy-rpc==0.5.44", {% for req in requirements %}"{{req}}", {% endfor %}])
await micropip.install(["imjoy-rpc==0.5.48.post1", {% for req in requirements %}"{{req}}", {% endfor %}])
js.__resolve()
except Exception as e:
js.__reject(traceback.format_exc())
Expand Down
2 changes: 1 addition & 1 deletion hypha/templates/web-worker-plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
self.onmessage = function(e) {
const config = e.data

importScripts("https://cdn.jsdelivr.net/npm/[email protected].44/dist/hypha-rpc-websocket.min.js")
importScripts("https://cdn.jsdelivr.net/npm/[email protected].48/dist/hypha-rpc-websocket.min.js")

hyphaWebsocketClient.connectToServer(config).then(async (api)=>{
await hyphaWebsocketClient.loadRequirements([{% for req in requirements %}"{{req}}", {% endfor %}])
Expand Down
2 changes: 1 addition & 1 deletion hypha/templates/window-plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>ImJoy Plugin (window)</title>
<meta name="description" content="Template for ImJoy plugin">
<meta name="author" content="ImJoy-Team">
<script src="https://cdn.jsdelivr.net/npm/[email protected].44/dist/hypha-rpc-websocket.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].48/dist/hypha-rpc-websocket.min.js"></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aioboto3==11.2.0
aiofiles==23.2.1
base58==2.1.1
fastapi==0.106.0
imjoy-rpc==0.5.44
imjoy-rpc==0.5.48.post1
jinja2==3.1.2
lxml==4.9.3
msgpack==1.0.5
Expand Down

0 comments on commit e7e6e7c

Please sign in to comment.