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
|
- name: 🛠️ Build using docker
|
||||||
run: |
|
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
|
- name: 🔨 Fix permissions
|
||||||
run: |
|
run: |
|
||||||
|
5
dist/web/Dockerfile
vendored
5
dist/web/Dockerfile
vendored
@ -73,7 +73,7 @@ cp /imhex/dist/web/source/* /build
|
|||||||
ccache -s
|
ccache -s
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch as raw
|
||||||
COPY --from=build [ \
|
COPY --from=build [ \
|
||||||
# ImHex \
|
# ImHex \
|
||||||
"/build/imhex.wasm", \
|
"/build/imhex.wasm", \
|
||||||
@ -94,3 +94,6 @@ COPY --from=build [ \
|
|||||||
# Destination \
|
# 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) {
|
for (let file of selector.files) {
|
||||||
const fr = new FileReader();
|
const fr = new FileReader();
|
||||||
fr.onload = () => {
|
fr.onload = () => {
|
||||||
let path = "/openedFiles/"+file.name;
|
let folder = "/openedFiles/"+Math.random().toString(36).substring(2)+"/";
|
||||||
if (FS.analyzePath(path).exists) {
|
FS.createPath("/", folder);
|
||||||
FS.unlink(path);
|
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);
|
fr.readAsBinaryString(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user