mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 10:15:31 +00:00
Try to remove some places where the demo site still reaches into internals (#1055)
* Try to remove some places where the demo site still reaches into internals * Remove unused import
This commit is contained in:
parent
2d3f1095a2
commit
0c8e2fe4b0
4 changed files with 35 additions and 96 deletions
|
|
@ -1,26 +1,16 @@
|
|||
import { log, GoogleAnalyticsEvent } from "./logger";
|
||||
import * as Selectors from "../../js/selectors";
|
||||
import { Action, Store } from "../../js/types";
|
||||
import { Action } from "../../js/types";
|
||||
|
||||
function logEventFromAction(
|
||||
action: Action,
|
||||
store: Store
|
||||
): GoogleAnalyticsEvent | null {
|
||||
function logEventFromAction(action: Action): GoogleAnalyticsEvent | null {
|
||||
switch (action.type) {
|
||||
case "IS_PLAYING": {
|
||||
const label =
|
||||
Selectors.getCurrentTrackDisplayName(store.getState()) ?? "[UNKNOWN]";
|
||||
return { category: "Media", action: "IsPlaying", label };
|
||||
return { category: "Media", action: "IsPlaying" };
|
||||
}
|
||||
case "PAUSE": {
|
||||
const label =
|
||||
Selectors.getCurrentTrackDisplayName(store.getState()) ?? "[UNKNOWN]";
|
||||
return { category: "Media", action: "Pause", label };
|
||||
return { category: "Media", action: "Pause" };
|
||||
}
|
||||
case "STOP": {
|
||||
const label =
|
||||
Selectors.getCurrentTrackDisplayName(store.getState()) ?? "[UNKNOWN]";
|
||||
return { category: "Media", action: "Stop", label };
|
||||
return { category: "Media", action: "Stop" };
|
||||
}
|
||||
case "TOGGLE_REPEAT":
|
||||
return { category: "Media", action: "ToggleRepeat" };
|
||||
|
|
@ -117,10 +107,10 @@ function logEventFromAction(
|
|||
return null;
|
||||
}
|
||||
|
||||
export const loggerMiddleware = (store: Store) => (
|
||||
next: (action: Action) => void
|
||||
) => (action: Action) => {
|
||||
const event = logEventFromAction(action, store);
|
||||
export const loggerMiddleware = () => (next: (action: Action) => void) => (
|
||||
action: Action
|
||||
) => {
|
||||
const event = logEventFromAction(action);
|
||||
if (event != null) {
|
||||
log(event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import ReactDOM from "react-dom";
|
|||
import createMiddleware from "redux-sentry-middleware";
|
||||
import isButterchurnSupported from "butterchurn/lib/isSupported.min";
|
||||
import { WINDOWS } from "../../js/constants";
|
||||
import * as Selectors from "../../js/selectors";
|
||||
import { loggerMiddleware } from "./eventLogger";
|
||||
|
||||
import WebampLazy from "../../js/webampLazy";
|
||||
|
|
@ -23,7 +22,6 @@ import {
|
|||
SET_DUMMY_VIZ_DATA,
|
||||
} from "../../js/actionTypes";
|
||||
|
||||
import { loadFilesFromReferences } from "../../js/actionCreators";
|
||||
import { getButterchurnOptions } from "./butterchurnOptions";
|
||||
import dropboxFilePicker from "./dropboxFilePicker";
|
||||
import availableSkins from "./avaliableSkins";
|
||||
|
|
@ -94,7 +92,7 @@ try {
|
|||
|
||||
const sentryMiddleware = createMiddleware(Sentry, {
|
||||
filterBreadcrumbActions,
|
||||
stateTransformer: Selectors.getDebugData,
|
||||
stateTransformer: getDebugData,
|
||||
});
|
||||
|
||||
async function main() {
|
||||
|
|
@ -217,7 +215,12 @@ async function main() {
|
|||
fileInput.type = "file";
|
||||
fileInput.value = null;
|
||||
fileInput.addEventListener("change", (e) => {
|
||||
webamp.store.dispatch(loadFilesFromReferences(e.target.files));
|
||||
const firstFile = e.target.files[0];
|
||||
if (firstFile == null) {
|
||||
return;
|
||||
}
|
||||
const url = URL.createObjectURL(firstFile);
|
||||
webamp.setSkinFromUrl(url);
|
||||
});
|
||||
document.body.appendChild(fileInput);
|
||||
|
||||
|
|
@ -234,4 +237,17 @@ async function main() {
|
|||
}
|
||||
}
|
||||
|
||||
function getDebugData(state) {
|
||||
return {
|
||||
...state,
|
||||
display: {
|
||||
...state.display,
|
||||
skinGenLetterWidths: "[[REDACTED]]",
|
||||
skinImages: "[[REDACTED]]",
|
||||
skinCursors: "[[REDACTED]]",
|
||||
skinRegion: "[[REDACTED]]",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
main();
|
||||
|
|
|
|||
|
|
@ -650,19 +650,6 @@ export const getKhz = createSelector(
|
|||
}
|
||||
);
|
||||
|
||||
export function getDebugData(state: AppState) {
|
||||
return {
|
||||
...state,
|
||||
display: {
|
||||
...state.display,
|
||||
skinGenLetterWidths: "[[REDACTED]]",
|
||||
skinImages: "[[REDACTED]]",
|
||||
skinCursors: "[[REDACTED]]",
|
||||
skinRegion: "[[REDACTED]]",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function getMilkdropMessage(state: AppState): MilkdropMessage | null {
|
||||
return state.milkdrop.message;
|
||||
}
|
||||
|
|
|
|||
66
yarn.lock
66
yarn.lock
|
|
@ -4020,7 +4020,7 @@ bl@^4.0.1:
|
|||
inherits "^2.0.4"
|
||||
readable-stream "^3.4.0"
|
||||
|
||||
bluebird@^3.1.5, bluebird@^3.4.7, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5:
|
||||
bluebird@^3.1.5, bluebird@^3.5.1, bluebird@^3.5.5:
|
||||
version "3.7.2"
|
||||
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
||||
|
||||
|
|
@ -5873,10 +5873,6 @@ env-variable@0.0.x:
|
|||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.6.tgz#74ab20b3786c545b62b4a4813ab8cf22726c9808"
|
||||
|
||||
err-code@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960"
|
||||
|
||||
errno@^0.1.3, errno@~0.1.7:
|
||||
version "0.1.7"
|
||||
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618"
|
||||
|
|
@ -6638,14 +6634,6 @@ file-entry-cache@^5.0.1:
|
|||
dependencies:
|
||||
flat-cache "^2.0.1"
|
||||
|
||||
file-js@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/file-js/-/file-js-0.3.0.tgz#fab46bf782346c9294499f1f0d2ad07d838f25d1"
|
||||
dependencies:
|
||||
bluebird "^3.4.7"
|
||||
minimatch "^3.0.3"
|
||||
proper-lockfile "^1.2.0"
|
||||
|
||||
file-loader@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-2.0.0.tgz#39749c82f020b9e85901dcff98e8004e6401cfde"
|
||||
|
|
@ -6695,17 +6683,6 @@ file-uri-to-path@1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
|
||||
|
||||
filehound@^1.17.0:
|
||||
version "1.17.4"
|
||||
resolved "https://registry.yarnpkg.com/filehound/-/filehound-1.17.4.tgz#3f5b76c5b3edc1080311ba802e1ad43179e4291e"
|
||||
dependencies:
|
||||
bluebird "^3.5.1"
|
||||
file-js "0.3.0"
|
||||
lodash "^4.17.10"
|
||||
minimatch "^3.0.4"
|
||||
moment "^2.22.1"
|
||||
unit-compare "^1.0.1"
|
||||
|
||||
filename-regex@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
|
||||
|
|
@ -9659,7 +9636,7 @@ jsx-ast-utils@^2.2.3:
|
|||
array-includes "^3.0.3"
|
||||
object.assign "^4.1.0"
|
||||
|
||||
jszip@*, jszip@^3.1.3, jszip@^3.1.5:
|
||||
jszip@*, jszip@^3.1.3:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.4.0.tgz#1a69421fa5f0bb9bc222a46bca88182fba075350"
|
||||
dependencies:
|
||||
|
|
@ -9898,7 +9875,7 @@ lodash.uniq@^4.5.0:
|
|||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||
|
||||
lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4:
|
||||
lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4:
|
||||
version "4.17.15"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
||||
|
||||
|
|
@ -10057,10 +10034,6 @@ math-random@^1.0.1:
|
|||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c"
|
||||
|
||||
md5-file@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/md5-file/-/md5-file-4.0.0.tgz#f3f7ba1e2dd1144d5bf1de698d0e5f44a4409584"
|
||||
|
||||
md5.js@^1.3.4:
|
||||
version "1.3.5"
|
||||
resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"
|
||||
|
|
@ -10282,7 +10255,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
|
||||
|
||||
minimatch@^3.0.3, minimatch@^3.0.4:
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
dependencies:
|
||||
|
|
@ -10367,10 +10340,6 @@ mkdirp@^1.0.4:
|
|||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
|
||||
moment@^2.14.1, moment@^2.22.1:
|
||||
version "2.26.0"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a"
|
||||
|
||||
move-concurrently@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|
||||
|
|
@ -10509,7 +10478,7 @@ node-environment-flags@^1.0.5:
|
|||
object.getownpropertydescriptors "^2.0.3"
|
||||
semver "^5.7.0"
|
||||
|
||||
node-fetch@^2.3.0, node-fetch@^2.6.0:
|
||||
node-fetch@^2.6.0:
|
||||
version "2.6.0"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
|
||||
|
||||
|
|
@ -11821,15 +11790,6 @@ prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.8, pr
|
|||
object-assign "^4.1.1"
|
||||
react-is "^16.8.1"
|
||||
|
||||
proper-lockfile@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-1.2.0.tgz#ceff5dd89d3e5f10fb75e1e8e76bc75801a59c34"
|
||||
dependencies:
|
||||
err-code "^1.0.0"
|
||||
extend "^3.0.0"
|
||||
graceful-fs "^4.1.2"
|
||||
retry "^0.10.0"
|
||||
|
||||
proto-list@~1.2.1:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
|
||||
|
|
@ -11902,7 +11862,7 @@ punycode@^2.1.0, punycode@^2.1.1:
|
|||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
|
||||
|
||||
puppeteer@^1.12.2, puppeteer@^1.15.0, puppeteer@^1.17.0:
|
||||
puppeteer@^1.15.0, puppeteer@^1.17.0:
|
||||
version "1.20.0"
|
||||
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.20.0.tgz#e3d267786f74e1d87cf2d15acc59177f471bbe38"
|
||||
dependencies:
|
||||
|
|
@ -12571,10 +12531,6 @@ ret@~0.1.10:
|
|||
version "0.1.15"
|
||||
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
|
||||
|
||||
retry@^0.10.0:
|
||||
version "0.10.1"
|
||||
resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4"
|
||||
|
||||
retry@^0.12.0:
|
||||
version "0.12.0"
|
||||
resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b"
|
||||
|
|
@ -12909,10 +12865,6 @@ shebang-regex@^3.0.0:
|
|||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||
|
||||
shell-escape@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/shell-escape/-/shell-escape-0.2.0.tgz#68fd025eb0490b4f567a027f0bf22480b5f84133"
|
||||
|
||||
shellwords@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||
|
|
@ -14055,12 +14007,6 @@ unique-slug@^2.0.0:
|
|||
dependencies:
|
||||
imurmurhash "^0.1.4"
|
||||
|
||||
unit-compare@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/unit-compare/-/unit-compare-1.0.1.tgz#0c7459f0e5bf53637ea873ca3cee18de2eeca386"
|
||||
dependencies:
|
||||
moment "^2.14.1"
|
||||
|
||||
unpipe@1.0.0, unpipe@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue