Skip to content

Commit

Permalink
update whitelist table schema
Browse files Browse the repository at this point in the history
notes about highly important sections which may go out of date because they are undocumented things
  • Loading branch information
nicholi committed Dec 31, 2022
1 parent d0c2a7c commit a7e3c9e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion install_projectzomboid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ function insertAdminWhitelist() {
# this is one of the more brittle parts of the pz installation, if any of the schema is changed
# we fail fast. however inserting admin passwords natively into db (and hashed) is far better
# than the alternative of passing the admin password as a commandline argument to server
###
### TODO: KEEP UP TO DATE
###
local adminUserIdResp sqlQuery
sqlQuery="CREATE TABLE IF NOT EXISTS [whitelist] (
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
Expand All @@ -285,7 +288,8 @@ function insertAdminWhitelist() {
[ownerid] TEXT NULL,
[accesslevel] TEXT NULL,
[transactionID] INTEGER NULL,
[displayName] TEXT NULL);
[displayName] TEXT NULL,
[priority] BOOLEAN NULL DEFAULT false);
CREATE UNIQUE INDEX IF NOT EXISTS [id] ON [whitelist]([id] ASC);
CREATE UNIQUE INDEX IF NOT EXISTS [username] ON [whitelist]([username] ASC);
SELECT 'SENTINEL', [id] FROM [whitelist] WHERE [username] = 'admin';
Expand Down
3 changes: 3 additions & 0 deletions pz_restart_graceful.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ function getPlayerCount() {
rconPlayersResponse="$(pz_players)"
rconPlayersHeader="$(head -n1 <<< "${rconPlayersResponse}")"
# NOTE: if pz changes any of its output to commands this will "break"
###
### TODO: KEEP UP TO DATE
###
playerCount="$(sed -E 's/.*players connected \(([0-9]+)\).*/\1/i' <<< "${rconPlayersHeader}")"

# we'll make it smart, so if regex fails (same text after processing) we assume there are players
Expand Down
3 changes: 3 additions & 0 deletions pz_startup_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ function main() {
rconPlayersResponse="$(pz_players)"
rconPlayersHeader="$(head -n1 <<< "${rconPlayersResponse}")"
# NOTE: if pz changes any of its output to command this will "break"
###
### TODO: KEEP UP TO DATE
###
playerCount="$(sed -E 's/.*players connected \(([0-9]+)\).*/\1/i' <<< "${rconPlayersHeader}")"

if [[ -z "${playerCount}" || "${rconPlayersHeader}" == "${playerCount}" ]]; then
Expand Down

0 comments on commit a7e3c9e

Please sign in to comment.