Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Rewrite #17

Merged
merged 27 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1840eb1
basic debugging bridge
alessiodam Dec 15, 2023
74bd0a4
baud rate to 115200 baud
alessiodam Dec 15, 2023
e6825da
test code that works to simulate a "server". very basic, no internet …
alessiodam Dec 16, 2023
a692637
implement basic chat system for testing
alessiodam Dec 16, 2023
ebfe613
working bridge and github workflow, doesn't work on prod servers
alessiodam Dec 16, 2023
714409b
update workflow
alessiodam Dec 16, 2023
b289172
hope workflow is fixed
alessiodam Dec 16, 2023
87246e7
nope made it worse
alessiodam Dec 16, 2023
4a8b72c
maybe now?
alessiodam Dec 16, 2023
544f1d4
remove the run code
alessiodam Dec 16, 2023
c76083d
make it run only on windows
alessiodam Dec 16, 2023
845cb9a
Update workflow to --onefile and artifact upload
alessiodam Dec 16, 2023
a758cf9
hide sensitive data in log
alessiodam Dec 16, 2023
8018989
change to readlines and \n like commandblockguy recommended.
alessiodam Dec 17, 2023
5b5b316
update workflow for single file upload
alessiodam Dec 17, 2023
aadec03
build: strips final logging message, add testing.py to test without c…
alessiodam Dec 17, 2023
8444816
release
alessiodam Dec 17, 2023
041d0a2
update workflow - release
alessiodam Dec 17, 2023
beb7ce1
add token field to workflow
alessiodam Dec 17, 2023
fbb149b
release bridge working fine, removed trailing newline in workflow
alessiodam Dec 17, 2023
47d9de5
release bridge auto reconnects to calc
alessiodam Dec 17, 2023
cb7d0d5
fix bridge not running if auto reconnect is false
alessiodam Dec 17, 2023
eae33d4
release - update README.md
alessiodam Dec 17, 2023
fb73848
release - add icon to workflow
alessiodam Dec 17, 2023
2b103bc
release - make bridge point to prod infra
alessiodam Dec 17, 2023
512eecb
basic plugin system after request from Log4Jake
alessiodam Dec 20, 2023
51d9a59
Add deprecation warning to README
alessiodam Feb 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions .github/workflows/build-release-master.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/build-windows-executable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:

jobs:
build:
runs-on: ['windows-latest']

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11

- run: pip install -r requirements.txt pyinstaller
- run: pyinstaller --onefile --icon=tkbstudios.ico tinet-bridge.py
- uses: actions/upload-artifact@v4
with:
name: tinet-bridge
path: dist/tinet-bridge.exe

- name: Release
uses: softprops/action-gh-release@v1
if: "contains(github.event.head_commit.message, 'release')"
with:
files: dist/tinet-bridge.exe
tag_name: V${{ github.run_number }}
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# TINET Bridge
# [DEPRECATED] TINET Bridge
## Why?
TINET Bridge IS DEPRECATED. We are using [lwip-ce](https://google.com) for communication.
lwip-ce is great because it literally is an ethernet cable or a WiFi adapter supporting WPS,
which makes it better in terms of communication and protocol support.

The [documentation](https://tinetdocs.tkbstudios.com/) is updated.

## Old README
This program makes the connection between your calculator and our main servers possible!
[![wakatime](https://wakatime.com/badge/github/tkbstudios/tinet-bridge.svg)](https://wakatime.com/badge/github/tkbstudios/tinet-bridge)
[![.github/workflows/build-windows-executable.yml](https://github.com/tkbstudios/tinet-bridge/actions/workflows/build-windows-executable.yml/badge.svg)](https://github.com/tkbstudios/tinet-bridge/actions/workflows/build-windows-executable.yml)

> ⚠️ please ALWAYS update the bridge to the latest version!
> by doing this you make sure that you have the latest security updates available!
Expand Down
12 changes: 12 additions & 0 deletions plugins/testplugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# this is a test plugin

class TINETBridgePlugin:
def __init__(self):
self.plugin_name = "TestPlugin"
print(f"Successfully loaded {self.plugin_name}")

def custom_print(self, message):
print(f"[{self.plugin_name}]: {message}")

def log_call(self, log_message):
self.custom_print(log_message)
2 changes: 0 additions & 2 deletions pyinstaller.py

This file was deleted.

6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
pyserial>=3.5
python-dotenv>=1.0.0
colorama>=0.4.6
requests>=2.31.0
pyserial==3.5
pyserial-asyncio==0.6
54 changes: 54 additions & 0 deletions testing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import math
import time
import serial
import serial.tools.list_ports

#--- bridge config ---#

# enable HTTP requests, be careful only using with programs you trust!
ENABLE_HTTP = False

#---------------------#


def find_serial_port():
while True:
time.sleep(0.2)
ports = list(serial.tools.list_ports.comports())
for port in ports:
if "USB Serial Device" in port.description or "TI-84" in port.description:
return port


if __name__ == "__main__":
serial_port = find_serial_port()
time.sleep(2)
serial_connection = serial.Serial(serial_port.device, 115200, timeout=0.2)
serial_connection.write(b"BRIDGE_CONNECTED\n")
username = ""
while True:
data = serial_connection.readline()
if data:
decoded_data = data.decode(errors='ignore').strip()
if decoded_data == "CONNECT_TCP":
print("Connect to TCP server")
serial_connection.write(b"TCP_CONNECTED\n")
elif decoded_data.startswith("LOGIN:"):
login_data = decoded_data.replace("LOGIN:", "").split(":", 2)
# hides the key from the console
login_data[2] = login_data[2][:4] + ("*" * 50) + login_data[2][-4:]
username = login_data[1]
print(f"Login data: {login_data}")
serial_connection.write(b"LOGIN_SUCCESS\n")
elif decoded_data == "BRIDGE_PING":
serial_connection.write(b"BRIDGE_PONG\n")
elif decoded_data.startswith("RTC_CHAT:"):
chat_data = decoded_data.replace("RTC_CHAT:", "").split(":", 1)
print(f"Chat data: {chat_data}")
recipient, message = chat_data
chat_broadcast_str = f"RTC_CHAT:{recipient}:{math.floor(time.time())}:{username}:{message}"
serial_connection.write(chat_broadcast_str.encode())
time.sleep(2)
serial_connection.write(b"RTC_CHAT:global:0:testuser:long message that should be parsed entirely..")
else:
print(decoded_data)
Loading
Loading