diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-02 14:35:20 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-02 14:35:20 +0200 |
| commit | e443b704c5f45b5e9cfdec762f837a0981cffe97 (patch) | |
| tree | d454426b86385b6fa2546e9b6bcb91bc5a734bef | |
| parent | 9f607ce3c0bf12bc8cada8ba7048355de51f6dd6 (diff) | |
handle flac. optionally disable mongodb session store
| -rw-r--r-- | bucky/app/site.js | 16 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/audio.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/files.js | 4 | ||||
| -rw-r--r-- | public/assets/js/vendor/util.js | 41 |
4 files changed, 33 insertions, 30 deletions
diff --git a/bucky/app/site.js b/bucky/app/site.js index e8e8cbc..c447991 100644 --- a/bucky/app/site.js +++ b/bucky/app/site.js @@ -32,7 +32,7 @@ site.init = function(){ app.use(favicon(__dirname + '../../../public/favicon.ico')) app.use(bodyParser.json({limit: '50mb'})) app.use(cookieParser()) - app.use(session({ + var sessionSettings = { secret: 'argonauts', proxy: true, key: 'bucky.sid', @@ -41,7 +41,11 @@ site.init = function(){ domain: '.' + process.env.HOST_NAME, maxAge: 43200000000, }, - store: new MongoStore({ + resave: true, + saveUninitialized: false, + } + if (!process.env.SESSIONS_IN_MEMORY) { + sessionSettings.store = new MongoStore({ url: 'mongodb://localhost/buckySessionDb' // type: 'mongodb', // host: 'localhost', @@ -49,11 +53,9 @@ site.init = function(){ // dbName: 'buckySessionDb', // collectionName: 'sessions', // timeout: 10000, - }), - resave: true, - saveUninitialized: false, - })) - + }) + } + app.use(session(sessionSettings)) upload.init() // federate.route(app) diff --git a/public/assets/js/lib/views/details/audio.js b/public/assets/js/lib/views/details/audio.js index 3fa0b70..b03fa81 100644 --- a/public/assets/js/lib/views/details/audio.js +++ b/public/assets/js/lib/views/details/audio.js @@ -17,7 +17,7 @@ var audio = (function(){ music = [] var links = document.querySelectorAll("a") Array.prototype.slice.apply(links).forEach(function(link){ - if (! link.href.match(/\.(mp3|wav|ogg|opus)$/)) return + if (! link.href.match(/\.(mp3|wav|ogg|opus|flac)$/)) return link.dataset.index = music.length music.push(link) if (playing && link.href === el.src) { diff --git a/public/assets/js/lib/views/details/files.js b/public/assets/js/lib/views/details/files.js index cdefc1f..3cfd1c9 100644 --- a/public/assets/js/lib/views/details/files.js +++ b/public/assets/js/lib/views/details/files.js @@ -26,7 +26,7 @@ var FilesView = FormView.extend({ // return } total += file.size - has_music = has_music || file.filename.match(/(mp3|wav|ogg|opus)$/i) + has_music = has_music || file.filename.match(/(mp3|wav|ogg|opus|flac)$/i) }.bind(this)) this.total = total @@ -175,7 +175,7 @@ var FilesView = FormView.extend({ pick: function(e){ if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return - if (! e.target.href || ! e.target.href.match(/(mp3|wav|ogg|opus)$/i)) return + if (! e.target.href || ! e.target.href.match(/(mp3|wav|ogg|opus|flac)$/i)) return e.preventDefault() audio.play( e.target.dataset.index ) // index set in audio.js }, diff --git a/public/assets/js/vendor/util.js b/public/assets/js/vendor/util.js index 43ca81b..7244d5a 100644 --- a/public/assets/js/vendor/util.js +++ b/public/assets/js/vendor/util.js @@ -140,26 +140,6 @@ function range(m,n,s){ return a } -// manipulate text selection in an element -function setSelectionRange(input, selectionStart, selectionEnd) { - if (input.setSelectionRange) { - input.focus(); - input.setSelectionRange(selectionStart, selectionEnd); - } - else if (input.createTextRange) { - var range = input.createTextRange(); - range.collapse(true); - range.moveEnd('character', selectionEnd); - range.moveStart('character', selectionStart); - range.select(); - } -} - -// place cursor at a specific point (usually the beginning) -function setCaretToPos (input, pos) { - setSelectionRange(input, pos, pos); -} - var guid_syllables = "iz az ez or iv ex baz el lo lum ot un no".split(" ") var guid_n = 0 function guid(n){ @@ -314,3 +294,24 @@ function selectElementContents(el) { textRange.select(); } } + +// manipulate text selection in an element +function setSelectionRange(input, selectionStart, selectionEnd) { + if (input.setSelectionRange) { + input.focus(); + input.setSelectionRange(selectionStart, selectionEnd); + } + else if (input.createTextRange) { + var range = input.createTextRange(); + range.collapse(true); + range.moveEnd('character', selectionEnd); + range.moveStart('character', selectionStart); + range.select(); + } +} + +// place cursor at a specific point (usually the beginning) +function setCaretToPos (input, pos) { + setSelectionRange(input, pos, pos); +} + |
