mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 06:57:42 +01:00
Merge branch 'master' of https://github.com/ParadiseSS13/Paradise into turfs
# Conflicts: # paradise.dme
This commit is contained in:
@@ -150,6 +150,8 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
|
||||
|
||||
if(isjobban)
|
||||
jobban_client_fullban(ckey, job)
|
||||
else
|
||||
flag_account_for_forum_sync(ckey)
|
||||
|
||||
datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
|
||||
|
||||
@@ -228,6 +230,8 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
|
||||
DB_ban_unban_by_id(ban_id)
|
||||
if(isjobban)
|
||||
jobban_unban_client(ckey, job)
|
||||
else
|
||||
flag_account_for_forum_sync(ckey)
|
||||
|
||||
datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
|
||||
|
||||
@@ -333,6 +337,8 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
var/DBQuery/query_update = dbcon.NewQuery(sql_update)
|
||||
query_update.Execute()
|
||||
|
||||
flag_account_for_forum_sync(pckey)
|
||||
|
||||
|
||||
/client/proc/DB_ban_panel()
|
||||
set category = "Admin"
|
||||
@@ -566,4 +572,12 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
|
||||
output += "</table></div>"
|
||||
|
||||
usr << browse(output,"window=lookupbans;size=900x700")
|
||||
usr << browse(output,"window=lookupbans;size=900x700")
|
||||
|
||||
/proc/flag_account_for_forum_sync(ckey)
|
||||
if(!dbcon)
|
||||
return
|
||||
var/skey = sanitizeSQL(ckey)
|
||||
var/sql = "UPDATE [format_table_name("player")] SET fupdate = 1 WHERE ckey = '[skey]'"
|
||||
var/DBQuery/adm_query = dbcon.NewQuery(sql)
|
||||
adm_query.Execute()
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
//Blocks an attempt to connect before even creating our client datum thing.
|
||||
world/IsBanned(key,address,computer_id)
|
||||
world/IsBanned(key, address, computer_id, check_ipintel = TRUE)
|
||||
|
||||
if(!config.ban_legacy_system)
|
||||
if(address)
|
||||
address = sanitizeSQL(address)
|
||||
if(computer_id)
|
||||
computer_id = sanitizeSQL(computer_id)
|
||||
|
||||
if(!key || !address || !computer_id)
|
||||
log_adminwarn("Failed Login (invalid data): [key] [address]-[computer_id]")
|
||||
return list("reason"="invalid login data", "desc"="Error: Could not check ban status, please try again. Error message: Your computer provided invalid or blank information to the server on connection (BYOND Username, IP, and Computer ID). Provided information for reference: Username: '[key]' IP: '[address]' Computer ID: '[computer_id]'. If you continue to get this error, please restart byond or contact byond support.")
|
||||
@@ -31,6 +38,14 @@ world/IsBanned(key,address,computer_id)
|
||||
mistakemessage = "\nIf you believe this is a mistake, please request help at [config.banappeals]."
|
||||
return list("reason"="using Tor", "desc"="\nReason: The network you are using to connect has been banned.[mistakemessage]")
|
||||
|
||||
//check if the IP address is a known proxy/vpn, and the user is not whitelisted
|
||||
if(check_ipintel && config.ipintel_email && config.ipintel_whitelist && ipintel_is_banned(key, address))
|
||||
log_adminwarn("Failed Login: [key] [computer_id] [address] - Proxy/VPN")
|
||||
var/mistakemessage = ""
|
||||
if(config.banappeals)
|
||||
mistakemessage = "\nIf you have to use one, request whitelisting at: [config.banappeals]"
|
||||
return list("reason"="using proxy or vpn", "desc"="\nReason: Proxies/VPNs are not allowed here. [mistakemessage]")
|
||||
|
||||
|
||||
if(config.ban_legacy_system)
|
||||
//Ban Checking
|
||||
|
||||
@@ -276,6 +276,15 @@ var/global/nologevent = 0
|
||||
|
||||
show_note(key)
|
||||
|
||||
/datum/admins/proc/vpn_whitelist()
|
||||
set category = "Admin"
|
||||
set name = "VPN Ckey Whitelist"
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
var/key = stripped_input(usr, "Enter ckey to add/remove, or leave blank to cancel:", "VPN Whitelist add/remove", max_length=32)
|
||||
if(key)
|
||||
vpn_whitelist_panel(key)
|
||||
|
||||
/datum/admins/proc/access_news_network() //MARKER
|
||||
set category = "Event"
|
||||
set name = "Access Newscaster Network"
|
||||
|
||||
@@ -53,6 +53,7 @@ var/list/admin_verbs_admin = list(
|
||||
/datum/admins/proc/PlayerNotes,
|
||||
/client/proc/cmd_mentor_say,
|
||||
/datum/admins/proc/show_player_notes,
|
||||
/datum/admins/proc/vpn_whitelist,
|
||||
/client/proc/free_slot, /*frees slot for chosen job*/
|
||||
/client/proc/toggleattacklogs,
|
||||
/client/proc/toggleadminlogs,
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
/datum/ipintel
|
||||
var/ip
|
||||
var/intel = 0
|
||||
var/cache = FALSE
|
||||
var/cacheminutesago = 0
|
||||
var/cachedate = ""
|
||||
var/cacherealtime = 0
|
||||
|
||||
/datum/ipintel/New()
|
||||
cachedate = SQLtime()
|
||||
cacherealtime = world.realtime
|
||||
|
||||
/datum/ipintel/proc/is_valid()
|
||||
. = FALSE
|
||||
if(intel < 0)
|
||||
return
|
||||
if(intel <= config.ipintel_rating_bad)
|
||||
if(world.realtime < cacherealtime + (config.ipintel_save_good HOURS))
|
||||
return TRUE
|
||||
else
|
||||
if(world.realtime < cacherealtime + (config.ipintel_save_bad HOURS))
|
||||
return TRUE
|
||||
|
||||
/proc/get_ip_intel(ip, bypasscache = FALSE, updatecache = TRUE)
|
||||
var/datum/ipintel/res = new()
|
||||
ip = sanitizeSQL(ip)
|
||||
res.ip = ip
|
||||
. = res
|
||||
if(!ip || !config.ipintel_email || !SSipintel.enabled)
|
||||
return
|
||||
if(!bypasscache)
|
||||
var/datum/ipintel/cachedintel = SSipintel.cache[ip]
|
||||
if(cachedintel && cachedintel.is_valid())
|
||||
cachedintel.cache = TRUE
|
||||
return cachedintel
|
||||
|
||||
if(dbcon.IsConnected())
|
||||
var/rating_bad = config.ipintel_rating_bad
|
||||
var/DBQuery/query_get_ip_intel = dbcon.NewQuery({"
|
||||
SELECT date, intel, TIMESTAMPDIFF(MINUTE,date,NOW())
|
||||
FROM [format_table_name("ipintel")]
|
||||
WHERE
|
||||
ip = INET_ATON('[ip]')
|
||||
AND ((
|
||||
intel < [rating_bad]
|
||||
AND
|
||||
date + INTERVAL [config.ipintel_save_good] HOUR > NOW()
|
||||
) OR (
|
||||
intel >= [rating_bad]
|
||||
AND
|
||||
date + INTERVAL [config.ipintel_save_bad] HOUR > NOW()
|
||||
))
|
||||
"})
|
||||
if(!query_get_ip_intel.Execute())
|
||||
qdel(query_get_ip_intel)
|
||||
return
|
||||
if(query_get_ip_intel.NextRow())
|
||||
res.cache = TRUE
|
||||
res.cachedate = query_get_ip_intel.item[1]
|
||||
res.intel = text2num(query_get_ip_intel.item[2])
|
||||
res.cacheminutesago = text2num(query_get_ip_intel.item[3])
|
||||
res.cacherealtime = world.realtime - (text2num(query_get_ip_intel.item[3])*10*60)
|
||||
SSipintel.cache[ip] = res
|
||||
qdel(query_get_ip_intel)
|
||||
return
|
||||
qdel(query_get_ip_intel)
|
||||
res.intel = ip_intel_query(ip)
|
||||
if(updatecache && res.intel >= 0)
|
||||
SSipintel.cache[ip] = res
|
||||
if(dbcon.IsConnected())
|
||||
var/DBQuery/query_add_ip_intel = dbcon.NewQuery("INSERT INTO [format_table_name("ipintel")] (ip, intel) VALUES (INET_ATON('[ip]'), [res.intel]) ON DUPLICATE KEY UPDATE intel = VALUES(intel), date = NOW()")
|
||||
query_add_ip_intel.Execute()
|
||||
qdel(query_add_ip_intel)
|
||||
|
||||
|
||||
/proc/ip_intel_query(ip, var/retryed=0)
|
||||
. = -1 //default
|
||||
if(!ip)
|
||||
return
|
||||
if(SSipintel.throttle > world.timeofday)
|
||||
return
|
||||
if(!SSipintel.enabled)
|
||||
return
|
||||
|
||||
var/list/http[] = world.Export("http://[config.ipintel_domain]/check.php?ip=[ip]&contact=[config.ipintel_email]&format=json&flags=b")
|
||||
|
||||
if(http)
|
||||
var/status = text2num(http["STATUS"])
|
||||
|
||||
if(status == 200)
|
||||
var/response = json_decode(file2text(http["CONTENT"]))
|
||||
if(response)
|
||||
if(response["status"] == "success")
|
||||
var/intelnum = text2num(response["result"])
|
||||
if(isnum(intelnum))
|
||||
return text2num(response["result"])
|
||||
else
|
||||
ipintel_handle_error("Bad intel from server: [response["result"]].", ip, retryed)
|
||||
if(!retryed)
|
||||
sleep(25)
|
||||
return .(ip, 1)
|
||||
else
|
||||
ipintel_handle_error("Bad response from server: [response["status"]].", ip, retryed)
|
||||
if(!retryed)
|
||||
sleep(25)
|
||||
return .(ip, 1)
|
||||
|
||||
else if(status == 429)
|
||||
ipintel_handle_error("Error #429: We have exceeded the rate limit.", ip, 1)
|
||||
return
|
||||
else
|
||||
ipintel_handle_error("Unknown status code: [status].", ip, retryed)
|
||||
if(!retryed)
|
||||
sleep(25)
|
||||
return .(ip, 1)
|
||||
else
|
||||
ipintel_handle_error("Unable to connect to API.", ip, retryed)
|
||||
if(!retryed)
|
||||
sleep(25)
|
||||
return .(ip, 1)
|
||||
|
||||
|
||||
/proc/ipintel_handle_error(error, ip, retryed)
|
||||
if(retryed)
|
||||
SSipintel.errors++
|
||||
error += " Could not check [ip]. Disabling IPINTEL for [SSipintel.errors] minute[( SSipintel.errors == 1 ? "" : "s" )]"
|
||||
SSipintel.throttle = world.timeofday + (2 * SSipintel.errors MINUTES)
|
||||
else
|
||||
error += " Attempting retry on [ip]."
|
||||
log_ipintel(error)
|
||||
|
||||
/proc/log_ipintel(text)
|
||||
log_game("IPINTEL: [text]")
|
||||
log_debug("IPINTEL: [text]")
|
||||
|
||||
|
||||
/proc/ipintel_is_banned(t_ckey, t_ip)
|
||||
if(!config.ipintel_email)
|
||||
return FALSE
|
||||
if(!config.ipintel_whitelist)
|
||||
return FALSE
|
||||
if(!dbcon.IsConnected())
|
||||
return FALSE
|
||||
if(!ipintel_badip_check(t_ip))
|
||||
return FALSE
|
||||
if(vpn_whitelist_check(t_ckey))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/ipintel_badip_check(target_ip)
|
||||
var/rating_bad = config.ipintel_rating_bad
|
||||
if(!rating_bad)
|
||||
log_debug("ipintel_badip_check reports misconfigured rating_bad directive")
|
||||
return FALSE
|
||||
var/valid_hours = config.ipintel_save_bad
|
||||
if(!valid_hours)
|
||||
log_debug("ipintel_badip_check reports misconfigured ipintel_save_bad directive")
|
||||
return FALSE
|
||||
target_ip = sanitizeSQL(target_ip)
|
||||
rating_bad = sanitizeSQL(rating_bad)
|
||||
valid_hours = sanitizeSQL(valid_hours)
|
||||
var/check_sql = {"SELECT * FROM [format_table_name("ipintel")] WHERE ip = INET_ATON('[target_ip]') AND intel >= [rating_bad] AND (date + INTERVAL [valid_hours] HOUR) > NOW()"}
|
||||
var/DBQuery/query_get_ip_intel = dbcon.NewQuery(check_sql)
|
||||
if(!query_get_ip_intel.Execute())
|
||||
log_debug("ipintel_badip_check reports failed query execution")
|
||||
qdel(query_get_ip_intel)
|
||||
return FALSE
|
||||
if(!query_get_ip_intel.NextRow())
|
||||
qdel(query_get_ip_intel)
|
||||
return FALSE
|
||||
qdel(query_get_ip_intel)
|
||||
return TRUE
|
||||
|
||||
/proc/vpn_whitelist_check(target_ckey)
|
||||
if(!config.ipintel_whitelist)
|
||||
return FALSE
|
||||
var/target_sql_ckey = ckey(target_ckey)
|
||||
var/DBQuery/query_whitelist_check = dbcon.NewQuery("SELECT * FROM [format_table_name("vpn_whitelist")] WHERE ckey = '[target_sql_ckey]'")
|
||||
if(!query_whitelist_check.Execute())
|
||||
var/err = query_whitelist_check.ErrorMsg()
|
||||
log_debug("SQL ERROR on proc/vpn_whitelist_check for ckey '[target_sql_ckey]'. Error : \[[err]\]\n")
|
||||
return FALSE
|
||||
if(query_whitelist_check.NextRow())
|
||||
return TRUE // At least one row in the whitelist names their ckey. That means they are whitelisted.
|
||||
return FALSE
|
||||
|
||||
/proc/vpn_whitelist_add(target_ckey)
|
||||
var/target_sql_ckey = ckey(target_ckey)
|
||||
var/reason_string = input(usr, "Enter link to the URL of their whitelist request on the forum.","Reason required") as message|null
|
||||
if(!reason_string)
|
||||
return FALSE
|
||||
reason_string = sanitizeSQL(reason_string)
|
||||
var/DBQuery/query_whitelist_add = dbcon.NewQuery("INSERT INTO [format_table_name("vpn_whitelist")] (ckey,reason) VALUES ('[target_sql_ckey]','[reason_string]')")
|
||||
if(!query_whitelist_add.Execute())
|
||||
var/err = query_whitelist_add.ErrorMsg()
|
||||
log_debug("SQL ERROR on proc/vpn_whitelist_add for ckey '[target_sql_ckey]'. Error : \[[err]\]\n")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/vpn_whitelist_remove(target_ckey)
|
||||
var/target_sql_ckey = ckey(target_ckey)
|
||||
var/DBQuery/query_whitelist_remove = dbcon.NewQuery("DELETE FROM [format_table_name("vpn_whitelist")] WHERE ckey = '[target_sql_ckey]'")
|
||||
if(!query_whitelist_remove.Execute())
|
||||
var/err = query_whitelist_remove.ErrorMsg()
|
||||
log_debug("SQL ERROR on proc/vpn_whitelist_remove for ckey '[target_sql_ckey]'. Error : \[[err]\]\n")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/proc/vpn_whitelist_panel(target_ckey as text)
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
if(!target_ckey)
|
||||
return
|
||||
var/is_already_whitelisted = vpn_whitelist_check(target_ckey)
|
||||
if(is_already_whitelisted)
|
||||
var/confirm = alert("[target_ckey] is already whitelisted. Remove them?", "Confirm Removal", "No", "Yes")
|
||||
if(!confirm || confirm != "Yes")
|
||||
to_chat(usr, "VPN whitelist alteration cancelled.")
|
||||
return
|
||||
else if(vpn_whitelist_remove(target_ckey))
|
||||
to_chat(usr, "[target_ckey] was removed from the VPN whitelist.")
|
||||
else
|
||||
to_chat(usr, "VPN whitelist unchanged.")
|
||||
else
|
||||
if(vpn_whitelist_add(target_ckey))
|
||||
to_chat(usr, "[target_ckey] was added to the VPN whitelist.")
|
||||
else
|
||||
to_chat(usr, "VPN whitelist unchanged.")
|
||||
@@ -72,6 +72,8 @@
|
||||
|
||||
control_freak = CONTROL_FREAK_ALL | CONTROL_FREAK_SKIN | CONTROL_FREAK_MACROS
|
||||
|
||||
var/ip_intel = "Disabled"
|
||||
|
||||
var/datum/click_intercept/click_intercept = null
|
||||
|
||||
//datum that controls the displaying and hiding of tooltips
|
||||
|
||||
@@ -229,7 +229,8 @@
|
||||
if(href_list["ssdwarning"])
|
||||
ssd_warning_acknowledged = TRUE
|
||||
to_chat(src, "<span class='notice'>SSD warning acknowledged.</span>")
|
||||
|
||||
if(href_list["link_forum_account"])
|
||||
link_forum_account()
|
||||
switch(href_list["action"])
|
||||
if("openLink")
|
||||
src << link(href_list["link"])
|
||||
@@ -320,8 +321,7 @@
|
||||
//Admin Authorisation
|
||||
// Automatically makes localhost connection an admin
|
||||
if(!config.disable_localhost_admin)
|
||||
var/localhost_addresses = list("127.0.0.1", "::1") // Adresses
|
||||
if(!isnull(address) && address in localhost_addresses)
|
||||
if(is_connecting_from_localhost())
|
||||
new /datum/admins("!LOCALHOST!", R_HOST, ckey) // Makes localhost rank
|
||||
holder = admin_datums[ckey]
|
||||
if(holder)
|
||||
@@ -370,8 +370,9 @@
|
||||
to_chat(src, message)
|
||||
clientmessages.Remove(ckey)
|
||||
|
||||
donator_check()
|
||||
|
||||
donator_check()
|
||||
check_ip_intel()
|
||||
send_resources()
|
||||
|
||||
if(prefs.toggles & UI_DARKMODE) // activates dark mode if its flagged. -AA07
|
||||
@@ -393,6 +394,8 @@
|
||||
generate_clickcatcher()
|
||||
apply_clickcatcher()
|
||||
|
||||
check_forum_link()
|
||||
|
||||
if(custom_event_msg && custom_event_msg != "")
|
||||
to_chat(src, "<h1 class='alert'>Custom Event</h1>")
|
||||
to_chat(src, "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>")
|
||||
@@ -409,6 +412,12 @@
|
||||
|
||||
Master.UpdateTickRate()
|
||||
|
||||
/client/proc/is_connecting_from_localhost()
|
||||
var/localhost_addresses = list("127.0.0.1", "::1") // Adresses
|
||||
if(!isnull(address) && address in localhost_addresses)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
//////////////
|
||||
//DISCONNECT//
|
||||
//////////////
|
||||
@@ -539,6 +548,81 @@
|
||||
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `[format_table_name("connection_log")]`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[ckey]','[sql_ip]','[sql_computerid]');")
|
||||
query_accesslog.Execute()
|
||||
|
||||
/client/proc/check_ip_intel()
|
||||
set waitfor = 0 //we sleep when getting the intel, no need to hold up the client connection while we sleep
|
||||
if(config.ipintel_email)
|
||||
if(config.ipintel_maxplaytime && config.use_exp_tracking)
|
||||
var/living_hours = get_exp_type_num(EXP_TYPE_LIVING) / 60
|
||||
if(living_hours >= config.ipintel_maxplaytime)
|
||||
return
|
||||
|
||||
if(is_connecting_from_localhost())
|
||||
log_debug("check_ip_intel: skip check for player [key_name_admin(src)] connecting from localhost.")
|
||||
return
|
||||
|
||||
if(vpn_whitelist_check(ckey))
|
||||
log_debug("check_ip_intel: skip check for player [key_name_admin(src)] [address] on whitelist.")
|
||||
return
|
||||
|
||||
var/datum/ipintel/res = get_ip_intel(address)
|
||||
ip_intel = res.intel
|
||||
verify_ip_intel()
|
||||
|
||||
/client/proc/verify_ip_intel()
|
||||
if(ip_intel >= config.ipintel_rating_bad)
|
||||
var/detailsurl = config.ipintel_detailsurl ? "(<a href='[config.ipintel_detailsurl][address]'>IP Info</a>)" : ""
|
||||
if(config.ipintel_whitelist)
|
||||
spawn(40) // This is necessary because without it, they won't see the message, and addtimer cannot be used because the timer system may not have initialized yet
|
||||
message_admins("<span class='adminnotice'>IPIntel: [key_name_admin(src)] on IP [address] was rejected. [detailsurl]</span>")
|
||||
var/blockmsg = "<B>Error: proxy/VPN detected. Proxy/VPN use is not allowed here. Deactivate it before you reconnect.</B>"
|
||||
if(config.banappeals)
|
||||
blockmsg += "\nIf you are not actually using a proxy/VPN, or have no choice but to use one, request whitelisting at: [config.banappeals]"
|
||||
to_chat(src, blockmsg)
|
||||
qdel(src)
|
||||
else
|
||||
message_admins("<span class='adminnotice'>IPIntel: [key_name_admin(src)] on IP [address] is likely to be using a Proxy/VPN. [detailsurl]</span>")
|
||||
|
||||
|
||||
/client/proc/check_forum_link()
|
||||
if(config.forum_link_url && prefs && !prefs.fuid)
|
||||
to_chat(src, "<B>You do not have your forum account linked. <a href='?src=[UID()];link_forum_account=true'>LINK FORUM ACCOUNT</a></B>")
|
||||
|
||||
/client/proc/create_oauth_token()
|
||||
var/DBQuery/query_find_token = dbcon.NewQuery("SELECT token FROM [format_table_name("oauth_tokens")] WHERE ckey = '[ckey]' limit 1")
|
||||
if(!query_find_token.Execute())
|
||||
log_debug("create_oauth_token: failed db read")
|
||||
return
|
||||
if(query_find_token.NextRow())
|
||||
return query_find_token.item[1]
|
||||
var/tokenstr = md5("[ckey][rand()]")
|
||||
var/DBQuery/query_insert_token = dbcon.NewQuery("INSERT INTO [format_table_name("oauth_tokens")] (ckey, token) VALUES('[ckey]','[tokenstr]')")
|
||||
if(!query_insert_token.Execute())
|
||||
return
|
||||
return tokenstr
|
||||
|
||||
/client/proc/link_forum_account()
|
||||
if(IsGuestKey(key))
|
||||
to_chat(src, "Guest keys cannot be linked.")
|
||||
return
|
||||
if(prefs && prefs.fuid)
|
||||
to_chat(src, "Your forum account is already set.")
|
||||
return
|
||||
var/DBQuery/query_find_link = dbcon.NewQuery("SELECT fuid FROM [format_table_name("player")] WHERE ckey = '[ckey]' limit 1")
|
||||
if(!query_find_link.Execute())
|
||||
log_debug("link_forum_account: failed db read")
|
||||
return
|
||||
if(query_find_link.NextRow())
|
||||
if(query_find_link.item[1])
|
||||
to_chat(src, "Your forum account is already set. (" + query_find_link.item[1] + ")")
|
||||
return
|
||||
var/tokenid = create_oauth_token()
|
||||
if(!tokenid)
|
||||
to_chat(src, "link_forum_account: unable to create token")
|
||||
return
|
||||
var/url = "[config.forum_link_url][tokenid]"
|
||||
to_chat(src, {"Now opening a windows to verify your information with the forums. If the window does not load, please go to: <a href="[url]">[url]</a>."})
|
||||
src << link(url)
|
||||
return
|
||||
|
||||
#undef TOPIC_SPAM_DELAY
|
||||
#undef UPLOAD_LIMIT
|
||||
|
||||
@@ -92,6 +92,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
var/windowflashing = TRUE
|
||||
var/clientfps = 0
|
||||
var/atklog = ATKLOG_ALL
|
||||
var/fuid // forum userid
|
||||
|
||||
//ghostly preferences
|
||||
var/ghost_anonsay = 0
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
ghost_anonsay,
|
||||
exp,
|
||||
clientfps,
|
||||
atklog
|
||||
atklog,
|
||||
fuid
|
||||
FROM [format_table_name("player")]
|
||||
WHERE ckey='[C.ckey]'"}
|
||||
)
|
||||
@@ -50,6 +51,7 @@
|
||||
exp = query.item[16]
|
||||
clientfps = text2num(query.item[17])
|
||||
atklog = text2num(query.item[18])
|
||||
fuid = text2num(query.item[19])
|
||||
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
@@ -69,6 +71,7 @@
|
||||
exp = sanitize_text(exp, initial(exp))
|
||||
clientfps = sanitize_integer(clientfps, 0, 1000, initial(clientfps))
|
||||
atklog = sanitize_integer(atklog, 0, 100, initial(atklog))
|
||||
fuid = sanitize_integer(fuid, 0, 10000000, initial(fuid))
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_preferences(client/C)
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// DONT TOUCH ANYTHING IN HERE UNLESS YOU KNOW WHAT YOU ARE DOING -affected
|
||||
/client/verb/linkdiscord()
|
||||
set category = "Special Verbs"
|
||||
set name = "Link Discord Account"
|
||||
set desc = "Link your discord account to your BYOND account."
|
||||
var/user_ckey = sanitizeSQL(usr.ckey) // Probably not neccassary but better safe than sorry
|
||||
if(!config.sql_enabled)
|
||||
to_chat(src, "<span class='warning'>This is feature requires the SQL backend</span>")
|
||||
return
|
||||
var/DBQuery/db_discord_id = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE ckey = '[user_ckey]'")
|
||||
if(!db_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while selecting discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error checking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
var/stored_id
|
||||
while(db_discord_id.NextRow())
|
||||
stored_id = db_discord_id.item[1]
|
||||
if(!stored_id) // Not linked
|
||||
var/know_how = alert("Do you know how to get a discord user ID? This ID is NOT your discord username and numbers!","Question","Yes","No")
|
||||
if(know_how == "No") // Opens discord support on how to collect IDs
|
||||
src << link("https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID")
|
||||
var/entered_id = input("Please enter your Discord ID.", "Enter Discord ID", null, null) as text|null
|
||||
var/sql_id = sanitizeSQL(entered_id)
|
||||
var/DBQuery/store_discord_id = dbcon.NewQuery("INSERT INTO [format_table_name("discord")] (ckey, discord_id, notify) VALUES ('[user_ckey]', [sql_id], 0)")
|
||||
if(!store_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while linking discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error linking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Successfully linked discord account [entered_id] to [user_ckey]</span>")
|
||||
else // Linked
|
||||
var/choice = alert("You already have the Discord Account [stored_id] linked to [user_ckey]. Would you like to unlink or replace","Already Linked","Unlink","Replace")
|
||||
switch(choice)
|
||||
if("Unlink")
|
||||
var/DBQuery/unlink_discord_id = dbcon.NewQuery("DELETE FROM [format_table_name("discord")] WHERE ckey = '[user_ckey]'")
|
||||
if(!unlink_discord_id.Execute())
|
||||
var/err = unlink_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while unlinking discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error unlinking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Successfully unlinked discord account</span>")
|
||||
if("Replace")
|
||||
var/entered_id = input("Please enter your Discord ID. Instructions can be found at https://bit.ly/2AfUu40", "Enter Discord ID", null, null) as text|null
|
||||
var/sql_id = sanitizeSQL(entered_id)
|
||||
var/DBQuery/store_discord_id = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET discord_id = '[sql_id]' WHERE ckey='[user_ckey]'")
|
||||
if(!store_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
to_chat(src, "<span class='warning'>Error replacing Discord account. Please inform an administrator</span>")
|
||||
log_game("SQL ERROR while linking discord account. Error : \[[err]\]\n")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Successfully linked discord account [entered_id] to [user_ckey]</span>")
|
||||
@@ -1,48 +0,0 @@
|
||||
// DONT TOUCH ANYTHING IN HERE UNLESS YOU KNOW WHAT YOU ARE DOING -affected
|
||||
/client/verb/notify_restart()
|
||||
set category = "Special Verbs"
|
||||
set name = "Notify Restart"
|
||||
set desc = "Notifies you on Discord when the server restarts."
|
||||
if(!config.sql_enabled)
|
||||
to_chat(src, "<span class='warning'>This is feature requires the SQL backend</span>")
|
||||
return
|
||||
var/DBQuery/db_discord_id = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE ckey = '[ckey]'")
|
||||
if(!db_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while selecting discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error checking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
var/stored_id
|
||||
while(db_discord_id.NextRow())
|
||||
stored_id = db_discord_id.item[1]
|
||||
if(!stored_id) // Not linked
|
||||
to_chat(src, "<span class='warning'>This requires you to link your Discord account with the \"Link Discord Account\" verb.</span>")
|
||||
return
|
||||
else // Linked
|
||||
var/DBQuery/toggle_status = dbcon.NewQuery("SELECT notify FROM [format_table_name("discord")] WHERE ckey = '[ckey]'")
|
||||
if(!toggle_status.Execute())
|
||||
var/err = toggle_status.ErrorMsg()
|
||||
log_game("SQL ERROR while getting discord account. Error : \[[err]\]\n")
|
||||
var/notify_status
|
||||
while(toggle_status.NextRow())
|
||||
notify_status = toggle_status.item[1]
|
||||
if(notify_status) // Data is there
|
||||
switch(notify_status)
|
||||
if("0")
|
||||
var/DBQuery/update_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 1 WHERE ckey='[ckey]'")
|
||||
if(!update_notify.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
to_chat(src, "<span class='warning'>Error updating notify status. Please inform an administrator</span>")
|
||||
log_game("SQL ERROR while updating notify status. Error : \[[err]\]\n")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>You will now be notified on discord when the next round is starting</span>")
|
||||
if("1")
|
||||
var/DBQuery/update_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 0 WHERE ckey='[ckey]'")
|
||||
if(!update_notify.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
to_chat(src, "<span class='warning'>Error updating notify status. Please inform an administrator</span>")
|
||||
log_game("SQL ERROR while updating notify status. Error : \[[err]\]\n")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>You will no longer be notified on discord when the next round is starting</span>")
|
||||
else // Oh fuck what the hell happened
|
||||
to_chat(src, "<span class='danger'>Something has gone VERY wrong, or affected cant code.</span>")
|
||||
@@ -19,20 +19,3 @@
|
||||
if(config.admin_irc)
|
||||
send2irc(config.admin_irc, msg)
|
||||
return
|
||||
|
||||
/hook/startup/proc/ircNotify()
|
||||
var/people_to_ping = ""
|
||||
var/DBQuery/pull_notify = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE notify = 1")
|
||||
if(!pull_notify.Execute())
|
||||
var/err = pull_notify.ErrorMsg()
|
||||
log_game("SQL ERROR while pulling notify people. Error : \[[err]\]\n")
|
||||
else
|
||||
while(pull_notify.NextRow())
|
||||
people_to_ping += "<@" + pull_notify.item[1] + "> "
|
||||
send2mainirc("Server starting up on [station_name()]. Connect to: <byond://[config.server? "[config.server]" : "[world.address]:[world.port]"]> "+people_to_ping, 7355608)
|
||||
// Set notify to 0 so people arent pinged round after round
|
||||
var/DBQuery/reset_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 0 WHERE notify = 1")
|
||||
if(!reset_notify.Execute())
|
||||
var/err = reset_notify.ErrorMsg()
|
||||
log_game("SQL ERROR while resetting notify status. Error : \[[err]\]\n")
|
||||
return 1
|
||||
|
||||
@@ -182,7 +182,8 @@
|
||||
return 0
|
||||
|
||||
if(alert(src,"Are you sure you wish to observe? You cannot normally join the round after doing this!","Player Setup","Yes","No") == "Yes")
|
||||
if(!client) return 1
|
||||
if(!client)
|
||||
return 1
|
||||
var/mob/dead/observer/observer = new()
|
||||
src << browse(null, "window=playersetup")
|
||||
spawning = 1
|
||||
@@ -220,7 +221,6 @@
|
||||
if(!SSticker || SSticker.current_state != GAME_STATE_PLAYING)
|
||||
to_chat(usr, "<span class='warning'>The round is either not ready, or has already finished...</span>")
|
||||
return
|
||||
|
||||
if(client.prefs.species in GLOB.whitelisted_species)
|
||||
|
||||
if(!is_alien_whitelisted(src, client.prefs.species) && config.usealienwhitelist)
|
||||
|
||||
Reference in New Issue
Block a user