Commit Graph

56 Commits

Author SHA1 Message Date
a 77d85278a2 adjust path 2022-02-21 03:53:13 +00:00
a 5b93b66792 more converts 2022-02-21 03:32:53 +00:00
Azareal dbc6fdb27c try to log panics better
fix LogNewLongRoute
2021-05-05 17:24:16 +10:00
Azareal aa02f9fc48 Add Count()
Add Createf()
Fix inqbuild2() loop.
2021-04-27 20:24:04 +10:00
Azareal c60118e7c4 WIP forum action code. Currently disabled.
Add Http Conn Count tracking.
Move more panel phrases into the panel namespace.
Use a string builder in hookgen.
Use Countf() in a couple of places to eliminate boilerplate.
Reduce prepared stmt boilerplate in forum store with a lambda.
Reduce prepared stmt boilerplate in topic.go with a lambda.
Reduce prepared stmt boilerplate in group.go with a lambda.
Add TestSetCreatedAt method to *Topic.
Add DateOlderThanQ method to *accDeleteBuilder and *accUpdateBuilder.
Add Stmt method to *accUpdateBuilder and *AccSelectBuilder.
Add AccBuilder interface.
Shorten variable names.
Shorten extractPerm name to ep.
Add avatar_visibility setting stub. Implementation coming in a later commit.
Don't set an IP for installer generated posts.

Add counters_perf_tick_row hook.

Add avatar_visibility phrase.
Add avatar_visibility_label phrase.
Rename forums_no_description to forums_no_desc.
Rename panel.forums_create_description_label to panel.forums_create_desc_label.
Rename panel.forums_create_description to panel.forums_create_desc.
Rename panel_forum_description to panel.forum_desc.
Rename panel_forum_description_placeholder to panel.forum_desc_placeholder.
Add panel_debug_http_conns_label phrase.
Add panel.forum_actions_head phrase.
Add panel.forum_actions_create_head phrase.
Add panel.forum_action_run_on_topic_creation phrase.
Add panel.forum_action_run_days_after_topic_creation phrase.
Add panel.forum_action_run_days_after_topic_last_reply phrase.
Add panel.forum_action_action phrase.
Add panel.forum_action_action_delete phrase.
Add panel.forum_action_action_lock phrase.
Add panel.forum_action_action_unlock phrase.
Add panel.forum_action_action_move phrase.
Add panel.forum_action_extra phrase.
Add panel.forum_action_create_button phrase.

You will need to run the patcher / updater for this commit.
2021-04-08 00:23:11 +10:00
Azareal 14b098bac2 Add DisableStdout config setting.
Add DisableStderr config setting.
Eliminate boilerplate in main.go
Increase the number of cached q strings.
Use the ErrLogger in LogError() and LogWarning()
Add the experimental LocalErrorf()
Add Err() log function.
2021-04-07 12:10:05 +10:00
Azareal 300defd460 Add TopicListIntTest interface.
Use inqbuild2 in DefaultTopicList.Tick.
Avoid doing a full paginator calculation in the topic list when the result is obvious.
Add defaultPagi and setForumList methods to DefaultTopicList.
Cache two more items in qcache.
Use a string builder in inqbuild and inqbuildstr.
Add the inqbuild2 function.
Reduce boilerplate in topic.go
2021-03-24 22:07:46 +10:00
Azareal 8decc0c1a8 add flif, heif, heic, bpg and opus to allowed file extensions
add flac web audio extension
eliminate aloocs with inqbuild and inqbuildstr
2021-02-19 13:28:20 +10:00
Azareal fb426bda4b add avif, flac, ac3, aac, f4v, xvid, mov, movie, qt, xpi, docx and pdf file extensions 2020-10-21 14:31:33 +10:00
Azareal 86f2b96ba0 flv file extension
delete lesbian spammy domain bit
2020-10-21 07:31:51 +10:00
Azareal fbed07a8b4 add m4a file extension 2020-08-12 18:24:41 +10:00
Azareal 4606a49886 add tgz file extension 2020-07-31 15:58:17 +10:00
Azareal a8702b617f initial AText 2020-06-08 17:04:47 +10:00
Azareal 6746c9c91b add audio player
add wav, oga, ogv, ogx file extensions
2020-05-05 18:10:19 +10:00
Azareal 365b84c81b allow uploads for apng and ogg.
add missing var
2020-05-01 07:32:34 +10:00
Azareal ade8f82af7 add python and go user agents.
add new bot class for python, go and curl to reduce resource usage.
don't push canonicals for loggedin users
try to avoid pushing google site verify when it isn't necessary
give ahrefs the semrush treatment
2020-03-22 14:37:45 +10:00
Azareal 6a7b8fd3ee map msnbot to bing and avoid bytes for ahrefs too 2020-03-19 07:21:06 +10:00
Azareal 8d19048c0d reduce bytes used on semrush 2020-03-14 12:09:18 +10:00
Azareal 7d2be466b3 optimise ua tracking
reduce number of bytes used when we don't know the lang
add more spammy domain strings
2020-03-08 14:15:27 +10:00
Azareal f3bdfffbed avoid allocs for guest alert etags
use phrase file modtime instead of instance start time for routeAPIPhrases to avoid cache churn
2020-03-07 12:59:06 +10:00
Azareal 6935637867 Cascade delete attachments properly.
Cascade delete replied to topic events for replies properly.
Cascade delete likes on topic posts properly.
Cascade delete replies and their children properly.
Recalculate user stats properly when items are deleted.
Users can now unlike topic opening posts.
Add a recalculator to fix abnormalities across upgrades.
Try fixing a last_ip daily update bug.

Add Existable interface.
Add Delete method to LikeStore.
Add Each, Exists, Create, CountUser, CountMegaUser and CountBigUser methods to ReplyStore.
Add CountUser, CountMegaUser, CountBigUser methods to TopicStore.
Add Each method to UserStore.
Add Add, Delete and DeleteResource methods to SubscriptionStore.
Add Delete, DeleteByParams, DeleteByParamsExtra and AidsByParamsExtra methods to ActivityStream.
Add Exists method to ProfileReplyStore.

Add DropColumn, RenameColumn and ChangeColumn to the database adapters.

Shorten ipaddress column names to ip.
- topics table.
- replies table
- users_replies table.
- polls_votes table.
Add extra column to activity_stream table.
Fix an issue upgrading sites to MariaDB 10.3 from older versions of Gosora. Please report any other issues you find.

You need to run the updater / patcher for this commit.
2020-01-31 17:22:08 +10:00
Azareal bffb095b57 Add zipx, kgb, pea, xz and zz archive formats. 2019-11-01 09:34:50 +10:00
Azareal f227aadb6d Allow users to upload small archives.
Fix the ordering of functions in topic.Delete.
2019-11-01 09:17:26 +10:00
Azareal e9cf06a5f2 More jpeg file extensions. 2019-10-30 18:16:19 +10:00
Azareal 01d956f9d1 Encode tiffs too.
Update file extension lists.
Update mod floater.
2019-10-30 13:52:04 +10:00
Azareal 9e8b95b1be Add jfif as an image file extension.
Add jpeg as jpgs for post attachments.

Move some things.
2019-10-30 12:59:34 +10:00
Azareal c57f176939 Yet more spammy domain bits. 2019-05-19 13:21:09 +10:00
Azareal 213cfd04f4 Don't forget this x.x 2019-05-19 13:15:00 +10:00
Azareal 423c790f39 Add more spammy domain bits. 2019-05-19 13:14:02 +10:00
Azareal bf0adeb8c6 Move SpammyDomainBits into common.go
Fix the little UI issues from adding the adjacent select in the referrer pane.
Add a few more spammy domain bits.
2019-05-18 11:18:19 +10:00
Azareal 0bb46c9d67 Use #container instead of .container for Cosora.
Added six parser tests.
2019-04-08 17:50:41 +10:00
Azareal 0dd4db4d03 0.2.0 tag, checkpoint release.
Added the Log function.
Added the Logf function.
Added the Author method to *Topic.
Added the action_end_edit_reply hook.
Added the action_end_delete_reply hook.
2019-04-08 17:44:41 +10:00
Azareal 2296008655 Basic search now works for the Search & Filter Widget. ElasticSearch has been temporarily delayed, so I can push through this update.
Added the three month time range to the analytics panes.
Began work on adding new graphs to the analytics panes.
Began work on the ElasticSearch adapter for the search system.
Added the currently limited AddKey method to the database adapters.
Expanded upon the column parsing logic in the database adapters to ease the use of InsertSelects.

Added the BulkGet method to TopicCache.
Added the BulkGetMap method to TopicStore.
TopicStore methods should now properly retrieve lastReplyBy.
Added the panel_analytics_script template to de-dupe part of the analytics logic. We plan to tidy this up further, but for now, it'll suffice.
Added plugin_sendmail and plugin_hyperdrive to the continuous integration test list.
Tweaked the width and heights of the textareas for the Widget Editor.
Added the AddKey method to *qgen.builder
Fixed a bug where using the inline forum editor would crash Gosora and wouldn't set the preset permissions for that forum properly.
Added DotBot to the user agent analytics.
Invisibles should be better handled when they're encountered now in user agent strings.
Unknown language ISO Codes in headers now have the requests fully logged for debugging purposes.
Shortened some of the pointer receiver names.
Shortened some variable names.

Added the dotbot phrase.
Added the panel_statistics_time_range_three_months phrase.

Added gopkg.in/olivere/elastic.v6 as a dependency.

You will need to run the patcher or updater for this commit.
2019-02-23 16:29:19 +10:00
Azareal 8f2f47e8aa Added the In-Progress Widget Manager UI.
Added the IsoCode field to phrase files.
Rewrote a good portion of the widget system logic.
Added some tests for the widget system.
Added the Online Users widget.
Added a few sealed incomplete widgets like the Search & Filter Widget.
Added the AllUsers method to WsHubImpl for Online Users. Please don't abuse it.

Added the optional *DBTableKey field to AddColumn.
Added the panel_analytics_time_range template to reduce the amount of duplication.
Failed registrations now show up in red in the registration logs for Nox.
Failed logins now show up in red in the login logs for Nox.
Added basic h2 CSS to the other themes.
Added .show_on_block_edit and .hide_on_block_edit to the other themes.
Updated contributing.
Updated a bunch of dates to 2019.
Replaced tblKey{} with nil where possible.
Switched out some &s for &s to reduce the number of possible bugs.
Fixed a bug with selector messages where the inspector would get really jittery due to unnecessary DOM updates.
Moved header.Zone and associated fields to the bottom of ViewTopic to reduce the chances of problems arising.
Added the ZoneData field to *Header.
Added IDs to the items in the forum list template.
Split the fetchPhrases function into the initPhrases and fetchPhrases functions in init.js
Added .colstack_sub_head.
Fixed the CSS in the menu list.
Removed an inline style from the simple topic like and unlike buttons.
Removed an inline style from the simple topic IP button.
Simplified the LoginRequired error handler.
Fixed a typo in the comment prior to DatabaseError()
Reduce the number of false leaves for WebSocket page transitions.
Added the error zone.
De-duped the logic in WsHubImpl.getUsers.
Fixed a potential widget security issue.

Added twenty new phrases.
Added the wid column to the widgets table.

You will need to run the patcher / updater for this commit.
2019-01-21 22:27:59 +10:00
Azareal 3465e4c08f You can now manage the attachments for an opening post by hitting edit.
The update system now uses the database as the source of truth for the last version rather than lastSchema.json
Refactored several structs and bits of code, so we can avoid allocations for contexts where we never use a relative time.
Clicking on the relative times on the topic list and the forum page should now take you to the post on the last page rather than just the last page.
Added the reltime template function.
Fixed some obsolete bits of code.
Fixed some spelling mistakes.
Fixed a bug where MaxBytesReader was capped at the maxFileSize rather than r.ContentLength.
All of the client side templates should work again now.
Shortened some statement names to save some horizontal space.
accUpdateBuilder and SimpleUpdate now use updatePrebuilder behind the scenes to simplify things.
Renamed selectItem to builder in AccSelectBuilder.
Added a Total() method to accCountBuilder to reduce the amount of boilerplate used for row count queries.
The "_builder" strings have been replaced with empty strings to help save memory, to make things slightly faster and to open the door to removing the query name in many contexts down the line.
Added the open_edit and close_edit client hooks.
Removed many query name checks.
Split the attachment logic into separate functions and de-duplicated it between replies and topics.
Improved the UI for editing topics in Nox.
Used type aliases to reduce the amount of boilerplate in tables.go and patches.go
Reduced the amount of boilerplate in the action post logic.
Eliminated a map and a slice in the topic page for users who haven't given any likes. E.g. Guests.
Fixed some long out-dated parts of the update instructions.
Updated the update instructions to remove mention of the obsolete lastSchema.json
Fixed a bug in init.js where /api/me was being loaded for guests.
Added the MiniTopicGet, GlobalCount and CountInTopic methods to AttachmentStore.
Added the MiniAttachment struct.
Split the mod floaters out into their own template to reduce duplication.
Removed a couple of redundant ParseForms.

Added the common.skipUntilIfExistsOrLine function.
Added the NotFoundJS and NotFoundJSQ functions.
Added the lastReplyID and attachCount columns to the topics table.
2018-12-27 15:42:41 +10:00
Azareal bf851bd9fc We now use Go 1.11 modules. This should help with build times, deployment and development, although it does mean that the minimum requirement for Gosora has been bumped up from Go 1.10 to Go 1.11
Added support for dyntmpl to the template system.
The Account Dashboard now sort of uses dyntmpl, more work needed here.
Renamed the pre_render_view_topic hook to pre_render_topic.
Added the GetCurrentLangPack() function.
Added the alerts_no_new_alerts phrase.
Added the account_level_list phrase.

Refactored the route rename logic in the patcher to cut down on the amount of boilerplate.
Added more route renames to the patcher. You will need to run the patcher / updater in this commit.
2018-10-27 13:40:36 +10:00
Azareal 6634f3f64b All the control panel routes have been moved to /routes/panel/ now.
Moved the software version to common.go for better accessibility.
2018-10-02 15:03:20 +10:00
Azareal 8f7cda9378 Don't double-compress avatars.
Gzip is now disabled for static files when the gains don't justify the costs.
Moved StopServerChan and StoppedServer to package common.
Added some disabled profiling code.
2018-08-22 11:32:07 +10:00
Azareal f2ecb9dbf7 apng is no longer a valid image format as we don't have the technology to optimise it.
Experimenting with systemd.

Began work on an experimental hook table implementation.
Tweaked some hook implementations to make their behaviour less ambiguous.
2018-08-07 14:14:28 +10:00
Azareal 01a692ab5b Added the word filter store and moved the word filter routes into the route package.
Added tests for the word filter store.
Added qgen.NewAcc() to reduce the amount of boilerplate needed for creating an accumulator.
Exposed the RecordError method on the accumulator.
Added an Add method to PluginList and removed AddPlugin() in favour of that.

More panel buttons on Nox should be styled now.
Added the panel_update_button_text phrase for future use.

More errors might be caught in the thumbnailer now.
Removed ls from .travis.yml, it was there for debugging Code Climate.
2018-08-04 21:46:36 +10:00
Azareal 0a628f7201 PNG and JPG avatars are now encoded as JPG images leading to a dramatic drop in the amount of bandwidth used.
Did some work on image thumbnailing, but our dependencies are acting up delaying this from being released.

Fixed the positions of the topic list bits for Nox on mobile.
Removed APNG as an accepted image format, as we don't currently have a good way of optimising these images.
Added a comment regarding the constant time compare for sessions.
Added a warning about putting Gosora in www folders.
Noavatars can now take a width parameters.
Added a bit of missing validation for the avatar uploader.
Refactored the multiple file detector for the avatar uploader.

Added a Run method to accDeleteBuilder.
Added an EachInt method to AccSelectBuilder.
Added a Run method to accInsertBuilder.

Added the users_avatar_queue table, you will need to run the patcher / update script.
You might also want to update the Noavatar field in your config.json file with the new one.
2018-07-28 22:52:23 +10:00
Azareal d0907134ef Database connection drops are handled better now. 2018-07-15 20:29:31 +10:00
Azareal f8f46b3c48 Added support for two-factor authentication.
Added the Account Dashboard and merged a few account views into it.
BREAKING CHANGE: We now use config/config.json instead of config/config.go, be sure to setup one of these files, you can config_default.json as an example of what a config.json should look like. If you don't have an existing installation, you can just rely on the installer to do this for you.

CSS Changes (does not include Nox Theme):
Sidebar should no longer show up in the account manager in some odd situations or themes.
Made a few CSS rules more generic.
Forms have a new look in Cosora now.

Config Changes:
Removed the DefaultRoute config field.
Added the DefaultPath config field.
Added the MaxRequestSizeStr config field to make it easier for users to input custom max request sizes without having to use a calculator or figure out how many bytes there are in a megabyte.
Removed the CacheTopicUser config field.
Added the UserCache config field.
Added the TopicCache config field

Phrases:
Removed ten english phrases.
Added 21 english phrases.
Changed eleven english phrases.
Removed some duplicate indices in the english phrase pack.

Removed some old benchmark code.
Tweaked some things to make the linter happy.
Added comments for all the MemoryUserCache and MemoryTopicCache methods.
Added a comment for the null caches, consult the other caches for further information on the methods.
Added a client-side check to make sure the user doesn't upload too much data in a single post. The server already did this, but it might be a while before feedback arrives from it.
Simplified a lot of the control panel route code with the buildBasePage function.
Renamed /user/edit/critical/ to /user/edit/password/
Renamed /user/edit/critical/submit/ to /user/edit/password/submit/
Made some small improvements to SEO with a couple of meta tags.
Renamed some of the control panel templates so that they use _ instead of -.
Fixed a bug where notices were being moved to the wrong place in some areas in Cosora.
Added the writeJsonError function to help abstract writing json errors.
Moved routePanelUsers to panel.Users
Moved routePanelUsersEdit to panel.UsersEdit
Moved routePanelUsersEditSubmit to panel.UsersEditSubmit
Renamed routes.AccountEditCritical to routes.AccountEditPassword
Renamed routes.AccountEditCriticalSubmit to routes.AccountEditPasswordSubmit
Removed the routes.AccountEditAvatar and routes.AccountEditUsername routes.
Fixed a data race in MemoryTopicCache.Add which could lead to the capacity limit being bypassed.
Tweaked MemoryTopicCache.AddUnsafe under the assumption that it's not going to be safe anyway, but we might as-well try in case this call is properly synchronised.
Fixed a data race in MemoryTopicCache.Remove which could lead to the length counter being decremented twice.
Tweaked the behaviour of MemoryTopicCache.RemoveUnsafe to mirror that of Remove.
Fixed a data race in MemoryUserCache.Add which could lead to the capacity limit being bypassed.
User can no longer change their usernames to blank.

Made a lot of progress on the Nox theme.
Added modified FA5 SVGs as a dependency for Nox.
Be sure to run the patcher or update script and don't forget to create a customised config/config.json file.
2018-06-17 17:28:18 +10:00
Azareal f85bf51103 Added a couple of simple anti-spam measures.
Made progress with an internal error logging component for the Control Panel.
Made LogWarning less susceptible to races and slightly improved log contention.
Revamped the registration page on Cosora.
Added the SanitiseSingleLine and SanitiseBody functions to better centralise sanitisation and to ensure more consistent sanitisation.
Zero length spaces are no longer permitted in usernames to help prevent impersonation. More to come in this area.
Plugins / internal components can now schedule hourly tasks.
Reduced the chances of newlines breaking the visual layout in areas which expect none.

Added the register_account_anti_spam phrase.
2018-05-31 16:51:31 +10:00
Azareal 23a686fe96 UNSTABLE: Began work on the Nox Theme.
Removed the Tempra Cursive Theme.
You can now do bulk moderation actions with Shadow.

Added:
Argon2 as a dependency.
The EmailStore.
The ReportStore.
The Copy method to *Setting.
The AddColumn method to the query builder and adapters.
The textarea setting type.
More logging to better debug issues.
The GetOffset method to the UserStore.

Removed:
Sortable from Code Climate's Analysis.
MemberCheck and memberCheck as they're obsolete now.
The obsolete url_tags setting.
The BcryptGeneratePasswordNoSalt function.
Some redundant fields from some of the page structs.

Revamped:
The Control Panel Setting List and Editor.

Refactored:
The password hashing logic to make it more amenable to multiple hashing algorithms.
The email portion of the Account Manager.
The Control Panel User List.
The report system.
simplePanelUserCheck and simpleUserCheck to remove the duplicated logic as the two do the exact same thing.

Fixed:
Missing slugs in the profile links in the User Manager.
A few template initialisers potentially reducing the number of odd template edge cases.
Some problems with the footer.
Custom selection colour not applying to images on Shadow.
The avatars of the bottom row of the topic list on Conflux leaking out.

Other:
Moved the startTime variable into package common and exported it.
Moved the password hashing logic from user.go to auth.go
Split common/themes.go into common/theme.go and common/theme_list.go
Replaced the SettingLabels phrase category with the more generic SettingPhrases category.
Moved a load of routes, including panel ones into the routes and panel packages.
Hid the notifications link from the Account Menu.
Moved more inline CSS into the CSS files and made things a little more flexible here and there.
Continued work on PgSQL, still a ways away.
Guests now have a default avatar like everyone else.
Tweaked some of the font sizes on Cosora to make the text look a little nicer.
Partially implemented the theme dock override logic.
Partially implemented a "symlink" like feature for theme directories.
... And a bunch of other things I might have missed.

You will need to run this update script / patcher for this commit.
Warning: This is an "unstable commit", therefore some things may be a little less stable than I'd like. For instance, the Shadow Theme is a little broken in this commit.
2018-05-27 19:36:35 +10:00
Azareal ba98b0c952 Added the registration logs.
Tweaked the h1 CSS for the Control Panel in Cosora.
Improved the support for autocompleters.
Reverted some of the int64s back to ints.
The per-request user variable should now have the IPs for guests.
Removed some obsolete statements.
Removed a couple obsolete phrases.
Moved a couple more accumulator initializers out of the store initializers.
Refactored one of the report statements to use a store instead of a statement.
Created the menuhead CSS class.
Added the GetOffset method to the LogStore interface and refactored the mod and admin log pages to use it.
Changed the labels on the adminlog and modlog pages to make them more understandable.
Removed the generated templates from Git.

Run the patcher / update script to get the new table.
2018-05-16 20:46:14 +10:00
Azareal 9075798128 Alerts are now rendered via a client side transpiled template rather than being hard-coded.
Tweaked some bits to make them more 32-bit friendly for GopherJS, but this might not be necessary now.
Added notice.html
Added an alerts package to fix the import cycles, more things may be moved here soon.
Saved a few lines of accumulator code in a few stores.
Moved the AccountEditCriticalSubmit, AccountEditAvatar, AccountEditAvatarSubmit, AccountEditUsername, and AccountEditUsernameSubmit routes into the routes package.
Added a QueryRow method to AccSelectBuilder.
Tweaked the indentation in the generated templates.
Simplified the template render in the AccountEditUsernameSubmit route into a redirect back to the previous page.

Run the update script / patcher to replace the route names in the viewchunks table.
2018-05-14 18:56:56 +10:00
Azareal 60964868d4 Moved the counters to their own package.
De-duped some of the logging code.
Added per-route state to the not found errors.
Exported debugDetail, debugDetailf, debugLog, and debugLogf.
Tweaked the padding on Tempra Simple.
Added panel submenus to Tempra Conflux.
Added Chart CSS to Tempra Conflux.
Fixed the padding and margins for the Control Panel in Cosora.
Made Cosora's Control Panel a little more tablet friendly.
Added the rowmsg CSS class to better style message rows.
Removed the repetitive guard code for the pre-render hooks.
Removed the repetitive guard code for the string-string hooks.
We now capture views for routes.StaticFile
Added the move action to the moderation logs.

Added the viewchunks_forums table.
Began work on Per-forum Views.
I probably missed a few things in this changelog.
2018-02-19 04:26:01 +00:00
Azareal 2455e951aa We now have analytics for the operating systems used by users.
Route view bumping logs have been moved from regular debug mode to super debug to reduce the amount of noise.
Added user friendly agent names.
Reduced the amount of logging outside of debug mode.
We now track Mobile Safari and the Samsung Browser.
We now track SeznamBot, TwitterBot, and Discourse's Bot.
We now track Trident.
UAs are now filtered to reduce the amount of bad activity.
Added more bad phrases for bad routes.

Added the viewchunks_systems table.
Began work on referrer tracking.
2018-02-04 08:15:20 +00:00
Azareal a25ee29197 We now track global user agent stats and have a currently simple Control Panel interface for that.
Fixed a possible out of bounds panic in DefaultRouteViewCounter.Bump()
2018-01-09 07:39:29 +00:00