Skip to content

Commit

Permalink
update app and fix #29
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Seiji Hariki <[email protected]>
  • Loading branch information
seijihariki committed Jan 24, 2023
1 parent d903006 commit 4ebdc9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app
Submodule app updated 2 files
+1 −1 index.html
+0 −20 js/index.js
14 changes: 12 additions & 2 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
from fastapi import FastAPI
import os
from launch import run
import pathlib
import inspect

import string
import random as rd


extension_dir = pathlib.Path(inspect.getfile(lambda: None)).parent.parent
key_characters = (string.ascii_letters + string.digits)


Expand All @@ -20,7 +24,7 @@ def random_string(length=20):
def get_files(path):
# Gets all files
directories = set()
for root, _, files in os.walk(path):
for root, _, files in os.walk(path.resolve()):
for file in files:
directories.add(root + '/' + file)

Expand All @@ -30,7 +34,13 @@ def get_files(path):
def started(demo, app: FastAPI):
try:
# Force allow paths for fixing symlinked extension directory references
force_allow = get_files(f"{os.path.abspath(scripts.basedir())}/app")
force_allow = get_files(extension_dir / "app")

# Add to allowed files list
app.blocks.temp_file_sets.append(force_allow)

# Force allow paths for fixing symlinked extension directory references (base javascript files now)
force_allow = get_files(extension_dir / "javascript")

# Add to allowed files list
app.blocks.temp_file_sets.append(force_allow)
Expand Down

0 comments on commit 4ebdc9a

Please sign in to comment.