Commit Graph

114 Commits

Author SHA1 Message Date
Useroth
906f3dd680 Db telemetry stuff (#10428)
* Log telemetry connections in DB (#63435)

About The Pull Request

Logs tgui telemetry connections into the database. Useful since they are normally capped to 5.

Does not change the fact that the "banned account in connection history" part is still based on your history at that time. I figured it could potentially be very slow to go through your entire database history.

* Fix IPs in telemetry_connections not being unsigned (#63573)

About The Pull Request

Fixes IPs not being unsigned, causing problems where they get capped if the IP is too big.

Not tested.

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-01-04 04:14:16 +01:00
SkyratBot
cda93811e6 [MIRROR] Add admin ckey to known alts panel [MDB IGNORE] (#9649)
* Add admin ckey to known alts panel

* fixed conflicts

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2021-11-23 10:48:21 -05:00
SkyratBot
d6a1ad473f [MIRROR] Allows players to send more visible adminhelps when no admins are on, which'll definitely alert admins [MDB IGNORE] (#9583)
* Allows players to send more visible adminhelps when no admins are on, which'll definitely alert admins

* db portion sorted out

* now it really is

* should work about fine

* one last touch

* well, one more

* also botched comment

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2021-11-20 22:41:53 +01:00
SkyratBot
8978adde4a [MIRROR] Add the known alts panel, which prevents suspicious login logs for whitelisted ckeys [MDB IGNORE] (#9306)
* Add the known alts panel, which prevents suspicious login logs for whitelisted ckeys

* fixed

* ops, missed one conflict

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2021-11-08 22:26:02 -05:00
SkyratBot
2bf6b97a29 [MIRROR] Make round ID nullable in bans and tickets [MDB IGNORE] (#8773)
* Make round ID nullable in bans and tickets

* Axes Merge Conflict. Increments SQL version (#8822)

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: ORCACommander <orcacommander1@gmail.com>
2021-10-14 15:07:09 +01:00
GoldenAlpharex
5b9bf1ea44 Adds discord_reported column to the ban table (#7721) 2021-08-26 15:50:47 +12:00
SkyratBot
85a7f1c86f Adds the library_report table (#7341)
Co-authored-by: Nick <nick@nfreader.net>
2021-08-03 20:05:19 +01:00
ORCACommander
40ab50c3fd why must it always be the hard way (#6271)
makes https://github.com/Skyrat-SS13/Skyrat-tg/pull/6221#pullrequestreview-681367860 compliant
2021-06-12 03:06:53 +01:00
SkyratBot
0fa2b48b59 [MIRROR] 2FA for Admins (#6221)
* 2FA for Admins

* a

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-06-10 23:59:30 +01:00
SkyratBot
5cdc6a6bc9 [MIRROR] Moves explorer adventures to the database. (#5923)
* Moves explorer adventures to the database.

* Cleans up Merge Conflict. Increments DB Version (#5979)

* Automatic changelog generation for PR #5979 [ci skip]

* Update tgstation_schema.sql

Co-authored-by: AnturK <AnturK@users.noreply.github.com>
Co-authored-by: ORCACommander <ORCACommander@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2021-05-27 21:59:34 +02:00
ORCACommander
7f42a5a6cf [FIX] SQL Changelog cleanup AGAIN (#5513) 2021-05-07 01:54:53 +01:00
SkyratBot
c84d208fa6 [MIRROR] Sorts the majority of the rest of the unsorted chat (#5459)
* Sorts the majority of the rest of the unsorted chat

* 0.

* Update database_changelog.txt

Co-authored-by: Seris02 <49109742+Seris02@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-05-06 23:48:08 +01:00
ORCACommander
8df04ad6c5 clean up and and incremented DB version (#5477)
makes https://github.com/Skyrat-SS13/Skyrat-tg/pull/5422 conform to database standards
2021-05-05 18:25:51 +02:00
SkyratBot
336d99adcd Security citations are now logged to the DB (#5422)
Co-authored-by: Nick <nick@nfreader.net>
2021-05-03 15:12:59 +01:00
Useroth
faf4762e63 [Mostly non-modular] Stuff to accomodate multiple servers talking to the same database, including local/global bans. (#4032)
* Better accomodation of multiple servers using the same database.

* updated the PR number in readme.md

* Updated the database_changelog description.

* Oopsie.

* Cosmetic touch and sql query fixes.

* Opsie wopsie

* Oopsie x2

* Fugg
2021-03-30 07:50:29 +02:00
SkyratBot
15b345017f [MIRROR] Fix sql changelog (#4485)
* Fix sql changelog (#57972)

Fixed bad SQL that I originally wrote in the changelog for 5.11, anyone trying to update their schema from < 5.11 up would notice this.

* Fix sql changelog

Co-authored-by: Bobbahbrown <bobbahbrown@gmail.com>
2021-03-28 18:39:03 +01:00
Miss Fox
3727431c10 [NON-MODULAR] [TM Only] Added the SQL logging.. waf (#2668)
* Added the SQL logging.. waf

* I dont know why CI does not like my sql......

* I think i fixed the sql....

* Attempt #1 to make linter happy

* Shhh linter, it will be over soon

Just breath into this cloth... ignore the chloroform smell.

(Add a Preprocesser statement, to make the SpacemanDMM linter ignore the SQL code in a mob atom obj, that causes it to trigger its hard coded test for stoplag.
This only does not trigger on other SQL, as there is hard coded exception in SpacemanDMM that ignores the other objects. the better fix would be to update SpacemanDMM to add this into the exclusion. but this change at least allows the PR to be merged finally)

Co-authored-by: MissFox <github@aesir.org.uk>
2021-01-28 18:25:19 +00:00
SkyratBot
7a424010d9 [MIRROR] Sets the charset and collation for the SQL schema to utf8mb4 (#2623)
* Sets the charset and collation for the SQL schema to utf8mb4 (#56060)

Changes the charset and collation in the SQL schema to utf8mb4 (which is default in ubuntu 20.04 and debian 10 for MariaDB). This solves all the problems with russian or other non-latin1 characters in many cases related to the use of the database, because surprisingly the rest is already ready for such use cases.

I am not adding any SQL script to migrate from latin1 to utf8mb4, as this is an extremely destructive action. It must be performed manually with the data of all tables backed up before doing so.
However, this can be done by using the following queries, one time for database:
ALTER DATABASE databse_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
and one for each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

* Sets the charset and collation for the SQL schema to utf8mb4

Co-authored-by: Vladimir Veisman <v.veisman@fl45h13.me>
2021-01-14 16:54:26 +01:00
SkyratBot
9921adcf11 [MIRROR] Add playtime tracking to notes (#2426)
* Add playtime tracking to notes (#55800)

* Added playertime tracking to player notes

* Updated sql change log with revision

* Fixed typo in db_query

* And fixed another typo with query_get...

* Add recomended changes from Jordie0608

* Added missing DEFAULT NULL to sql

Co-authored-by: MissFox <github@ aesir.org.uk>

* Add playtime tracking to notes

Co-authored-by: MissFox0810 <4310446+MissFox0810@users.noreply.github.com>
Co-authored-by: MissFox <github@ aesir.org.uk>
2021-01-01 20:55:56 +01:00
SkyratBot
6f084f3a6e [MIRROR] SQL Schema Version 5.11 / Add indices for ticket table to support Statbus operations (#1049)
* SQL Schema Version 5.11 / Add indices for ticket table to support Statbus operations (#53541)

* I hope you're proud of yourselves. You've driven away another customer! It's baffling, I tell you! Your deep rooted lack of self-control only fosters failure in every endeavor we undertake! I mean, it's always one step forward and two steps back! Why? Don't you see the example I try to set for you?

* thanks jordie

* SQL Schema Version 5.11 / Add indices for ticket table to support Statbus operations

Co-authored-by: Bobbahbrown <bobbahbrown@gmail.com>
2020-09-29 12:44:04 +02:00
SkyratBot
41788d096e [MIRROR] Overhauls discord verification system (#588)
* Overhauls discord verification system (#53289)

This completely replaces the previous verification system, for one that
will interoperate with a discord redbot instance that uses the cogs
located at you github.com/optimumtact/orangescogs

This cuts out several steps in the system, but it also leaves alone the
existing notify system (which just uses a file list of discord ids) as a
record of who to notify

SQL changes required for the new database system

Version 5.10, 7 August 2020, by oranges

Changes how the discord verification process works.
Adds the discord_links table, and migrates discord id entries from
player table to the discord links table in a once off operation and then
removes the discord id on the player table

The user connects to any tg server, and uses the "Verify Discord
Account" verb, this generates a six word one time use token, with a 4
hour time validity period (defined as 4 hours from the timestamp value)
in the discord links table.

This one time token, and the ckey of the user are stored in
discord_links

At this point the entire DM side is done, this is all it does

* Overhauls discord verification system

Co-authored-by: oranges <email@oranges.net.nz>
2020-09-02 02:47:22 +02:00
jdawg1290
62676e72a8 Force LF line endings with gitattributes and convert repo (#52266)
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2020-07-16 03:02:40 +03:00
Jordie
248a6fd50c Datum based poll creation and vote handling update (#50843)
An almost complete rework of how creating polls, their data and voting on them is handled.

Instead of repeatedly querying for poll data, running polls are loaded at runtime into poll_question and poll_option datums that stores all the needed variables for both. This datum is then used for creating, editing and accessing poll data. The database is only contacted when saving changes or votes.

Creating polls and options is now done with a html window instead of a series of popups akin to how the banning panel works. The form data is parsed and error-checked before passing to be saved.
This is done in two stages, first time a poll's details are entered and it must be initialized (created as a datum) before options can be added and all of both are saved to the database. Instructions about how this work are shown on the poll creation window.

A new field for polls has been added, subtitles, which is text only shown when a poll is opened by a player instead of on the list of polls. Intended so the actual question text can be kept to only a name and important information about a poll goes in a subtitle.
All polls can now have revoting enabled on them.
Polls can have a starting datetime specified, this can be in the past but why would you do that?
Polls and options can be edited once created, excluding the type of a poll. Doing so will by default clear all existing poll votes. Votes can also be cleared by a button.

The handling of how votes are processed has been adapted for the datum system but is on the whole not functionally that different aside from poll validation not being roughly copypasted across each poll type's vote proc

All poll tables now have a deleted column for retaining 'deleted' data.
poll_question has also gained the columns created_datetime, subtitle, allow_revoting, their function explained above, and a change of idx_pquest_time_admin to idx_pquest_time_deleted_id.

A stored procedure set_poll_deleted has been added. This is called when setting a poll as deleted to avoid needing 4 separate queries from the server or one fairly long 4-way joined 

Create Poll verb is renamed to Server Poll Management
2020-05-11 14:34:51 +12:00
Jordie
4c7dfbc655 adds recording who deleted a note (#50445)
It came up that this isn't recorded, only logged.

Technically needs syncing merge with schema change but only deleting notes would break from this and tbh that isn't done very often so I think it'd be fine to yolo.
2020-04-18 11:28:34 +12:00
Nick
c758bdd51c [Ready] Database Tickets (#48727)
* DB ticket procs

* Schema changes for DB tickets

* Schema version update

* Fixes requested by Jordie

* SQL updates

Adds a recipient column

* Still one dangling issue where this DOESN'T WORK

* Alright, this should work

* Requested SQL fixes

* Rogue changes

* less bad defaults

* utf8 for the utf8 gods

* aaaaaa

* Update tgstation_schema_prefixed.sql

* Update tgstation_schema.sql

* Update database_changelog.txt

Co-authored-by: Jordie <4343468+Jordie0608@users.noreply.github.com>
2020-01-17 05:35:16 +11:00
AnturK
27ee01cee1 Adds name and desc to achievement metadata (#48146)
* Adds name and desc to achievement metadata

* Name 64, Desc 512
2019-12-10 15:59:18 +11:00
AnturK
f28b2d60b9 Adds achievement metadata table (#48007)
* Renames hub_id to database_id
Adds achievement_metadata table.

* Fixups

* enum
2019-11-30 18:34:42 +11:00
AnturK
a31c460dc0 Moves achievements from Hub to DB. (#47617)
Drops byond hub support and adds score and top 50 browsers.

Requires DB changes and manual creation of migration script if we want to keep old achievements so no random merges please.
2019-11-26 20:35:28 +13:00
Nick
8f8dde46b8 Adds the feeedback column to admin (#45025)
* Adds the feeedback column to `admin`

* edited changelog message for clarity

* increments db minor version define like you're meant to nednerd
2019-07-08 22:20:52 +10:00
AffectedArc07
c4e75bc40b [READY] SSdiscord and Round Notifications (#44231)
* Notify System

* V2

* Adds a hint

* Stoned fixes round 1

* Use grammar wells I can

* This didnt work

* I wish you could test on TGS without committing

* Jordie fixes round 1

* oops

* This took way longer than it should have taken

* Adds in endnotify for serverops

* Spacing
2019-06-30 00:43:25 +10:00
ShizCalev
ae2854626e Removes unintentional prefixes from schema 2019-03-19 11:44:55 -04:00
MrStonedOne
0e2cb84ac6 prefix cases 2019-03-16 00:26:01 -07:00
MrStonedOne
186f6c8ddd dbstickybans: Qdeleting queries, misc fixes, Query select proc for executing mutiple queries at once... 2019-03-16 00:23:40 -07:00
MrStonedOne
2e757683ab Database backed stickybans
Supports disabling stickybans for a round, exempting a key from matching a stickyban, and it now also detects rogue stickybans before anybody currently connected even gets disconnected. (new matches trigger a 5 second sleep and abort enforcement if enough other new matches happen in that timeframe)
2019-03-16 00:23:37 -07:00
Jordie
8a66665e95 Ban system and interface update (#41176)
Spiritual successor and extension to #17798, an almost entire rebuild of the SQL ban system backend and interface.
Bantypes are removed per #8584 and #6174. All bans are now 'role bans', server bans are when a ban's role is server. Admin bans are a column, meaning it's possible to ban admins from jobs.
Bans now have only an expiry datetime, duration is calculated from this when queried.
unbanned column is removed as it's superfluous, checking unban status is now done through checking unban_datetime. unban_round_id column added. Each ip and computerid columns rearranged so ip is always first, like in other tables. Bans now permit a null ckey, ip and computerid.

Ban checking is split into two procs now is_banned_from() does a check if a ckey is banned from one or more roles and returns true or false. This effectively replaces jobban_isbanned() used in simple if() statements. If connected a client's ban cache is checked rather than querying the DB. This makes it possible for a client connected to two or more servers to ignore any bans made on one server until their ban cache is rebuilt on the others. Could be avoided with cross-server calls to update ban caches or just the removal of the ban cache but as is I've done neither since I think it's enough of an edge case to not be worth it.
The second proc is is_banned_from_with_details(), this queries the DB for a role ban on a player's ckey, ip or CID and returns the details. This replaces direct queries in IsBanned.dm and the preferences menu.

The legacy ban system is removed.

The interfaces for banning, unbanning and editing bans have been remade to require less clicking and easier simultaneous operations. The banning and jobban panel are combined. They also store player connection details when opened so a client disconnecting no longer stops a ban being placed.

New banning panel:
Key, IP and CID can all be toggled to allow excluding them from a ban.
Checking Use IP and CID from last connection lets you enter only a ckey and have the DB fill these fields in for you, if possible.
Temporary bans have a drop-menu which lets you select between seconds, minutes, hours, days, weeks, months and years so you don't need to calculate how many minutes a long ban would be. The ban is still converted into minutes on the DB however.
Checking any of the head roles will check both of the boxes for you.
The red role box indicates there is already a ban on that role for this ckey. You can apply additional role bans to stack them.

New unbanning panel:
Unbanning panel is now separate from the banning panel but otherwise functionally the same.

Ban editing panel:
Actually just a modified banning panel, all the features from it work the same here.
You can now edit almost all parameters of a ban instead of just the reason.
You can't edit severity as it's not really part of the ban.
The panels have been tested but I've not been able to get my local server to be accessible so ban functionality isn't properly confirmed. Plenty of testing will be required as I'd rather not break bans.



cl
admin: Ban interface rework. The banning and unbanning panels have received a new design which is easier to use and allows multiple role bans to be made at once.
prefix: Ban search and unbanning moved to unbanning panel, which is now a separate panel to the old banning panel.
/cl
2018-12-05 08:48:37 +13:00
CitrusGender
bb2c82375e Add Note severity and changes UI of administrative notes (#39808)
* Adds note_severity and updates dbconfig. New SQL stuff too.

* whoops please don't hack into my database >:^(

* UI change, changed how it's stored in the DB, removed some queries when it returns, changed stuff to key.

* Update sql_message_system.dm

* this was not defined

* random indent

* wait how did this get here

* okay enough web edits I promise

* just kidding I got u

* Update common.css

* Added buttons, changed UI again, standardized the inputs, added severity for appearance bans, fed the dog

* forgot about the banning panel

* added an asset cache

* corrects asset datum var name
2018-08-26 20:23:29 +10:00
Jordie
f8f1b6ca03 Some injection fixes (#39642)
Fixes a breaking error and possible injection exploit in
populate_key_2018-07-09.py caused by a key existing from when byond allowed now
blocked characters like ' in usernames e.g.
http://www.byond.com/members/immortaljrosh?format=text

Additionally fixes some unsanitized values in other queries.
2018-08-12 14:09:45 -07:00
Jordie
31f020f3cc Add expiration time for admin messages (#39502)
* add expiration time for messages

* typo

* fix

* src to usr

* allows removing expiry from existing messages

* cancel button
2018-08-12 06:31:14 +10:00
Jordie
0d7ef3ed65 Key instead of ckey for user facing logs and ui (#39009)
* converts to using key instead of ckey for user facing logs and ui

* more key_name for airlock wires

* futureproofing check for if key changes

* --onlyckeymatch script argument and fail/success counter

* fix
2018-08-11 02:15:50 +10:00
Jordan Brown
a38ef372a1 Adds SQL to travis. Other travis optimizations (#38325)
* Adds SQL to travis

* See if we can get this working

* :dab:

* Try dis

* wew

* Try this?

* Should do it

* DL the biatch

* oof

* bruh

* json in 10.2

* Fix schemas

* Actually separate tools and byond builds

* Dedent the ting

* Needs more include

* Fix script logic

* Caching and fixups

* Jesus neer

* Fix this

* And this

* Fix things

* Oh that's why she did it here

* Fuck a duck

* yadayadayada

* Cache cargo in the right build

* Idiot.commit

* *sighs*

* Tools build doesn't need BYOND cache

* Create a database with the prefixed schema as well

* Fix prefixed trigger names
2018-06-11 20:08:55 +03:00
Jordie
37854a5489 Splits up round table initialize, start, end and shutdown (#37665)
For planned change to how TGS initializes server instances ahead of time so rounds aren't tracked as being far longer than they really would be. Similarly end time split for a more accurate round duration.
2018-05-15 19:11:39 +12:00
Jordie
69cdd4f269 Adds role time log table and triggers (#37763)
* adds role time log table and triggers

* typo

* whoops also typo here
2018-05-09 17:54:39 +10:00
Jordie
e44298a36c some dbadmin fixes (#37623) 2018-05-04 12:14:35 +02:00
Jordie0608
b304c760ae adds log and management tabs to permissions panel 2018-04-17 21:26:24 +10:00
Jordie
23a45889ed Modernizes SQL admin loading (#35264)
* updates sqladmins with excluded flags and tempminning

* rank, editing and permission protections; json backup

* fixes

* reverted the wrong file

* fix slidecolor cascading and disabled switches not being sent in form

* removes debug uncommenting

* whoops this too

* commas fix + versions for changelog entry headers since 3.0

* actually account for can_edit_flags and use of @ with - or *

* fixes and rearrangement of admin > localhost > autoadmin precedence

* in case you want to not have autologin autoadmins
2018-03-02 13:38:26 +13:00
Jordie0608
b6124b77b6 adds note to exception regarding round id 2017-11-24 01:07:21 +11:00
Jordie0608
c6b45dcbd9 adds note and warning prompt about mariadb 2017-11-24 00:00:31 +11:00
Jordie
8b19b490d1 JSON feedback (#32188)
* wip

* wip2

* makes code actually compile on 511 + fixes

* versioning

* s

* adds python conversion script, schema change and removes 'force ' from item_used_for_combat

* fix to compile

* forgot to actually commit this
2017-11-17 02:43:12 -05:00
MrStonedOne
ca33ca2e05 Note fading and persistent messages
Player Notes can now fade out over time so admins don't accidentally ban players for 4 year old notes
Deleted messages now remain in the database and are instead just hidden from view.

Two things relating to messages I've been meaning to do for ever.
2017-08-30 22:10:56 -07:00
Jordie0608
b7341a93ae adds more round id tracking 2017-08-25 22:05:32 +10:00