Skip to content

Commit b46cfa2

Browse files
committed
WIP use SMODS https
1 parent fb0a523 commit b46cfa2

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

https/linux-https.so

-75.2 KB
Binary file not shown.

https/macos-https.so

-188 KB
Binary file not shown.

https/thread.lua

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
require("love.system")
2-
3-
-- mac/linux support?
4-
5-
local script_path = debug.getinfo(1, "S").source:sub(2)
6-
local script_dir = script_path:match("(.*/)")
7-
8-
package.path = script_dir .. "?.lua;" .. package.path
9-
package.cpath = script_dir .. "?.so;" .. package.cpath
10-
11-
local index_os = love.system.getOS()
12-
13-
if index_os == "OS X" then
14-
loc_https = require("macos-https")
15-
elseif index_os == "Linux" then
16-
loc_https = require("linux-https")
17-
else
18-
loc_https = require("https")
19-
end
2+
-- Currently crashes, I think SMODS.https module isn't loaded in the thread
3+
loc_https = require("SMODS.https")
204

215
local last_update_time = 0
226
local initial = true
237
while true do
248
if (os.time() - last_update_time >= 60) or initial then
25-
initial = nil
9+
initial = false
2610
last_update_time = os.time()
2711
local resp, txt = loc_https.request(
2812
"https://discord.com/api/v10/invites/eUf9Ur6RyB?with_counts=true" .. "&v=" .. tostring(os.time())

lib/https.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
-- Update the Cryptid member count using HTTPS
22
function update_cry_member_count()
3-
if Cryptid.enabled["HTTPS Module"] == true and Cryptid.mod_path then
3+
if Cryptid_config.HTTPS and Cryptid.path and false then
44
if not GLOBAL_cry_member_update_thread then
55
-- start up the HTTPS thread if needed
6-
local file_data = assert(NFS.newFileData(Cryptid.mod_path .. "https/thread.lua"))
6+
local file_data = assert(NFS.newFileData(Cryptid.path .. "https/thread.lua"))
77
GLOBAL_cry_member_update_thread = love.thread.newThread(file_data)
88
GLOBAL_cry_member_update_thread:start()
99
end
@@ -23,6 +23,6 @@ function update_cry_member_count()
2323
end
2424
else
2525
-- Use a fallback value if HTTPS is disabled (you all are awesome)
26-
GLOBAL_cry_member_count = 20000
26+
GLOBAL_cry_member_count = 24000
2727
end
2828
end

0 commit comments

Comments
 (0)