diff --git a/app/capabilities.js b/app/capabilities.js index 4a686107..ab2e0ff0 100644 --- a/app/capabilities.js +++ b/app/capabilities.js @@ -62,9 +62,15 @@ export default async function capabilities() { const crypto = await checkCrypto(); const nativeStreams = checkStreams(); const polyStreams = nativeStreams ? false : polyfillStreams(); + let account = false; + try { + account = !!localStorage; + } catch (e) { + // nevermind + } return { - account: typeof localStorage !== 'undefined', + account, crypto, streamUpload: nativeStreams || polyStreams, streamDownload: diff --git a/app/templates/expireInfo/index.js b/app/templates/expireInfo/index.js index c9df258d..08e96a55 100644 --- a/app/templates/expireInfo/index.js +++ b/app/templates/expireInfo/index.js @@ -17,11 +17,15 @@ module.exports = function(state, emit) { return el; } + const counts = [1, 2, 3, 4, 5, 20, 50, 100, 200].filter( + i => state.capabilities.account || i <= state.user.maxDownloads + ); + const dlCountSelect = el.querySelector('#dlCount'); el.replaceChild( selectbox( state.downloadCount || 1, - [1, 2, 3, 4, 5, 20, 50, 100, 200], + counts, num => state.translate('downloadCount', { num }), value => { const max = state.user.maxDownloads; @@ -36,11 +40,15 @@ module.exports = function(state, emit) { dlCountSelect ); + const expires = [300, 3600, 86400, 604800].filter( + i => state.capabilities.account || i <= state.user.maxExpireSeconds + ); + const timeSelect = el.querySelector('#timespan'); el.replaceChild( selectbox( state.timeLimit || 86400, - [300, 3600, 86400, 604800], + expires, num => timeLimitText(state.translate, num), value => { const max = state.user.maxExpireSeconds;