Compare commits
3 Commits
4060a582d6
...
20a5c66e77
Author | SHA1 | Date | |
---|---|---|---|
![]() |
20a5c66e77 | ||
![]() |
05cc823e37 | ||
![]() |
3a65277994 |
@ -17,6 +17,9 @@ from sanic.log import logger
|
||||
|
||||
from cista import config
|
||||
from cista.util.filename import sanitize
|
||||
import pillow_heif
|
||||
|
||||
pillow_heif.register_heif_opener()
|
||||
|
||||
bp = Blueprint("preview", url_prefix="/preview")
|
||||
|
||||
|
@ -101,7 +101,7 @@ const video = () => ['mkv', 'mp4', 'webm', 'mov', 'avi'].includes(props.doc.ext)
|
||||
const audio = () => ['mp3', 'flac', 'ogg', 'aac'].includes(props.doc.ext)
|
||||
const archive = () => ['zip', 'tar', 'gz', 'bz2', 'xz', '7z', 'rar'].includes(props.doc.ext)
|
||||
const preview = () => (
|
||||
['bmp', 'ico', 'tif', 'tiff', 'pdf'].includes(props.doc.ext) ||
|
||||
['bmp', 'ico', 'tif', 'tiff', 'heic', 'heif', 'pdf', 'epub', 'mobi'].includes(props.doc.ext) ||
|
||||
props.doc.size > 500000 &&
|
||||
['avif', 'webp', 'png', 'jpg', 'jpeg'].includes(props.doc.ext)
|
||||
)
|
||||
|
@ -24,6 +24,7 @@ dependencies = [
|
||||
"natsort",
|
||||
"pathvalidate",
|
||||
"pillow",
|
||||
"pillow-heif>=1.1.0",
|
||||
"pyjwt",
|
||||
"pymupdf",
|
||||
"sanic",
|
||||
|
@ -11,17 +11,27 @@ class CustomBuildHook(BuildHookInterface):
|
||||
def initialize(self, version, build_data):
|
||||
super().initialize(version, build_data)
|
||||
stderr.write(">>> Building Cista frontend\n")
|
||||
npm = None
|
||||
bun = shutil.which("bun")
|
||||
if bun is None:
|
||||
npm = shutil.which("npm")
|
||||
if npm is None:
|
||||
raise RuntimeError(
|
||||
"NodeJS `npm` is required for building Cista but it was not found"
|
||||
"Bun or NodeJS `npm` is required for building but neither was found\n Visit https://bun.com/"
|
||||
)
|
||||
# npm --prefix doesn't work on Windows, so we chdir instead
|
||||
os.chdir("frontend")
|
||||
try:
|
||||
if npm:
|
||||
stderr.write("### npm install\n")
|
||||
subprocess.run([npm, "install"], check=True) # noqa: S603
|
||||
stderr.write("\n### npm run build\n")
|
||||
subprocess.run([npm, "run", "build"], check=True) # noqa: S603
|
||||
else:
|
||||
assert bun
|
||||
stderr.write("### bun install\n")
|
||||
subprocess.run([bun, "install"], check=True) # noqa: S603
|
||||
stderr.write("\n### bun run build\n")
|
||||
subprocess.run([bun, "run", "build"], check=True) # noqa: S603
|
||||
finally:
|
||||
os.chdir("..")
|
||||
|
Loading…
x
Reference in New Issue
Block a user