$ git clone https://wlchat.ion.nu/wlchat.git
commit a5969e3699b20ba1c6a2398fcd7b7a2e2581613d
Author: Alicia <...>
Date:   Tue Apr 22 22:19:34 2025 +0200

    Added packaging with cx_Freeze

diff --git a/Makefile b/Makefile
index e337947..4f801d6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,13 @@
 VERSION=0.1
 
+.venv:
+ python -m venv .venv
+ .venv/bin/pip install cx_freeze pygobject requests websocket-client pycryptodome pillow
+
+buildbin: .venv
+ .venv/bin/python setup.py build
+ cd build/* && tar --transform='s@^@wlchat-$(VERSION)/@' -czf ../../wlchat-$(VERSION)-$(shell uname -o | tr -d '/' | tr '[:upper:]' '[:lower:]').tar.gz *
+
 tarball: wlchat-$(VERSION).tar.gz
-wlchat-$(VERSION).tar.gz: Makefile LICENSE README wlchat.py terminal.py irc.py gtk.py dank.png frozen.png snow.png cookies.py aes.py
+wlchat-$(VERSION).tar.gz: Makefile setup.py LICENSE README wlchat.py terminal.py irc.py gtk.py dank.png frozen.png snow.png cookies.py aes.py
  tar --transform='s@^@wlchat-$(VERSION)/@' -czf $@ $^
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..9e4d226
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,24 @@
+from cx_Freeze import setup, Executable
+import sys
+
+# Dependencies are automatically detected, but it might need
+# fine tuning.
+build_options = {'packages': ['requests'],'excludes':[]}
+
+executables = [
+  {'script':'terminal.py', 'target_name':'wlchat-terminal'},
+  {'script':'irc.py', 'target_name':'wlchat-irc'}
+]
+
+include_files=['dank.png', 'frozen.png', 'snow.png']
+
+if(sys.platform!='win32'): # Can't build pygobject on windows? (seems to break in the pycairo dependency)
+  executables.append({'script':'gtk.py', 'target_name':'wlchat-gtk'})
+  build_options['packages'].append('gi')
+
+setup(name='WLChat',
+      version = '0.1',
+      description = 'Chat client',
+      options = {'build_exe': build_options},
+      executables = executables,
+      include_files=include_files)
diff --git a/wlchat.py b/wlchat.py
index a9a2b02..3089273 100644
--- a/wlchat.py
+++ b/wlchat.py
@@ -25,6 +25,7 @@ import os
 import time
 import math
 import cookies
+import ssl
 
 useragent='wlchat 0.1'
 pronouns=[ # Pronoun list
@@ -243,7 +244,10 @@ def joinchat(domain, browser, browserprofile, nick, conn, ui, uictx, authmethod=
   ws=websocket.WebSocketApp(wsurl, header=headers, on_message=readws, on_close=onclose, on_error=onerror)
   conn[0]=ws
   def run_forever(x):
-    ws.run_forever()
+    if getattr(sys, "frozen", False): # Workaround for websocket-client in cx_freeze, somehow it can't verify certificates. But we also wouldn't get this far if the check on the main site failed (done by requests which doesn't have this problem)
+      ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})
+    else:
+      ws.run_forever()
   thread=threading.Thread(target=run_forever, args={'reconnect':5})
   thread.daemon=True
   thread.start()