Compare commits

..

No commits in common. "master" and "3.1.0" have entirely different histories.

5 changed files with 11 additions and 73 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash
VERSION=3.2.0
VERSION=3.1.0
dpkg-deb --root-owner-group -b debian "foodoord_${VERSION}_all.deb"

View File

@ -1,5 +1,5 @@
Package: foodoord
Version: 3.2.0
Version: 3.0.4
Maintainer: Bandie <bandie@chaospott.de>
Architecture: all
Description: Control the doors of the club, ja!

View File

@ -2,8 +2,3 @@
status_url =
key =
secret =
[doorstatusv2]
status_url =
key =
secret =

View File

@ -10,7 +10,6 @@ import subprocess
import sys
import time
from configparser import ConfigParser
from dataclasses import dataclass
import pifacedigitalio
@ -33,46 +32,18 @@ ORANGE = 3
parser = ConfigParser()
parser.read('/etc/foodoord.conf')
@dataclass
class API:
api_url: str
consumer_key: str
consumer_secret: str
APIv1 = API(
parser.get('doorstatus', 'status_url'),
parser.get('doorstatus', 'key'),
parser.get('doorstatus', 'secret'),
)
APIv2 = API(
parser.get('doorstatusv2', 'status_url'),
parser.get('doorstatusv2', 'key'),
parser.get('doorstatusv2', 'secret'),
)
DOORAPI = parser.get('doorstatus', 'status_url')
CONSUMERKEY = parser.get('doorstatus', 'key')
CONSUMERSECRET = parser.get('doorstatus', 'secret')
def update_api(locked):
try:
# API v1
subprocess.check_call([
"/usr/bin/curl", "-XPOST",
"--header", "Content-Type: application/json",
"--data",
json.dumps({"consumer_key": APIv1.consumer_key, "consumer_secret": APIv1.consumer_secret, "aerie": locked}),
APIv1.api_url
])
except:
pass
try:
# API v2
subprocess.check_call([
"/usr/bin/curl", "-XPOST",
"--header", "Content-Type: application/json",
"--data",
json.dumps({"consumer_key": APIv2.consumer_key, "consumer_secret": APIv2.consumer_secret, "aerie": locked}),
APIv2.api_url
json.dumps({"consumer_key": CONSUMERKEY, "consumer_secret": CONSUMERSECRET, "aerie": locked})
])
except:
pass

View File

@ -8,7 +8,6 @@ import stat
import subprocess
import time
from configparser import ConfigParser
from dataclasses import dataclass
import RPi.GPIO as gpio
@ -32,24 +31,9 @@ ORANGE = 3
parser = ConfigParser()
parser.read('/etc/foodoord.conf')
@dataclass
class API:
api_url: str
consumer_key: str
consumer_secret: str
APIv1 = API(
parser.get('doorstatus', 'status_url'),
parser.get('doorstatus', 'key'),
parser.get('doorstatus', 'secret'),
)
APIv2 = API(
parser.get('doorstatusv2', 'status_url'),
parser.get('doorstatusv2', 'key'),
parser.get('doorstatusv2', 'secret'),
)
DOORAPI = parser.get('doorstatus', 'status_url')
CONSUMERKEY = parser.get('doorstatus', 'key')
CONSUMERSECRET = parser.get('doorstatus', 'secret')
def write_state(state):
@ -62,24 +46,12 @@ def write_state(state):
def update_api(locked):
try:
# API v1
subprocess.check_call([
"/usr/bin/curl", "-XPOST",
"--header", "Content-Type: application/json",
"--data",
json.dumps({"consumer_key": APIv1.consumer_key, "consumer_secret": APIv1.consumer_secret, "cellar": locked}),
APIv1.api_url
])
except:
pass
try:
# API v2
subprocess.check_call([
"/usr/bin/curl", "-XPOST",
"--header", "Content-Type: application/json",
"--data",
json.dumps({"consumer_key": APIv2.consumer_key, "consumer_secret": APIv2.consumer_secret, "cellar": locked}),
APIv2.api_url
json.dumps({"consumer_key": CONSUMERKEY, "consumer_secret": CONSUMERSECRET, "cellar": locked}),
DOORAPI
])
except:
pass