Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Mar 15, 2024
2 parents 86d249d + e22bfe4 commit d58876f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts/wizard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function wizard_install() {
fi

if [ $WEB_UI = true ]; then
WEB_UI_ARCHIVE="./jarklin.tgz"
WEB_UI_ARCHIVE="./web-ui.tgz"
WEB_UI_DIR="./jarklin/web/web-ui/"
info "Downloading Web-UI..."
wiz_download_web_ui "$WEB_UI_ARCHIVE"
Expand Down
13 changes: 7 additions & 6 deletions src/jarklin/cache/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ def invalidate(self) -> None:
CacheGenerator.remove(fp=dest)

def generate(self) -> None:
# todo: skip incomplete and add available first
logging.info("cache.generate()")
info: t.List[InfoEntry] = []
problems: t.List[ProblemEntry] = []
generators: t.List[CacheGenerator] = self.find_generators()

def generate_info_file():
logging.info("generating info.json")
with open(self.root.joinpath('.jarklin/info.json'), 'w') as fp:
def generate_data_files():
logging.info("generating media.json")
with open(self.jarklin_path / 'media.json', 'w') as fp:
fp.write(json.dumps(info))
logging.info("generating problems.json")
with open(self.root.joinpath('.jarklin/problems.json'), 'w') as fp:
with open(self.jarklin_path / 'problems.json', 'w') as fp:
fp.write(json.dumps(problems))

for generator in generators:
Expand All @@ -144,7 +145,7 @@ def generate_info_file():
if dest.is_dir():
shutil.rmtree(dest, ignore_errors=True)
continue
generate_info_file()
generate_data_files()
info.append(InfoEntry(
path=str(source.relative_to(self.root)),
name=source.stem if source.is_file() else source.name,
Expand All @@ -157,7 +158,7 @@ def generate_info_file():
logging.error(f"Cache: {generator} failed", exc_info=error)
continue

generate_info_file()
generate_data_files()

def find_generators(self) -> t.List[CacheGenerator]:
logging.info("Collecting Generators")
Expand Down
4 changes: 2 additions & 2 deletions src/jarklin/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def files(resource: str):
root = p.abspath(os.getcwd())
fp = p.abspath(p.join(root, resource))
if fp in app.config['EXCLUDE']:
raise HTTPNotFound()
raise HTTPNotFound(resource)
if p.commonpath([root, fp]) != root:
raise HTTPNotFound(f"{fp!s}")
raise HTTPNotFound(resource)

if attempt_optimization and flask.current_app.config['JIT_OPTIMIZATION']:
try:
Expand Down

0 comments on commit d58876f

Please sign in to comment.