mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 09:09:01 +00:00
Don't leak a file into into the global DOM
Fixes #662 This never should have been in the Webamp class. It's only used for testing/screenshots.
This commit is contained in:
parent
9cef2e606a
commit
343686f745
2 changed files with 11 additions and 13 deletions
11
js/index.js
11
js/index.js
|
|
@ -27,6 +27,7 @@ import {
|
|||
SET_EQ_AUTO,
|
||||
SET_DUMMY_VIZ_DATA
|
||||
} from "./actionTypes";
|
||||
import { loadFilesFromReferences } from "./actionCreators";
|
||||
|
||||
import {
|
||||
skinUrl as configSkinUrl,
|
||||
|
|
@ -280,6 +281,16 @@ Raven.context(() => {
|
|||
|
||||
enableMediaSession(webamp);
|
||||
|
||||
const fileInput = document.createElement("input");
|
||||
fileInput.id = "webamp-file-input";
|
||||
fileInput.style.display = "none";
|
||||
fileInput.type = "file";
|
||||
fileInput.value = null;
|
||||
fileInput.addEventListener("change", e => {
|
||||
webamp.store.dispatch(loadFilesFromReferences(e.target.files));
|
||||
});
|
||||
document.body.appendChild(fileInput);
|
||||
|
||||
webamp.renderWhenReady(document.getElementById("app"));
|
||||
|
||||
// Expose webamp instance for debugging and integration tests.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import {
|
|||
setSkinFromUrl,
|
||||
loadMediaFiles,
|
||||
setWindowSize,
|
||||
loadFilesFromReferences,
|
||||
play,
|
||||
pause,
|
||||
seekBackward,
|
||||
|
|
@ -93,18 +92,6 @@ class Winamp {
|
|||
type: navigator.onLine ? NETWORK_CONNECTED : NETWORK_DISCONNECTED
|
||||
});
|
||||
|
||||
if (true) {
|
||||
const fileInput = document.createElement("input");
|
||||
fileInput.id = "webamp-file-input";
|
||||
fileInput.style.display = "none";
|
||||
fileInput.type = "file";
|
||||
fileInput.value = null;
|
||||
fileInput.addEventListener("change", e => {
|
||||
this.store.dispatch(loadFilesFromReferences(e.target.files));
|
||||
});
|
||||
document.body.appendChild(fileInput);
|
||||
}
|
||||
|
||||
if (zIndex != null) {
|
||||
this.store.dispatch({ type: SET_Z_INDEX, zIndex });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue