Gosora is an ultra-fast and secure forum software written in Go that balances usability with functionality.
Go to file
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
.vscode Refactored the code to follow best standards better. 2017-09-03 05:50:31 +01:00
attachs Added Quick Topic. 2017-10-05 11:20:28 +01:00
backups You can now search for whatever IP you want in the IP Searcher. 2017-09-23 20:57:13 +01:00
common Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
config Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
docs Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
experimental UNSTABLE: Began work on the Nox Theme. 2018-05-27 19:36:35 +10:00
extend Added the Page Manager for faster and easier custom page creation. 2018-06-06 10:21:22 +10:00
images More work on Cosora, we have a screenshot of it up now, although it's super experimental at the moment. 2017-10-30 09:57:08 +00:00
install Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
langs Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
logs You can now disable slugs. 2018-04-03 05:34:07 +01:00
migrations Added the AboutSegment feature, you can see this in use on Cosora, it's a little raw right now, but I'm planning to polish it in the next commit. 2017-11-23 05:37:08 +00:00
old-images Removed the images for Cosmo from /images/, it's very saddening to see it go :( 2017-09-22 03:21:17 +01:00
pages Made some minor tweaks. 2017-12-22 03:32:23 +00:00
patcher Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
public Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
query_gen Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
router_gen Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
routes Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
schema Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
templates Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
themes Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
tmpl_client Solve the chicken and the egg problem with the templates. 2018-05-16 21:44:32 +10:00
updater Let's use proper Git for updates for now as Go Git refuses to work properly. 2018-04-04 12:25:34 +01:00
uploads Added the profile system. 2016-12-07 09:34:09 +00:00
.codebeatignore Updated the codebeat and codeclimate config files. 2018-01-21 11:17:43 +00:00
.codeclimate.yml UNSTABLE: Began work on the Nox Theme. 2018-05-27 19:36:35 +10:00
.eslintrc.json Mostly a mid-way technical commit to make reading diffs easier on me. 2017-10-14 08:39:22 +01:00
.gitignore Added the menu manager and menu item editor. 2018-05-11 15:41:51 +10:00
.htaccess Happy 100th commit! For the 100th commit, I've revamped a good portion of the user interface, and we don't plan on stopping! There's more to come! 2017-05-29 15:52:37 +01:00
.travis.yml Solve the chicken and the egg problem with the templates. 2018-05-16 21:44:32 +10:00
CONTRIBUTING.md You can now change someone's group again. 2018-05-28 16:27:12 +10:00
LICENSE Adding the files. 2016-12-02 07:38:54 +00:00
README.md Added some missing commands from the scripts for Linux. 2018-06-06 14:33:47 +10:00
TODO.md Added a custom auto-link parser rather than using a regex. 2017-03-07 07:22:29 +00:00
build-linux I forgot this is Linux not Windows, this should do it. 2018-06-06 14:42:57 +10:00
build-linux-nowebsockets I forgot this is Linux not Windows, this should do it. 2018-06-06 14:42:57 +10:00
build-nowebsockets.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
build.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
build_templates.bat Fixed a bug where it would use the wrong templates for Tempra Simple, Tempra Cursive, and Shadow 2018-03-31 06:25:27 +01:00
database.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
dev-update-linux Added some missing commands from the scripts for Linux. 2018-06-06 14:33:47 +10:00
dev-update-travis The patcher (schema updating part of the updater) finally works, yay. 2018-04-23 22:08:31 +01:00
dev-update.bat Added some missing commands from the scripts for Linux. 2018-06-06 14:33:47 +10:00
gen_mssql.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
gen_mysql.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
gen_pgsql.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
gen_router.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
gen_tables.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
general_test.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
install-linux UNSTABLE: Began work on the Nox Theme. 2018-05-27 19:36:35 +10:00
install.bat UNSTABLE: Began work on the Nox Theme. 2018-05-27 19:36:35 +10:00
last_version.txt Revamped the top navbar. 2017-05-12 14:25:12 +01:00
main.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
misc_test.go Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
mssql.go Added the Page Manager for faster and easier custom page creation. 2018-06-06 10:21:22 +10:00
mysql.go Added the Page Manager for faster and easier custom page creation. 2018-06-06 10:21:22 +10:00
panel_routes.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
pgsql.go Fixed a bug where it would use the wrong templates for Tempra Simple, Tempra Cursive, and Shadow 2018-03-31 06:25:27 +01:00
plugin_adventure.go Added more phrases for the notices. 2018-03-21 05:56:33 +00:00
plugin_bbcode.go Added support for two-factor authentication. 2018-06-17 17:28:18 +10:00
plugin_guilds.go Updated the codebeat and codeclimate config files. 2018-01-21 11:17:43 +00:00
plugin_heythere.go Fixed the Go Version in the Travis file. 2018-04-22 13:33:56 +01:00
plugin_markdown.go You can now disable slugs. 2018-04-03 05:34:07 +01:00
plugin_skeleton.go Finished moving the files into the subpackage, this should open more doors to us. 2017-11-11 04:06:16 +00:00
plugin_test.go Did a bit of refactoring on the template system. 2017-11-06 16:24:45 +00:00
rev_templates.go Moved the create statement into the TopicStore. 2017-11-07 22:38:15 +00:00
router.go Moved the counters to their own package. 2018-02-19 04:26:01 +00:00
routes.go Commented out more debug code. 2018-05-15 15:59:52 +10:00
run-linux I forgot this is Linux not Windows, this should do it. 2018-06-06 14:42:57 +10:00
run-linux-nowebsockets I forgot this is Linux not Windows, this should do it. 2018-06-06 14:42:57 +10:00
run-linux-tests Hmmm, maybe this? 2017-10-31 00:53:00 +00:00
run-nowebsockets.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
run.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
run_mssql.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
run_tests.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
run_tests_mssql.bat Build artifacts are now cleaned up on Windows too. 2018-06-06 16:13:55 +10:00
tmpl_stub.go Solve the chicken and the egg problem with the templates. 2018-05-16 21:44:32 +10:00
update-deps-linux UNSTABLE: Began work on the Nox Theme. 2018-05-27 19:36:35 +10:00
update-deps.bat UNSTABLE: Began work on the Nox Theme. 2018-05-27 19:36:35 +10:00

README.md

Gosora Azareal's Discord Chat

A super fast forum software written in Go. You can talk to us on our Discord chat!

The initial code-base was forked from one of my side projects, but has now gone far beyond that. We're still fairly early in development, so the code-base might change at an incredible rate. We plan to stop making as many breaking changes once we release the first alpha.

If you like this software, please give it a star and give us some feedback :)

If you dislike it, please give us some feedback on how to make it better! We're always looking for feedback. We love hearing your opinions. If there's something missing or something doesn't look quite right, don't worry! We plan to change many things before the alpha!

Features

Standard Forum Functionality. All of the little things you would expect of any forum software. E.g. Common Moderation features, modlogs, theme system, avatars, bbcode parser, markdown parser, report system, per-forum permissions, group permissions and so on.

Custom Pages. Under development. The Control Panel portion is incomplete, but you can create them by hand today. They're basically html/templates templates in the /pages/ folder.

Emojis. Allow your users to express themselves without resorting to serving tons upon tons of image files.

In-memory static file, forum and group caches. We have a slightly more dynamic cache for users and topics.

A profile system, including profile comments and moderation tools for the profile owner.

A template engine which compiles templates down to machine code. Over thirty times faster than html/templates, although it does remove some of the hand holding to achieve this. Compatible with templates written for html/templates, you don't need to learn any new templating language.

A plugin system. More on this to come.

A responsive design. Looks great on mobile phones, tablets, laptops, desktops and more!

Other modern features like alerts, likes, advanced dashboard with live stats (CPU, RAM, online user count, and so on), etc.

Dependencies

Go 1.10 - You will need to install this. Pick the .msi, if you want everything sorted out for you rather than having to go around updating the environment settings. https://golang.org/doc/install

MySQL Database - You will need to setup a MySQL Database somewhere. A MariaDB Database works equally well and is much faster than MySQL. You could use something like WNMP / XAMPP which have a little PHP script called PhpMyAdmin for managing MySQL databases or you could install MariaDB directly.

Download the .msi installer from MariaDB and run that. You may want to set it up as a service to avoid running it every-time the computer starts up.

Instructions on how to set MariaDB up on Linux: https://downloads.mariadb.org/mariadb/repositories/

We recommend changing the root password (that is the password for the user 'root'). Remember that password, you will need it for the installation process. Of course, we would advise using a user other than root for maximum security, although that adds additional steps to the process of getting everything setup.

It's entirely possible that your host might already have MySQL, so you might be able to skip this step, particularly if it's a managed VPS or a shared host (contrary to popular belief, it is possible, although the ecosystem in this regard is extremely immature). Or they might have a quicker and easier method of setting up MySQL.

Downloading

At some point, we'll have releases which you can download, but right now, you'll have to use the git clone command as mentioned down in the advanced setup section to download a copy of Gosora.

On Windows, you might also want to try the GosoraBootstrapper, if you can't find the command prompt. It's just a matter of double-clicking on the bat file there and it'll download the rest of the files for you.

Installation Instructions

Linux

cd to the directory / folder the code is in. In other words, type cd followed by the location of the code and it should jump there.

Run ./install-linux

Follow the instructions shown on the screen.

Windows

Run install.bat, e.g. double-click on it. You will also have to start-up MySQL, which if you're using Wnmp or friends is just a matter of opening that program and starting the MySQL process via it.

Follow the instructions shown on the screen.

Run the program

Linux

In the same directory you installed it, you simply have to type: ./run-linux

Windows

Run run.bat, e.g. double-clicking on it.

Updating Dependencies

You can update the dependencies which Gosora relies on by running update-deps.bat on Windows or ./update-deps-linux on Linux. These dependencies do not include Go or MySQL, those have to be updated separately.

We're also looking into ways to distribute ready made executables for Windows. While this is not a complicated endeavour, the configuration settings currently get built with the rest of the program for speed, and we will likely have to change this.

With the introduction of the new settings system, we will begin moving some of the less critical settings out of the configuration file, and will likely have a config.xml or config.ini in the future to store the critical settings in.

You'll need to restart the server every-time you change a template, e.g. with run.bat or ./run-linux

Several important features for saving memory in the templates system may have to be implemented before the new compiled template system is rolled out to every route. These features are coming fairly soon, but not before the higher priority items.

Advanced Installation

This section explains how to set things up without running the batch or shell files. For Windows, you will likely have to open up cmd.exe (the app called Command Prompt in Win10) to run these commands inside or something similar, while with Linux you would likely use the Terminal or console.

Linux is similar, however you might need to use cd and mv a bit more like in the shell files due to the differences in go build across platforms. Additionally, Linux doesn't require StackExchange/wmi or /x/sys/windows

You also need to substitute the gosora.exe bits for ./Gosora on Linux. For more info, you might want to take a gander inside the ./run-linux and ./install-linux shell files to see how they're implemented.

If you want to skip typing all the go gets, you can run ./update-deps.bat (Windows) or ./update-deps-linux to do that for you.

git clone https://github.com/Azareal/Gosora

go get -u github.com/go-sql-driver/mysql

go get -u golang.org/x/crypto/bcrypt

go get -u golang.org/x/crypto/argon2

go get -u github.com/StackExchange/wmi

go get -u github.com/Azareal/gopsutil

go get -u github.com/gorilla/websocket

go get -u gopkg.in/sourcemap.v1

go get -u github.com/robertkrimen/otto

go get -u github.com/lib/pq

go get -u github.com/denisenkom/go-mssqldb

go get -u github.com/fsnotify/fsnotify

rm -f template_*.go

rm -f gen_*.go

rm -f tmpl_client/template_*.go

rm -f ./Gosora

go generate

go build ./router_gen

router_gen.exe

go build ./query_gen

query_gen.exe

go build -o gosora.exe

go build ./install

install.exe

gosora.exe -build-templates

gosora.exe

I'm looking into minimising the number of go gets for the advanced build and to maybe remove the platform and database engine specific dependencies if possible for those who don't need them.

Updating

The update system is currently under development, however if you have Git installed, then you can run dev-update.bat or dev-update-linux to update your instance to the latest commit and to update the associated database schema, etc.

In addition to this, you can update the dependencies without updating Gosora by running update-deps.bat or ./update-deps-linux (.bat is for Windows, the other for Linux as the names would suggest).

If you want to manually patch Gosora rather than relying on the above scripts to do it, you'll first have to create a copy of ./schema/schema.json named ./schema/lastSchema.json, and then, you'll overwrite the files with the new ones.

After that, you'll need to run go build ./patcher on Windows or the following code block on Linux:

cd ./patcher
go build -o Patcher
mv ./Patcher ..

Once you've done that, you just need to run patcher.exe (Windows) or ./Patcher to apply the latest patches to the database, etc.

How do I install plugins?

For the default plugins like Markdown and Helloworld, you can find them in the Plugin Manager of your Control Panel. For ones which aren't included by default, you will need to drag them from your /extend/ directory and into the / directory (the root directory of your Gosora installation, where the executable and most of the main Go files are).

You will then need to recompile Gosora in order to link the plugin code with Gosora's code. For plugins not written in Gosora (e.g. JavaScript), you do not need to move them from the /extend/ directory, they will automatically show up in your Control Panel ready to be installed.

Experimental plugins aka the ones in the /experimental/ folder (e.g. plugin_sendmail) are similar but different. You will have to move native plugins (ones written in Go) to the root directory of your installation and will have to move experimental plugins written in other languages into the /extend/ directory.

We're looking for ways to clean-up the plugin system so that all of them (except the experimental ones) are housed in /extend/, however we've encountered some problems with Go's packaging system. We plan to fix this issue in the future.

Images

Shadow Theme

Shadow Quick Topic

Tempra Simple Theme

Tempra Simple Topic List

Tempra Simple Mobile

Tempra Conflux Theme

Tempra Conflux Mobile

Cosora Prototype WIP

More images in the /images/ folder. Beware though, some of them are really outdated.

Dependencies (a few of these like Rez aren't currently in use, but we anticipate that we'll need some sort of search engine library in the very immediate future)

  • Go 1.10+

  • MariaDB (or any other MySQL compatible database engine). We'll allow other database engines in the future.

  • github.com/go-sql-driver/mysql For interfacing with MariaDB.

  • golang.org/x/crypto/bcrypt and go get -u golang.org/x/crypto/argon2 For hashing passwords.

  • github.com/Azareal/gopsutil For pulling information on CPU and memory usage. I've temporarily forked this, as we were having stability issues with the latest build.

    • github.com/StackExchange/wmi Dependency for gopsutil on Windows.

    • golang.org/x/sys/windows Also a dependency for gopsutil on Windows. This isn't needed at the moment, as I've rolled things back to an older more stable build.

  • github.com/gorilla/websocket Needed for Gosora's Optional WebSockets Module.

  • github.com/robertkrimen/otto Needed for the upcoming JS plugin type.

    • gopkg.in/sourcemap.v1 Dependency for Otto.
  • github.com/lib/pq For interfacing with PostgreSQL. You will be able to pick this instead of MariaDB soon.

  • ithub.com/denisenkom/go-mssqldb For interfacing with MSSQL. You will be able to pick this instead of MSSQL soon.

  • github.com/bamiaux/rez An image resizer (e.g. for spitting out thumbnails)

  • github.com/fsnotify/fsnotify A library for watching events on the file system.

  • More items to come here, our dependencies are going through a lot of changes, and I'll be documenting those soon ;)

Bundled Plugins

There are several plugins which are bundled with the software by default. These cover various common tasks which aren't common enough to clutter the core with or which have competing implementation methods (E.g. plugin_markdown vs plugin_bbcode for post mark-up).

  • Hey There / Skeleton / Hey There (JS Version) - Example plugins for helping you learn how to develop plugins.

  • BBCode - A plugin in early development for converting BBCode Tags into HTML.

  • Markdown - An extremely simple plugin for converting Markdown into HTML.

  • Social Groups - An extremely unstable WIP plugin which lets users create their own little discussion areas which they can administrate / moderate on their own.

Developers

There are a few things you'll need to know before running the more developer oriented features like the tests or the benchmarks.

The benchmarks are currently being rewritten as they're currently extremely serial which can lead to severe slow-downs when run on a home computer due to the benchmarks being run on the one core everything else is being run on (Browser, OS, etc.) and the tests not taking parallelism into account.