diff --git a/package-lock.json b/package-lock.json index 9bf264a..c1cbf41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "beatdrop", - "version": "2.5.6", + "version": "2.5.8", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -56,6 +56,12 @@ "ms": "^2.1.1" } }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -772,6 +778,14 @@ "@babel/helper-plugin-utils": "^7.0.0", "resolve": "^1.8.1", "semver": "^5.5.1" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "@babel/plugin-transform-shorthand-properties": { @@ -891,6 +905,14 @@ "invariant": "^2.2.2", "js-levenshtein": "^1.1.3", "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "@babel/preset-react": { @@ -1482,6 +1504,12 @@ "requires": { "ms": "^2.1.1" } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true } } }, @@ -2072,6 +2100,14 @@ "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "@babel/plugin-transform-classes": { @@ -4885,6 +4921,14 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "execa": { @@ -5366,6 +5410,14 @@ "cross-unzip": "0.0.2", "rimraf": "^2.5.2", "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "electron-download": { @@ -5395,6 +5447,12 @@ "jsonfile": "^4.0.0", "universalify": "^0.1.0" } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true } } }, @@ -5474,6 +5532,13 @@ "pako": "^1.0.6", "semver": "^5.6.0", "source-map-support": "^0.5.9" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + } } }, "elliptic": { @@ -5697,6 +5762,12 @@ "estraverse": "^4.1.1" } }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -10309,6 +10380,14 @@ "semver": "^5.5.0", "shellwords": "^0.1.1", "which": "^1.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "node-releases": { @@ -10318,6 +10397,14 @@ "dev": true, "requires": { "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "node-sass": { @@ -10417,6 +10504,13 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + } } }, "normalize-path": { @@ -10781,6 +10875,14 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "execa": { @@ -10881,6 +10983,14 @@ "registry-auth-token": "^3.0.1", "registry-url": "^3.0.3", "semver": "^5.1.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "pako": { @@ -13781,6 +13891,14 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "find-up": { @@ -13980,6 +14098,14 @@ "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "ansi-regex": { @@ -14294,6 +14420,14 @@ "babylon": "^6.18.0", "istanbul-lib-coverage": "^1.2.1", "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "istanbul-lib-report": { @@ -14777,6 +14911,14 @@ "natural-compare": "^1.4.0", "pretty-format": "^23.6.0", "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "jest-util": { @@ -16055,6 +16197,12 @@ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + }, "shallow-clone": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-1.0.0.tgz", @@ -16127,9 +16275,9 @@ } }, "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, "semver-diff": { "version": "2.1.0", @@ -16138,6 +16286,14 @@ "dev": true, "requires": { "semver": "^5.0.3" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "send": { diff --git a/package.json b/package.json index 7e19aa9..cbef734 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "beatdrop", "description": "A desktop app for downloading Beat Saber songs.", "author": "Nathaniel Johns (StarGazer1258)", - "version": "2.5.6", + "version": "2.5.8", "private": false, "license": "CC-BY-NC-SA-4.0", "repository": { @@ -28,6 +28,7 @@ "redux-thunk": "^2.3.0", "remarkable": "^1.7.1", "rimraf": "^2.6.2", + "semver": "^6.3.0", "sortablejs": "^1.8.0-rc1", "walker": "^1.0.7" }, diff --git a/src/actions/detailsActions.js b/src/actions/detailsActions.js index da9425c..8ca0ac3 100644 --- a/src/actions/detailsActions.js +++ b/src/actions/detailsActions.js @@ -1,5 +1,5 @@ import { LOAD_DETAILS, CLEAR_DETAILS, SET_DETAILS_LOADING, DISPLAY_WARNING } from './types' -import { SONG_DETAILS } from '../views' +import { SONG_DETAILS } from '../constants/views' import AdmZip from 'adm-zip' import { hashAndWriteToMetadata } from './queueActions' diff --git a/src/actions/modActions.js b/src/actions/modActions.js index 8fc5816..5df931a 100644 --- a/src/actions/modActions.js +++ b/src/actions/modActions.js @@ -1,5 +1,5 @@ import { SET_MOD_LIST, SET_RESOURCE, SET_LOADING, LOAD_MOD_DETAILS, INSTALL_MOD, SET_SCANNING_FOR_MODS, SET_INSTALLED_MODS, DISPLAY_WARNING, UNINSTALL_MOD, CLEAR_MODS, ADD_TO_QUEUE, UPDATE_PROGRESS, ADD_DEPENDENT, SET_MOD_ACTIVE, ADD_PENDING_MOD, SET_PATCHING } from './types' -import { MODS_VIEW, MOD_DETAILS } from '../views' +import { MODS_VIEW, MOD_DETAILS } from '../constants/views' import { BEATMODS, LIBRARY } from '../constants/resources' @@ -13,6 +13,7 @@ const path = remote.require('path') const crypto = remote.require('crypto') const AdmZip = remote.require('adm-zip') const execFile = remote.require('child_process').execFile +const semver = remote.require('semver') const { ipcRenderer } = window.require('electron') @@ -196,7 +197,7 @@ export const loadModDetails = modId => dispatch => { type: SET_LOADING, payload: true }) - fetch(`https://beatmods.com/api/v1/mod?status=approved&status=inactive`) + fetch(`https://beatmods.com/api/v1/mod`) .then(res => res.json()) .then(beatModsResponse => { dispatch({ @@ -211,13 +212,13 @@ export const loadModDetails = modId => dispatch => { } export const installMod = (modName, version, dependencyOf = '') => (dispatch, getState) => { - console.log(`Asked to install ${modName}@${version}`) + console.log(`Asked to install ${modName}`) if(isModPendingInstall(modName)(dispatch, getState)) { - console.log(`${modName}@${version} is already pending install!`) + console.log(`${modName} is already pending install!`) return } else { if(!isModInstalled(modName)(dispatch, getState)) { - console.log(`${modName}@${version} isn't installed, adding it to pending installs...`) + console.log(`${modName} isn't installed, adding it to pending installs...`) dispatch({ type: ADD_PENDING_MOD, payload: modName @@ -226,7 +227,7 @@ export const installMod = (modName, version, dependencyOf = '') => (dispatch, ge } if(gamePatchedWith()(dispatch, getState) === 'NONE' && !isModPendingInstall('BSIPA')(dispatch, getState)) patchGame()(dispatch, getState) if(isModInstalled(modName)(dispatch, getState)) { - console.log(`${modName}@${version} is already installed!`) + console.log(`${modName} is already installed!`) if(!getState().mods.installedMods.filter(mod => mod.name === modName)[0].dependencyOf.includes(dependencyOf)) { dispatch({ type: ADD_DEPENDENT, @@ -238,26 +239,35 @@ export const installMod = (modName, version, dependencyOf = '') => (dispatch, ge } return } - console.log(`Fetching ${modName}@${version} from BeatMods...`) - fetch(`https://beatmods.com/api/v1/mod?status=approved${!!version ? `&status=inactive&version=${version}` : ''}&name=${encodeURIComponent(modName)}&gameVersion=${getState().settings.gameVersion}`) + console.log(`Fetching ${modName} from BeatMods...`) + fetch(`https://beatmods.com/api/v1/mod?status=approved&name=${ encodeURIComponent(modName) }&gameVersion=${ getState().settings.gameVersion }`) .then(res => res.json()) .then(beatModsResponse => { - console.log(`Got the BeatMods response for ${modName}@${version}`) + console.log(`Got the BeatMods response for ${ modName }`) console.log(JSON.stringify(beatModsResponse)) if(beatModsResponse.length === 0) return + let latestVersion = beatModsResponse[0].version + let latestIndex = 0 + for(let i = 0; i < beatModsResponse; i++) { + if(semver.satisfies(beatModsResponse[i].version, `^${ latestVersion }`)) { + latestVersion = beatModsResponse[i].version + latestIndex = i + } + } let utc = Date.now() - let mod = beatModsResponse[beatModsResponse.length - 1] + let mod = beatModsResponse[latestIndex] let req let len = 0 let chunks = 0 + console.log(mod) dispatch({ type: ADD_TO_QUEUE, payload: { utc, - hashMd5: mod._id, - coverUrl: modIcon, - songName: mod.name, - authorName: mod.author.username + hash: mod._id, + image: modIcon, + title: mod.name, + author: mod.author.username } }) @@ -265,11 +275,11 @@ export const installMod = (modName, version, dependencyOf = '') => (dispatch, ge // Install Dependencies console.log(`Installing dependencies for ${ modName }...`) for(let i = 0; i < mod.dependencies.length; i++) { - console.log(`You gonna install ${mod.dependencies[i].name}@${mod.dependencies[i].version}?`) + console.log(`You gonna install ${ mod.dependencies[i].name }?`) installMod(mod.dependencies[i].name, mod.dependencies[i].version, modName)(dispatch, getState) dependsOn.push(mod.dependencies[i].name) } - console.log(`Dependencies found: ${dependsOn.join(', ')}`) + console.log(`Dependencies found: ${ dependsOn.join(', ') }`) // Install Mod console.log(`Installing ${ modName }...`) @@ -309,7 +319,7 @@ export const installMod = (modName, version, dependencyOf = '') => (dispatch, ge payload: { id: mod._id, name: mod.name, - version: beatModsResponse.version, + version: mod.version, files, dependencyOf: [ dependencyOf ], dependsOn, diff --git a/src/actions/playlistsActions.js b/src/actions/playlistsActions.js index cda0913..01a3fe2 100644 --- a/src/actions/playlistsActions.js +++ b/src/actions/playlistsActions.js @@ -1,5 +1,5 @@ import { FETCH_LOCAL_PLAYLISTS, LOAD_NEW_PLAYLIST_IMAGE, SET_NEW_PLAYLIST_OPEN, SET_PLAYLIST_PICKER_OPEN, CLEAR_PLAYLIST_DIALOG, LOAD_PLAYLIST_DETAILS, LOAD_PLAYLIST_SONGS, CLEAR_PLAYLIST_DETAILS, SET_PLAYLIST_EDITING, SET_LOADING, DISPLAY_WARNING } from './types' -import { PLAYLIST_LIST, PLAYLIST_DETAILS } from '../views' +import { PLAYLIST_LIST, PLAYLIST_DETAILS } from '../constants/views' import { defaultPlaylistIcon } from '../b64Assets' import { hashAndWriteToMetadata } from './queueActions' import { setView } from './viewActions' diff --git a/src/actions/queueActions.js b/src/actions/queueActions.js index c3ddd0b..c53b8e8 100644 --- a/src/actions/queueActions.js +++ b/src/actions/queueActions.js @@ -1,5 +1,5 @@ import { SET_QUEUE_OPEN, ADD_TO_QUEUE, CLEAR_QUEUE, UPDATE_PROGRESS, SET_DOWNLOADED_SONGS, SET_DOWNLOADING_COUNT, SET_WAIT_LIST, DISPLAY_WARNING, SET_SCANNING_FOR_SONGS, SET_DISCOVERED_FILES, SET_PROCESSED_FILES } from './types' -import { SONG_LIST } from '../views' +import { SONG_LIST } from '../constants/views' import { isModInstalled, installEssentialMods } from './modActions' import { setView } from './viewActions' @@ -53,7 +53,13 @@ export const downloadSong = (identity) => (dispatch, getState) => { if(song) { dispatch({ type: ADD_TO_QUEUE, - payload: { ...song, utc } + payload: { + utc, + hash: song.hash, + image: `https://www.beatsaver.com${ song.coverURL }`, + title: song.metadata.songName, + author: song.metadata.songAuthorName + } }) let req = request.get({ url: `http://www.beatsaver.com${song.downloadURL}`, @@ -244,7 +250,13 @@ export const downloadSong = (identity) => (dispatch, getState) => { let utc = Date.now() dispatch({ type: ADD_TO_QUEUE, - payload: { ...song, utc } + payload: { + utc, + hash: song.hash, + image: `https://www.beatsaver.com${ song.coverURL }`, + title: song.metadata.songName, + author: song.metadata.songAuthorName + } }) let req = request.get({ url: `https://beatsaver.com/${ song.downloadURL }`, diff --git a/src/actions/songListActions.js b/src/actions/songListActions.js index dba73c7..36d409a 100644 --- a/src/actions/songListActions.js +++ b/src/actions/songListActions.js @@ -1,5 +1,5 @@ import { FETCH_NEW, FETCH_TOP_DOWNLOADS, FETCH_TOP_FINISHED, FETCH_LOCAL_SONGS, ADD_BSABER_RATING, SET_SCROLLTOP, SET_LOADING, SET_LOADING_MORE, LOAD_MORE, SET_RESOURCE, DISPLAY_WARNING } from './types' -import { SONG_LIST } from '../views' +import { SONG_LIST } from '../constants/views' import { BEATSAVER, LIBRARY } from '../constants/resources' import { hashAndWriteToMetadata } from './queueActions' import { setView } from './viewActions' diff --git a/src/actions/viewActions.js b/src/actions/viewActions.js index 1a41802..3abf745 100644 --- a/src/actions/viewActions.js +++ b/src/actions/viewActions.js @@ -3,7 +3,6 @@ import { setPlaylistEditing } from '../actions/playlistsActions' export const setView = view => dispatch => { setPlaylistEditing(false)(dispatch) - console.log(`View: ${ view }`) dispatch({ type: SET_VIEW, payload: view diff --git a/src/components/App.js b/src/components/App.js index 21c4592..0988b8f 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -21,7 +21,7 @@ import { loadDetailsFromKey } from '../actions/detailsActions' import { setView } from '../actions/viewActions' import { fetchLocalPlaylists } from '../actions/playlistsActions' -import { SONG_DETAILS, SONG_LIST, MOD_DETAILS, MODS_VIEW } from '../views' +import { SONG_DETAILS, SONG_LIST, MOD_DETAILS, MODS_VIEW } from '../constants/views' const { ipcRenderer } = window.require('electron') const fs = window.require('fs') diff --git a/src/components/CoverGrid.js b/src/components/CoverGrid.js index 967add1..d77f561 100644 --- a/src/components/CoverGrid.js +++ b/src/components/CoverGrid.js @@ -76,7 +76,7 @@ class CoverGrid extends Component { { this.setState({ bgc: `rgb(${colors[0].rgb()[0]},${colors[0].rgb()[1]},${colors[0].rgb()[2]})`, @@ -78,8 +78,9 @@ componentWillReceiveProps(props) { } componentDidMount() { + console.log( encodeURI(this.props.imageSource) ) if(!this.props.imageSource) return - getColors(this.props.imageSource.startsWith('file://') ? this.props.imageSource : `https://beatsaver.com/${ this.props.imageSource }`) + getColors(this.props.imageSource.startsWith('file://') ? this.props.imageSource.substring(7, this.props.imageSource.length) : `https://beatsaver.com/${ this.props.imageSource }`) .then(colors => { this.setState({ bgc: `rgb(${colors[0].rgb()[0]},${colors[0].rgb()[1]},${colors[0].rgb()[2]})`, diff --git a/src/components/CrashMessage.js b/src/components/CrashMessage.js index 3a64d37..465ae46 100644 --- a/src/components/CrashMessage.js +++ b/src/components/CrashMessage.js @@ -5,7 +5,7 @@ import Button from './Button' import { setHasError } from '../actions/windowActions' import { setView } from '../actions/viewActions' -import { WELCOME } from '../views' +import { WELCOME } from '../constants/views' import { store } from '../store' import { RESET_APP } from '../actions/types' diff --git a/src/components/ModDetails.js b/src/components/ModDetails.js index 82e7ac9..b7950d2 100644 --- a/src/components/ModDetails.js +++ b/src/components/ModDetails.js @@ -52,7 +52,14 @@ class ModDetails extends Component { ) } else { - if(this.props.details.notFound) return null + if(!this.props.details || this.props.details.notFound) { + return ( +
+
{ this.props.setView(this.props.previousView) } }>
+

Mod Details Not Found

+
+ ) + } return (
{ this.props.setView(this.props.previousView) } }>
@@ -94,7 +101,7 @@ class ModDetails extends Component {

) - } + } } } diff --git a/src/components/ReleaseNotesModal.js b/src/components/ReleaseNotesModal.js index ab98159..914c654 100644 --- a/src/components/ReleaseNotesModal.js +++ b/src/components/ReleaseNotesModal.js @@ -25,23 +25,13 @@ class ReleaseNotesModal extends Component {

What's new?


What's fixed?



diff --git a/src/components/SettingsView.js b/src/components/SettingsView.js index 8a88265..84b1e52 100644 --- a/src/components/SettingsView.js +++ b/src/components/SettingsView.js @@ -146,10 +146,11 @@ class SettingsView extends Component {
  • Wave Tier
  • diff --git a/src/components/SideBar.js b/src/components/SideBar.js index 62b36ab..34bedbc 100644 --- a/src/components/SideBar.js +++ b/src/components/SideBar.js @@ -12,7 +12,7 @@ import { fetchLocalPlaylists } from '../actions/playlistsActions' import { setResource } from '../actions/sourceActions' import { resizeSidebar, setSection } from '../actions/sidebarActions' -import * as VIEWS from '../views' +import * as VIEWS from '../constants/views' import * as RESOURCES from '../constants/resources' import * as SECTIONS from '../constants/sections' @@ -63,7 +63,7 @@ class SideBar extends Component {
    diff --git a/src/components/SongList.js b/src/components/SongList.js index ebf76e3..5b75806 100644 --- a/src/components/SongList.js +++ b/src/components/SongList.js @@ -91,8 +91,8 @@ class SongList extends Component { key={ makeRenderKey(songTags) } title={ song.songName || song._songName || song.metadata.songName } ratings={ song.ratings || song.stats ? song.stats.rating : '' } - artist={ song.authorName || song._songAuthorName || song.metadata.songAuthorName } - uploader={ song.uploader? song.uploader.username : '' } + artist={ song.authorName || song._songAuthorName || (song.metadata === undefined ? null : song.metadata.songAuthorName) } + uploader={ song.uploader ? song.uploader.username : '' } difficulties={ song.difficultyLevels || song.difficulties || song._difficultyBeatmapSets || ((song.metadata !== undefined) ? song.metadata.difficulties : null) } imageSource={ song.coverURL || song.coverUrl } songKey={ song.key } diff --git a/src/components/SongListItem.js b/src/components/SongListItem.js index 97778bd..d9d053b 100644 --- a/src/components/SongListItem.js +++ b/src/components/SongListItem.js @@ -12,7 +12,7 @@ import PropTypes from 'prop-types' import { loadDetailsFromFile, loadDetailsFromKey } from '../actions/detailsActions' import { setScrollTop } from '../actions/songListActions' -import { COMPACT_LIST } from '../views' +import { COMPACT_LIST } from '../constants/views' function Uploader(props) { if(!props.isDownloaded && !!props.uploader) return ( diff --git a/src/components/SortBar.js b/src/components/SortBar.js index 3c71654..3b8fc48 100644 --- a/src/components/SortBar.js +++ b/src/components/SortBar.js @@ -7,15 +7,16 @@ import Tab from './Tab'; import { setSubView } from '../actions/viewActions' -import * as VIEWS from '../views' +import * as VIEWS from '../constants/views' +import * as RESOURCES from '../constants/resources' class SortBar extends Component { render() { if(this.props.hidden) return null return (
    - { this.props.view === VIEWS.SONG_LIST && {this.props.setSubView('list')} }>List {this.props.setSubView('compact-list')} }>Compact List {this.props.setSubView('grid')} }>Grid } - { this.props.view === VIEWS.MODS_VIEW && {this.props.setSubView('list')} }>List {this.props.setSubView('tiles')} }>Tiles } + { this.props.view === VIEWS.SONG_LIST && { this.props.setSubView('list') } }>List { this.props.setSubView('compact-list') } }>Compact List { this.props.setSubView('grid') } }>Grid } + { this.props.view === VIEWS.MODS_VIEW && { this.props.setSubView('list') } }>List { this.props.setSubView('tiles') } }>Tiles }
    ) } @@ -27,7 +28,8 @@ SortBar.propTypes = { let mapStateToProps = (state) => ({ view: state.view.view, - subView: state.view.subView + subView: state.view.subView, + resource: state.resource }) export default connect(mapStateToProps, { setSubView })(SortBar) diff --git a/src/components/Tab.js b/src/components/Tab.js index 479c5c5..ebbbab7 100644 --- a/src/components/Tab.js +++ b/src/components/Tab.js @@ -3,7 +3,7 @@ import '../css/Tab.scss' class Tab extends Component { render() { - return {this.props.onClick()} }>{this.props.children} + return { if(!this.props.disabled) this.props.onClick() } }>{ this.props.children } } } diff --git a/src/components/ViewSwitcher.js b/src/components/ViewSwitcher.js index b97d242..d5be51f 100644 --- a/src/components/ViewSwitcher.js +++ b/src/components/ViewSwitcher.js @@ -13,7 +13,7 @@ import PlaylistView from './PlaylistView' import SettingsView from './SettingsView' import SongDetails from './SongDetails' import Warning from './Warning' -import * as VIEWS from '../views' +import * as VIEWS from '../constants/views' import PlaylistDetails from './PlaylistDetails' import DonateView from './DonateView' import ModsView from './ModsView' diff --git a/src/constants.zip b/src/constants.zip deleted file mode 100644 index 62ebe77..0000000 Binary files a/src/constants.zip and /dev/null differ diff --git a/src/views.js b/src/constants/views.js similarity index 100% rename from src/views.js rename to src/constants/views.js diff --git a/src/css/Tab.scss b/src/css/Tab.scss index aa4046f..3535cf1 100644 --- a/src/css/Tab.scss +++ b/src/css/Tab.scss @@ -15,9 +15,16 @@ text-decoration-color: $beatdrop-blue; opacity: 1; } + + &.disabled { + opacity: 0.25; + cursor: not-allowed; + font-weight: 400; + } } .theme-hc .tab.active { color: $theme-hc-accent-color; text-decoration-color: $theme-hc-accent-color; -} \ No newline at end of file +} + diff --git a/src/reducers/queueReducer.js b/src/reducers/queueReducer.js index f71a62a..268cdfa 100644 --- a/src/reducers/queueReducer.js +++ b/src/reducers/queueReducer.js @@ -21,9 +21,9 @@ export default function(state = initialState, action) { { utc: action.payload.utc, hash: action.payload.hash, - image: `www.beatsaver.com${action.payload.coverURL}`, - title: action.payload.name, - artist: action.payload.uploader.username, + image: action.payload.image, + title: action.payload.title, + author: action.payload.author, progress: 0 }, ...items diff --git a/src/reducers/viewReducer.js b/src/reducers/viewReducer.js index f9a489a..60a90e0 100644 --- a/src/reducers/viewReducer.js +++ b/src/reducers/viewReducer.js @@ -1,5 +1,5 @@ import { SET_VIEW, SET_SUB_VIEW } from '../actions/types' -import { WELCOME, SONG_LIST } from '../views' +import { WELCOME, SONG_LIST } from '../constants/views' const initialState = { previousView: SONG_LIST,