mirror of
https://github.com/markqvist/lxmf_messageboard.git
synced 2024-10-01 02:25:36 -04:00
removed redis dependency, now uses umsgpack
This commit is contained in:
parent
1869c21b36
commit
f30399f04f
@ -1,21 +1,41 @@
|
|||||||
#!/bin/python3
|
#!/bin/python3
|
||||||
import time
|
import time
|
||||||
import redis
|
import os
|
||||||
r = redis.Redis(db=2, decode_responses=True)
|
import RNS.vendor.umsgpack as msgpack
|
||||||
|
|
||||||
print('`!`F222`Bddd`cSolarExpress Message Board')
|
message_board_peer = 'b4812e4f193420b1763f8f5fa31fbc29'
|
||||||
|
userdir = os.path.expanduser("~")
|
||||||
|
|
||||||
|
if os.path.isdir("/etc/nomadmb") and os.path.isfile("/etc/nomadmb/config"):
|
||||||
|
configdir = "/etc/nomadmb"
|
||||||
|
elif os.path.isdir(userdir+"/.config/nomadmb") and os.path.isfile(userdir+"/.config/nomadmb/config"):
|
||||||
|
configdir = userdir+"/.config/nomadmb"
|
||||||
|
else:
|
||||||
|
configdir = userdir+"/.nomadmb"
|
||||||
|
|
||||||
|
storagepath = configdir+"/storage"
|
||||||
|
if not os.path.isdir(storagepath):
|
||||||
|
os.makedirs(storagepath)
|
||||||
|
|
||||||
|
boardpath = configdir+"/storage/board"
|
||||||
|
|
||||||
|
print('`!`F222`Bddd`cNomadNet Message Board')
|
||||||
|
|
||||||
print('-')
|
print('-')
|
||||||
print('`a`b`f')
|
print('`a`b`f')
|
||||||
print("")
|
print("")
|
||||||
print("To add a message to the board just converse with the SolarExpress Message Board at <ad713cd3fedf36cc190f0cb89c4be1ff>, peers are assigned a unique username")
|
print("To add a message to the board just converse with the NomadNet Message Board at `[lxmf@{}]".format(message_board_peer))
|
||||||
print("Built with Python and Redis")
|
|
||||||
time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
|
time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
|
||||||
print("Last Updated: {}".format(time_string))
|
print("Last Updated: {}".format(time_string))
|
||||||
print("")
|
print("")
|
||||||
print('>Messages')
|
print('>Messages')
|
||||||
print(" Date Time Username Message")
|
print(" Date Time Username Message")
|
||||||
for i in range(0, r.llen('message_board_general')):
|
f = open(boardpath, "rb")
|
||||||
message_content = r.lindex('message_board_general', i)
|
board_contents = msgpack.unpack(f)
|
||||||
print("`a{}".format(message_content))
|
board_contents.reverse()
|
||||||
|
|
||||||
|
for content in board_contents:
|
||||||
|
print("`a{}".format(content.rstrip()))
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user