Fixed search not working for guests in public mode

This commit is contained in:
NGPixel 2017-04-16 12:30:19 -04:00
parent 642bcac472
commit d02b4a3591
3 changed files with 67 additions and 67 deletions

View File

@ -16,8 +16,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- **Configuration Wizard**: Git version detection no longer fails on MacOS - **Configuration Wizard**: Git version detection no longer fails on MacOS
- **Init**: Malformed config file is now being reported correctly - **Init**: Malformed config file is now being reported correctly
- **UI**: Scrollbar is no longer always shown in code blocks - **Init**: Git remote is now always updated to current settings
- **Misc**: CJK (Chinese, Japanese & Korean) characters are now fully supported for pages, content and uploads - **Misc**: CJK (Chinese, Japanese & Korean) characters are now fully supported for pages, content and uploads
- **UI**: Scrollbar is no longer always shown in code blocks
- **Search**: Search is now working for guest users when public mode is enabled
## [v1.0.0-beta.10] - 2017-04-08 ## [v1.0.0-beta.10] - 2017-04-08
### Added ### Added

View File

@ -5,93 +5,93 @@
const _ = require('lodash') const _ = require('lodash')
module.exports = (socket) => { module.exports = (socket) => {
if (!socket.request.user.logged_in) {
return
}
// ----------------------------------------- // -----------------------------------------
// SEARCH // SEARCH
// ----------------------------------------- // -----------------------------------------
socket.on('search', (data, cb) => { if (appconfig.public || socket.request.user.logged_in) {
cb = cb || _.noop socket.on('search', (data, cb) => {
search.find(data.terms).then((results) => { cb = cb || _.noop
return cb(results) || true search.find(data.terms).then((results) => {
return cb(results) || true
})
}) })
}) }
// ----------------------------------------- // -----------------------------------------
// UPLOADS // UPLOADS
// ----------------------------------------- // -----------------------------------------
socket.on('uploadsGetFolders', (data, cb) => { if (socket.request.user.logged_in) {
cb = cb || _.noop socket.on('uploadsGetFolders', (data, cb) => {
upl.getUploadsFolders().then((f) => { cb = cb || _.noop
return cb(f) || true upl.getUploadsFolders().then((f) => {
return cb(f) || true
})
}) })
})
socket.on('uploadsCreateFolder', (data, cb) => { socket.on('uploadsCreateFolder', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.createUploadsFolder(data.foldername).then((f) => { upl.createUploadsFolder(data.foldername).then((f) => {
return cb(f) || true return cb(f) || true
})
}) })
})
socket.on('uploadsGetImages', (data, cb) => { socket.on('uploadsGetImages', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.getUploadsFiles('image', data.folder).then((f) => { upl.getUploadsFiles('image', data.folder).then((f) => {
return cb(f) || true return cb(f) || true
})
}) })
})
socket.on('uploadsGetFiles', (data, cb) => { socket.on('uploadsGetFiles', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.getUploadsFiles('binary', data.folder).then((f) => { upl.getUploadsFiles('binary', data.folder).then((f) => {
return cb(f) || true return cb(f) || true
})
}) })
})
socket.on('uploadsDeleteFile', (data, cb) => { socket.on('uploadsDeleteFile', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.deleteUploadsFile(data.uid).then((f) => { upl.deleteUploadsFile(data.uid).then((f) => {
return cb(f) || true return cb(f) || true
})
}) })
})
socket.on('uploadsFetchFileFromURL', (data, cb) => { socket.on('uploadsFetchFileFromURL', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.downloadFromUrl(data.folder, data.fetchUrl).then((f) => { upl.downloadFromUrl(data.folder, data.fetchUrl).then((f) => {
return cb({ ok: true }) || true return cb({ ok: true }) || true
}).catch((err) => { }).catch((err) => {
return cb({ return cb({
ok: false, ok: false,
msg: err.message msg: err.message
}) || true }) || true
})
}) })
})
socket.on('uploadsRenameFile', (data, cb) => { socket.on('uploadsRenameFile', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.moveUploadsFile(data.uid, data.folder, data.filename).then((f) => { upl.moveUploadsFile(data.uid, data.folder, data.filename).then((f) => {
return cb({ ok: true }) || true return cb({ ok: true }) || true
}).catch((err) => { }).catch((err) => {
return cb({ return cb({
ok: false, ok: false,
msg: err.message msg: err.message
}) || true }) || true
})
}) })
})
socket.on('uploadsMoveFile', (data, cb) => { socket.on('uploadsMoveFile', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.moveUploadsFile(data.uid, data.folder).then((f) => { upl.moveUploadsFile(data.uid, data.folder).then((f) => {
return cb({ ok: true }) || true return cb({ ok: true }) || true
}).catch((err) => { }).catch((err) => {
return cb({ return cb({
ok: false, ok: false,
msg: err.message msg: err.message
}) || true }) || true
})
}) })
}) }
} }

View File

@ -18,8 +18,6 @@ html
link(rel='manifest', href='/manifest.json') link(rel='manifest', href='/manifest.json')
// JS / CSS // JS / CSS
//script(type='text/javascript').
script(type='text/javascript', src='/js/bundle.min.js') script(type='text/javascript', src='/js/bundle.min.js')
block head block head