feat: Allow users to open multiple files with the same name in the web version + make web Dockerfile able to run web server by itself (#1518)
This commit is contained in:
parent
a4d6932ed8
commit
b7349e42c7
2
.github/workflows/build_web.yml
vendored
2
.github/workflows/build_web.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
- name: 🛠️ Build using docker
|
||||
run: |
|
||||
docker buildx build . -f dist/web/Dockerfile --progress=plain --build-arg 'JOBS=4' --output out
|
||||
docker buildx build . -f dist/web/Dockerfile --progress=plain --build-arg 'JOBS=4' --output out --target raw
|
||||
|
||||
- name: 🔨 Fix permissions
|
||||
run: |
|
||||
|
5
dist/web/Dockerfile
vendored
5
dist/web/Dockerfile
vendored
@ -73,7 +73,7 @@ cp /imhex/dist/web/source/* /build
|
||||
ccache -s
|
||||
EOF
|
||||
|
||||
FROM scratch
|
||||
FROM scratch as raw
|
||||
COPY --from=build [ \
|
||||
# ImHex \
|
||||
"/build/imhex.wasm", \
|
||||
@ -94,3 +94,6 @@ COPY --from=build [ \
|
||||
# Destination \
|
||||
"./" \
|
||||
]
|
||||
|
||||
FROM nginx
|
||||
COPY --from=raw . /usr/share/nginx/html
|
||||
|
10
dist/web/compose.yml
vendored
Normal file
10
dist/web/compose.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# docker compose -f dist/web/compose.yml --build up
|
||||
version: '3'
|
||||
services:
|
||||
imhex_web:
|
||||
image: imhex_web:latest
|
||||
build:
|
||||
context: ../../ # ImHex folder
|
||||
dockerfile: ./dist/web/Dockerfile
|
||||
ports:
|
||||
- 8080:80
|
@ -153,12 +153,14 @@ namespace hex::fs {
|
||||
for (let file of selector.files) {
|
||||
const fr = new FileReader();
|
||||
fr.onload = () => {
|
||||
let path = "/openedFiles/"+file.name;
|
||||
if (FS.analyzePath(path).exists) {
|
||||
FS.unlink(path);
|
||||
let folder = "/openedFiles/"+Math.random().toString(36).substring(2)+"/";
|
||||
FS.createPath("/", folder);
|
||||
if (FS.analyzePath(folder+file.name).exists) {
|
||||
console.log(`Error: ${folder+file.name} already exist`);
|
||||
} else {
|
||||
FS.createDataFile(folder, file.name, fr.result, true, true);
|
||||
Module._fileBrowserCallback(stringToNewUTF8(folder+file.name));
|
||||
}
|
||||
FS.createDataFile("/openedFiles/", file.name, fr.result, true, true);
|
||||
Module._fileBrowserCallback(stringToNewUTF8(path));
|
||||
};
|
||||
|
||||
fr.readAsBinaryString(file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user