Added rate limiting and server security

Ton of little visual style tweaks and little up improvements for mobile
This commit is contained in:
Max G
2020-03-26 04:45:23 +00:00
parent 749d2cea94
commit ecbf6a9cde
17 changed files with 283 additions and 148 deletions

View File

@@ -512,7 +512,7 @@ Note.solrQuery = (userId, searchQuery, searchTags) => {
} else {
//Number of characters before and after search word
const front = 5
const front = 20
const tail = 150
db.promise()
@@ -584,7 +584,7 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
let searchParams = [userId]
let noteSearchQuery = `
SELECT note.id,
SUBSTRING(note_raw_text.text, 1, 1500) as text,
SUBSTRING(note_raw_text.text, 1, 500) as text,
note_raw_text.title as title,
note_raw_text.updated as updated,
opened,
@@ -722,15 +722,10 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
if(note.encrypted == 1){ note.text = '' }
//Deduce note title
const textData = ProcessText.deduceNoteTitle(note.text)
const textData = ProcessText.deduceNoteTitle(note.title, note.text)
// console.log(textData)
// console.log(textData)
if(note.title == null){
note.title = ''
}
note.title = textData.title
note.subtext = textData.sub
note.titleLength = textData.titleLength
note.subtextLength = textData.subtextLength

View File

@@ -5,6 +5,10 @@ let Tag = module.exports = {}
Tag.userTags = (userId, searchQuery, searchTags, fastFilters) => {
return new Promise((resolve, reject) => {
if(searchQuery && searchQuery.length > 0){
return resolve([])
}
let query = `
SELECT
tag.id,
@@ -12,7 +16,7 @@ Tag.userTags = (userId, searchQuery, searchTags, fastFilters) => {
COUNT(note_tag.note_id) as usages
FROM tag
JOIN note_tag ON tag.id = note_tag.tag_id
JOIN note On note.id = note_tag.note_id
JOIN note ON note.id = note_tag.note_id
WHERE note_tag.user_id = ?
`