Commit Graph

2303 Commits (deba3e27521ccbbae5ed9d5e1568d1d822a8714a)

Author SHA1 Message Date
Julian Lam e1ed514b10 feat: topics dashboard details subpage
Julian Lam cc93822436 feat: show list of recent users in dashboard/users
Julian Lam 6fdcae7320 feat: req.query parsing and dynamically loading data instead
Julian Lam f561799f74 refactor: abstract out some client side dashboard code into modules, analytics subpages for users, topics, and logins
Julian Lam 16d3c45782 feat: report login statistics from analytics data, instead of its own zset
Julian Lam 9a9f366d3b feat: track login sessions for admin dashboard reporting
Julian Lam 020f0b8322 fix: session not persisting to database in some scenarios
In some edge cases (e.g. SSO plugin redirecting the user immediately), with modern browsers, the request is never "completed" for speed. This causes a condition where the session object never persists to the database, even though it has changed. This added line forces a db persist on a successful login.

Context: https://github.com/expressjs/session/pull/484
Julian Lam 504fd107c7 feat: track successful logins in analytics
Julian Lam 955021247e feat(user): icon background selector in change picture modal
Julian Lam 2fef462782 fix: awaiting res.render in send404 controller
>
> A plugin wanted to use `response:rotuer.page` to 404 a specific page on some condition. res.render returns early in send404 and so must be awaited otherwise multiple responses will be sent
Barış Soner Uşaklı 9ce6f8ad93 feat: add tag filter to getSortedTopics
Julian Lam 7223074f1d feat: ability to re-order topic thumbnails
Julian Lam 3e6640efb2 refactor: thumbs.associate accepts both relative path and url in path arg
Julian Lam 36f2021186 refactor: move post queue retrival code to posts.getQueuedPosts
Julian Lam cc275e1016 Revert "feat: newsletter opt-in/out in UCP, closes #21"
This reverts commit 3c7cd9a6c4.
Julian Lam 3c7cd9a6c4 feat: newsletter opt-in/out in UCP, closes
Barış Soner Uşaklı b6493f896f fix: tests, only generate csrf_token on 404 gets
Barış Soner Uşaklı 94f72d6093 fix: , generate csrf_token on 404
Peter Jaszkowiak cc9d6fd08b chore: eslint max-len
Peter Jaszkowiak 23f212a4c0 chore: eslint prefer-destructuring
Peter Jaszkowiak 8d1462ffd8 chore: eslint object-curly-newline
Peter Jaszkowiak 62869bae3d chore: eslint function-paren-newline
Peter Jaszkowiak dab3b23575 chore: eslint no-var, vars-on-top
Peter Jaszkowiak b56d9e12b5 chore: eslint prefer-arrow-callback
Peter Jaszkowiak 707b55b6a5 chore: eslint prefer-template
Peter Jaszkowiak 4ee0f1459d chore: eslint import/newline-after-import
Barış Soner Uşaklı a4878a5b22 fix: markread selector
Barış Soner Uşaklı 47299ea587
Categories refactor ()
* feat: wip categories pagination

* feat: add subCategoriesPerPage setting

* feat: add load more sub categories button to category page

* fix: openapi spec

* feat: show sub categories left on category page

hide button when no more categories left

* breaking: rename categories to allCategories on /search

categories contains the search results

* fix: spec

* refactor: remove cidsPerPage

* fix: tests

* feat: use component for subcategories

* fix: prevent negative subCategoriesLeft

* feat: new category filter/search WIP

* feat: remove categories from /tag

* fix: dont load all categories when showing move modal

* feat: allow adding custom categories to list

* breaking: dont load entire category tree on post queue

removed unused code
add hooks to filter/selector
add options to filter/selector

* feat: make selector modal work again

* feat: replace old search module

* fix: topic move selector

* feat: dont load all categories on create category modal

* fix: fix more categorySelectors

* feat: dont load entire category tree on group details page

* feat: dont load all categories on home page and user settings page

* feat: add pagination to /user/:userslug/categories

* fix: update schemas

* fix: more tests

* fix: test

* feat: flags page, dont return entire category tree

* fix: flag test

* feat: categories manage page

dont load all categories
allow changing root category
clear caches properly

* fix: spec

* feat: admins&mods page

dont load all categories

* fix: spec

* fix: dont load all children when opening dropdown

* fix: on search results dont return all children

* refactor: pass all options, rename options.cids to options.selectedCids

* fix: 

* fix: index 0

* fix: spec

* feat: , add setObjectBulk

* refactor: shoter updateOrder

* feat: selectors on categories/category

* fix: tests and search filter

* fix: category update test

* feat: pagination on acp categories page

show order in set order modal

* fix: allow drag&drop on pages > 1 in /admin/manage/categories

* fix: teasers for deep nested categories

fix sub category display on /category page

* fix: spec

* refactor: use eslint-disable-next-line

* refactor: shorter
Julian Lam 4f97639009 feat: new hook `action:login.continue`
Julian Lam 67e3fb6498 fix: register returnTo logic to match login route
Login route saves the previous page by checking for the X-Return-To header. This header is automatically set by ajaxify.
Login takes this value and saves it to `req.session`.

Up until now, `/register` saved the previous URL in a hidden input, and redirected based on that value, but it occasionally conflicted with req.session.returnTo. It was also confusing because it did not match how login handled the values.

This commit updates the route handling so it works identically to `/login`.
gasoved 970bd06fd2 refactor: improvements
gasoved 53e0d4d2e0 feat: banned-users group
gasoved 7c9674de6c fix: include admins
gasoved a2a7557cc0 refactor: update dom after diff deletion better
gasoved eb642f40b9 feat: , ability to delete a post's diffs
Barış Soner Uşaklı fffdc4e0ca feat: , add pagination to /api/recent/posts/:term?
Barış Soner Uşaklı d1364c3130
Categories refactor ()
* feat: wip categories pagination

* feat: add subCategoriesPerPage setting

* feat: add load more sub categories button to category page

* fix: openapi spec

* feat: show sub categories left on category page

hide button when no more categories left

* breaking: rename categories to allCategories on /search

categories contains the search results

* fix: spec

* refactor: remove cidsPerPage

* fix: tests

* feat: use component for subcategories

* fix: prevent negative subCategoriesLeft
Julian Lam 05c53394f3 fix: tests
Julian Lam 7419922040 fix: improper override of req.body.username in login logic
Julian Lam b820d23401 feat: new hook `filter:login.override`, deprecate `action:auth.overrideLogin`
Barış Soner Uşaklı 34c42c6fa3 feat: ability to search categories,
Julian Lam 84dfdfe659 chore: remove deprecated v2 style responses for thumbs upload route [breaking]
Julian Lam 2ad0d0d0d8 chore: remove deprecated getObject routes [breaking]
`/api/post/pid/:pid`, `/api/topic/tid/:tid`, `/api/category/cid/:cid` have now been removed in favour of routes in the Write API (`/api/v3/(posts|topics|categories)/:id`)
Julian Lam dc84559d0b feat(topic-events): topic events GET route in write API
Julian Lam 8b72479f62 fix: remove 'filters' and 'categories' from flag details API return [breaking]
These options were originally used when the flag filters were shown in the sidebar. This has seen been removed, and so the information is now superfluous
Julian Lam 942d924779 fix: error on flag list if no flag filters were saved in session
Julian Lam 35c92d0cff fix: mod cid filter accidentally saved in session
Julian Lam 27cae0d5d8 fix: missing return for
Julian Lam b2b1450e5d fix: , render 400 error page on bad access to /register
Barış Soner Uşaklı 672959c13f feat: add group name to csv event
Julian Lam a186ea0fe3 fix: registration completion overriding returnTo if it was already set
Julian Lam 280285cda9 feat: allow interstitial callbacks to be async functions [breaking]
This change is breaking in the sense that if you have written
interstitial callbacks before that are async functions _with_ a
callback, those are no longer allowed. You will not need to call
next() as that argument will no longer be passed in to async
functions.
Julian Lam 966c4117ec refactor(api): post move to write API
Julian Lam e118e59ce0 refactor(api): post diffs to use write API
Julian Lam f5fcd232f6 fix: regression caused by 77ab46686d
Access checks were added for topic GET route, but occasionally a post_uuid is passed in, which is available to everyone, and so checks should be skipped
Julian Lam 77ab46686d fix: access checks for tags and thumbs get route
Julian Lam b742229e59 fix: , re-adding v2-style behaviour so as to not break the API... yet
Manuel Valle e14b67786c
Solve Custom home page route error bug ()
When you select Custom Route as home you get a 404 error "/custom not found" error.
This because 'homePageRoute' property was used instead of 'homePageCustom'
Julian Lam 97d678fd2a fix: return a user object, not an array of user objects (in v3 login check route)
Julian Lam 8c86f5bcec fix: bad execution flow in utilities.login
Julian Lam 8bbb320867 feat: handle HTTP 429 as a response code
Julian Lam 56f929ed4f feat: add write API route for checking login credentials
Julian Lam 1cf0032d9f feat: allow override of local fns in login controller, 400 instead of 500 for wrong login type [breaking]
Barış Soner Uşaklı 6cbb77afda fix: add missing breadcrumb on /user/<slug>/categories
Julian Lam edb8da1ef9 feat(api): closes category and topic routes migrated to Write API
Julian Lam 9ecfac9b68 feat(api): , migrate rest of the getObject controllers to Write API
Julian Lam cdff8d286a chore(api): add deprecation notices re:
Julian Lam e267f29584 feat(api): , migrate /api/post/pid/:pid to Write API
Barış Soner Uşaklı c1ecfd1ebf feat: , don't try to reconnect forever
Julian Lam d27815a8c0 fix: , incorrect client-side `disableChatMessageEditing` value for admins/gmods
Julian Lam 223f0a5515 feat(acp): admin tags privilege
Julian Lam fb46a8d975 feat(acp): admins-mods privilege
Julian Lam da191341e8 feat(acp): added new admin privilege for groups management
Julian Lam 32e36f7b2e feat(api): group ownership API route, switch client-side to use API route
Julian Lam 1cd2689cf6 refactor(api): deprecated groups update socket in favour of API lib
Julian Lam 438fa5c88f fix: send fewer items to client-side for ACP settings/email page
Barış Soner Uşaklı 4404e32ed9 fix: , lower query before search
Barış Soner Uşaklı 8f938eba19 fix: , fix svg uploads
Julian Lam ab98740821 fix: topic thumbs in OG image tags
Barış Soner Uşaklı 80de572aa1 feat: add user.email.confirmByUid for sso plugins
Julian Lam bd5c4a5cff fix: tests
Julian Lam 3e54b70c06 fix: , Topic thumbnails do not work with third-party uploaders
Julian Lam a30c8ab5c8 feat: clent-side modal for managing topic thumbs
closes 
Julian Lam 67cf5e83b7 fix: changes to thumb resizing logic
- Resized thumb no longer skews aspect ratio
- Thumbs resized down to maximum thumb size by WIDTH only
- image.checkDimensions() now returns dimensions
Julian Lam c043cfebd6 fix: added back missing topic thumb tests that were removed in last commit
Julian Lam 340387c18a fix: , non-standard API response from addThumbs route
Also removed old thumb upload router handler, and updated uploadPost handling in composer to match new response schema
Julian Lam 5950683316 feat: closes , tests for topic thumbs routes, write API schema
Julian Lam 4152aa552e feat: tests for topic thumbs
Also added some error checking to addThumbs controller
Julian Lam ef7d6db912 feat: server-side work for
- rename Thumbs.commit to Thumbs.migrate
- new PUT method that calls Thumbs.migrate
- `checkThumbPrivileges` now takes a single object parameter (ins. of req/res)
Julian Lam b5d910f53b feat: core work for , thumb deletion now accepts uuids
+ common data validation for thumb addition and deletion
Julian Lam 90497e3ef5 feat: more work on topic thumbs refactor
- addThumb and deleteThumb are now protected routes (duh)
- new getThumbs route GET /api/v3/topics/<tid>/thumbs
- Updated `assert.path` middleware to better handle if relative paths are received with upload_url
- Slight refactor of thumbs lib to use validator to differentiate between tid and UUID
Julian Lam 708b1c338f fix:
Julian Lam 7e9e08f718 feat: server-side routes for handling multiple topic thumbnails
closes , requires 'topic-thumb-refactor' branch of composer-default
Julian Lam 98cd9e3549 feat: allow uploadThumb controller to be called in code
it, and uploadsController.upload() now return the results of their operation
Julian Lam efa4eca0fe fix: , no post usage info if '/files/' path received
Barış Soner Uşaklı d2888d1d1f
Category tags ()
* feat: wip category tags

* fix: tag search

* feat: remove debug

* fix: returns of searchTags and autocomplete

* fix: alpha sort

* fix: redis

* fix: delete zsets on category purge, fix another test

* fix: test
Barış Soner Uşaklı 648f6215ef fix: redirect external with absolute urls
Barış Soner Uşaklı 458bfc0faf fix: external path for subfolder installs
Barış Soner Uşaklı 64ac483ddd fix:
Barış Soner Uşaklı 5d00b0895b fix: sso redirect on /login & /api/login
Barış Soner Uşaklı 6f68f4d20a fix: , fix login redirect for sso plugins
Barış Soner Uşaklı 5f0f476b57 feat: , use timestamp in profile/cover images
delete current one if keepAllUserImages is turned off
fix typo in data
Barış Soner Uşaklı 954dc5b7be feat: , update pin tooltip in topic
Barış Soner Uşaklı 1eb5fabdb1 feat: , postQueue setting for category
Barış Soner Uşaklı 202dcef42e fix: , show rest of info even if clusterMonitor priv is not granted
Julian Lam acb576662e fix(spec): from 6e6a7a8f8a
Barış Soner Uşaklı 6e6a7a8f8a fix: , export csv to file
Julian Lam 007a3258a0 feat: add handler for 501 api response
Barış Soner Uşaklı bf171adc83 fix:
Julian Lam 1e7cf1cbc4 fix: , disallow flags of privileged users (mods, gmods, admins)
Barış Soner Uşaklı b8cafefce2 fix: winston usages
Julian Lam 906d7d734b refactor: move API banned response handler to separate internal method
Julian Lam afb26bfe48 feat: show ban reason and expiry in write api responses, if user is banned
Julian Lam 6e5ec3f895 feat: automatically unban users in onSuccessfulLogin
This allows write API (and probably SSO login) to go through unimpeded if a user's ban has expired. Closes 
Barış Soner Uşaklı 77f0bff54f fix: , fix popular, top rss feed urls
Barış Soner Uşaklı b18e7e319b fix: spec
Barış Soner Uşaklı 3f337b5d7c feat: ,
Barış Soner Uşaklı 5fa098326f fix: https://github.com/NodeBB/NodeBB/pull/8685
fix category link redirect on cold load
fix helpers.redirect if passed in url is external
fix ajaxify so it doesn't slice first character of external url
Barış Soner Uşaklı 9ee1fb490e fix: https://github.com/NodeBB/NodeBB/pull/8759
Barış Soner Uşaklı 672d4da078 feat: human readable uptime
Julian Lam 6e2da9966e refactor: move plugin hook methods to plugin.hooks.*
Julian Lam 046d0b1637
feat: allow pins to expire (if set) ()
* fix: add back topic assert middleware for pin route

* feat: server-side handling of pin expiries

* refactor: togglePin to not require uid parameter [breaking]

* feat: automatic unpinning if pin has expiration set

* feat: client-side modal for setting pin expiration

* refactor: categories.getPinnedTids to accept multiple cids

... in preparation for pin expiry logic, direct access to *:pinned zsets is discouraged

* fix: remove references to since-removed jobs file for topics

* feat: expire pins when getPinnedTids is called

* refactor: make the togglePin change non-breaking

The 'action:topic.pin' hook now sends uid again, as before. However, if it is a system action (that is, a pin that expired), 'system' will be sent in instead of a valid uid
Barış Soner Uşaklı 8d060065a0 fix: spec
Barış Soner Uşaklı e9585b9be2 fix: group userTitles translation escapes
Julian Lam a0b7a82350
feat(api): account deletion routes for the Write API ()
* feat(api): account deletion routes for the Write API

* refactor: rewrite client-side calls to account deletion to use api

* style: apply DRY
Barış Soner Uşaklı 120999bf63 feat: , show message if post is queued when js is disabled
Barış Soner Uşaklı 35f932cd64 feat: , add oldCategory if topic is moved
Barış Soner Uşaklı 1d6bcbebde feat: https://github.com/NodeBB/NodeBB/issues/8147
Julian Lam e1d7c4d8aa fix: internal helper method hasGlobalPrivilege, DRY
gasoved 3ccebf112e
feat: invites regardless of registration type, invite privilege, groups to join on acceptance ()
* feat: allow invites in normal registration mode + invite privilege

* feat: select groups to join from an invite

* test: check if groups from invitations have been joined

* fix: remove unused variable

* feat: write API versions of socket calls

* docs: openapi specs for the new routes

* test: iron out mongo redis difference

* refactor: move inviteGroups endpoint into write API

* refactor: use GET /api/v3/users/:uid/invites/groups

Instead of GET /api/v3/users/:uid/inviteGroups

* fix: no need for /api/v3 prefix when using api module

* fix: tests

* refactor: change POST /api/v3/users/invite

To POST /api/v3/users/:uid/invites

* refactor: make helpers.invite awaitable

* fix: restrict invite API to self-use only

* fix: move invite groups controller to write api, +tests

* fix: tests

Co-authored-by: Julian Lam <julian@nodebb.org>
Barış Soner Uşaklı e4d2764d4c fix: , remove header/footer cache
Barış Soner Uşaklı 5598130a92 refactor: async/await controllers/index.js
Barış Soner Uşaklı f14e42d8bc fix:
Barış Soner Uşaklı 51b7eca119 fix: run every hour, dont show message if average_time is 0
Opliko 04f4429f72
Resolve - optional timer for registration queue ()
* feat:  Optional timer for registration queue

* feat: show minutes in average time

* fix: don't show total number of minutes

* feat: implement requested changes

* fix: just store minutes instead of milliseconds

* feat: set default values
Barış Soner Uşaklı 567c5f2056 fix: , dont escape category title,description twice
Julian Lam f300c933a5 refactor: move session revocation route to write api
Barış Soner Uşaklı 2e44639210 fix: guest header/footer cache
allow clearing individual caches
Barış Soner Uşaklı f1f9b225b0
feat: , cache refactor ()
* feat: , cache refactor

ability to disable caches
ability to download contents of cache
refactor cache modules to remove duplicated code

* fix: remove duplicate hit/miss tracking

check cacheEnabled in getUncachedKeys
Julian Lam d263192271 feat: group exists API call in write api
Julian Lam 1446cec77f feat: user exist route in write api
Julian Lam 6b196a207f fix: permanent redirect on user api redirect shorthand
Julian Lam 60e1e99b4f feat: new shorthand route /api/v3/users/bySlug/:userslug
closes 
Julian Lam 512f6de6de
feat: allow passwords with length > 73 characters ()
* feat: allow passwords longer than 73 characters

Context: A bcrypt/blowfish limitation means that password length is capped at 72 characters. We can get around this without compromising on security
by hashing all incoming passwords with SHA512, and then sending that to bcrypt.

https://dropbox.tech/security/how-dropbox-securely-stores-your-passwords

* feat: add additional test for passwords > 73 chars

* fix: remove 'password-too-long' error message and all invocations

* test: added test to show that a super long password won't bring down NodeBB

* fix: remove debug log

* Revert "fix: remove 'password-too-long' error message and all invocations"

This reverts commit 1e312bf7ef7e119fa0f1bd3517d756ca013d5e79.

* fix: added back password length checks, but at 512 chars

As processing a large string still uses a lot of memory
Barış Soner Uşaklı c61dee4b62 fix: , don't crash if /compose route is called with no query params
Barış Soner Uşaklı 9e3eb5d41a feat: , allow guest topic views
Julian Lam 891a1ea2af fix: , do not require admin:users privilege to ban users
Julian Lam c0f699e655 fix: disallow registration attempts with password length > 4096
This is a stopgap measure for v1.15.0
Barış Soner Uşaklı 6e85920cb6 feat: allow mods/admins to see deleted posts on user profile
Julian Lam 266d7587b2 refactor: remove usage of middlewares
Specifically, middleware.isAdmin|exposePrivilegeSet|exposePrivileges