merge openwebrx-admin into openwebrx
This commit is contained in:
parent
6ad3a80fc6
commit
71b0fa968b
@ -6,7 +6,7 @@
|
||||
- Added support for demodulating M17 digital voice signals using m17-cxx-demod
|
||||
- New reporting infrastructure, allowing WSPR and FST4W spots to be sent to wsprnet.org
|
||||
- Add some basic filtering capabilities to the map
|
||||
- New command-line tool `openwebrx-admin` that facilitates the administration of users
|
||||
- New arguments to the `openwebrx` command-line to facilitate the administration of users (try `openwebrx admin`)
|
||||
- Default bandwidth changes:
|
||||
- "WFM" changed to 150kHz
|
||||
- "Packet" (APRS) changed to 12.5kHz
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -10,6 +10,8 @@ openwebrx (0.21.0) UNRELEASED; urgency=low
|
||||
* New reporting infrastructure, allowing WSPR and FST4W spots to be sent to
|
||||
wsprnet.org
|
||||
* Add some basic filtering capabilities to the map
|
||||
* New arguments to the `openwebrx` command-line to facilitate the
|
||||
administration of users (try `openwebrx admin`)
|
||||
* New command-line tool `openwebrx-admin` that facilitates the
|
||||
administration of users
|
||||
* Default bandwidth changes:
|
||||
|
3
debian/openwebrx.config
vendored
3
debian/openwebrx.config
vendored
@ -1,7 +1,8 @@
|
||||
#!/bin/sh -e
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
if ! openwebrx-admin --silent hasuser admin; then
|
||||
db_get openwebrx/admin_user_configured
|
||||
if [ "${RET}" != true ]; then
|
||||
db_input high openwebrx/admin_user_password || true
|
||||
db_go
|
||||
fi
|
||||
|
4
debian/openwebrx.postinst
vendored
4
debian/openwebrx.postinst
vendored
@ -26,10 +26,12 @@ case "$1" in
|
||||
db_get openwebrx/admin_user_password
|
||||
if [ ! -z "${RET}" ]; then
|
||||
# create initial openwebrx user
|
||||
OWRX_PASSWORD="${RET}" openwebrx-admin --noninteractive adduser admin
|
||||
OWRX_PASSWORD="${RET}" openwebrx admin --noninteractive adduser admin
|
||||
fi
|
||||
# remove password from debconf database
|
||||
db_unregister openwebrx/admin_user_password
|
||||
# set a marker that admin is configured to avoid future questions
|
||||
db_set openwebrx/admin_user_configured true
|
||||
;;
|
||||
*)
|
||||
echo "postinst called with unknown argument '$1'" 1>&2
|
||||
|
4
debian/openwebrx.templates
vendored
4
debian/openwebrx.templates
vendored
@ -11,6 +11,6 @@ Description: OpenWebRX "admin" user password:
|
||||
empty for now. You can return to this prompt at a later time by running the
|
||||
command "sudo dpkg-reconfigure openwebrx".
|
||||
.
|
||||
You can also use the "openwebrx-admin" command to create, delete or manage
|
||||
You can also use the "openwebrx admin" command to create, delete or manage
|
||||
existing users. More information is available in by running the command
|
||||
"openwebrx-admin --help".
|
||||
"openwebrx admin --help".
|
@ -17,8 +17,8 @@ if [[ ! -f /etc/openwebrx/openwebrx.conf ]] ; then
|
||||
cp openwebrx.conf /etc/openwebrx/
|
||||
fi
|
||||
if [[ ! -z "${OPENWEBRX_ADMIN_USER:-}" ]] && [[ ! -z "${OPENWEBRX_ADMIN_PASSWORD:-}" ]] ; then
|
||||
if ! python3 openwebrx-admin.py --silent hasuser "${OPENWEBRX_ADMIN_USER}" ; then
|
||||
OWRX_PASSWORD="${OPENWEBRX_ADMIN_PASSWORD}" python3 openwebrx-admin.py --noninteractive adduser "${OPENWEBRX_ADMIN_USER}"
|
||||
if ! python3 openwebrx.py admin --silent hasuser "${OPENWEBRX_ADMIN_USER}" ; then
|
||||
OWRX_PASSWORD="${OPENWEBRX_ADMIN_PASSWORD}" python3 openwebrx.py admin --noninteractive adduser "${OPENWEBRX_ADMIN_USER}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from owrxadmin.__main__ import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -10,7 +10,9 @@ from owrx.websocket import WebSocketConnection
|
||||
from owrx.reporting import ReportingEngine
|
||||
from owrx.version import openwebrx_version
|
||||
from owrx.audio.queue import DecoderQueue
|
||||
from owrx.admin import add_admin_parser, run_admin_action
|
||||
import signal
|
||||
import argparse
|
||||
|
||||
import logging
|
||||
|
||||
@ -31,6 +33,26 @@ def handleSignal(sig, frame):
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="OpenWebRX - Open Source SDR Web App for Everyone!")
|
||||
parser.add_argument("-v", "--version", action="store_true", help="Show the software version")
|
||||
|
||||
moduleparser = parser.add_subparsers(title="Modules", dest="module")
|
||||
adminparser = moduleparser.add_parser("admin", help="OpenWebRX admin actions")
|
||||
add_admin_parser(adminparser)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.version:
|
||||
print("OpenWebRX version {version}".format(version=openwebrx_version))
|
||||
elif args.module == "admin":
|
||||
# override loglevel for admin commands, they shouldn't be that verbose
|
||||
logging.basicConfig(level=logging.INFO, force=True)
|
||||
run_admin_action(adminparser, args)
|
||||
else:
|
||||
start_receiver()
|
||||
|
||||
|
||||
def start_receiver():
|
||||
print(
|
||||
"""
|
||||
|
||||
|
@ -1,16 +1,10 @@
|
||||
from owrx.version import openwebrx_version
|
||||
from owrxadmin.commands import NewUser, DeleteUser, ResetPassword, ListUsers, DisableUser, EnableUser, HasUser
|
||||
import argparse
|
||||
from owrx.admin.commands import NewUser, DeleteUser, ResetPassword, ListUsers, DisableUser, EnableUser, HasUser
|
||||
import sys
|
||||
import traceback
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(title="Commands", dest="command")
|
||||
def add_admin_parser(moduleparser):
|
||||
subparsers = moduleparser.add_subparsers(title="Commands", dest="command")
|
||||
|
||||
adduser_parser = subparsers.add_parser("adduser", help="Add a new user")
|
||||
adduser_parser.add_argument("user", help="Username to be added")
|
||||
@ -40,17 +34,12 @@ def main():
|
||||
hasuser_parser.add_argument("user", help="Username to be checked")
|
||||
hasuser_parser.set_defaults(cls=HasUser)
|
||||
|
||||
parser.add_argument("-v", "--version", action="store_true", help="Show the software version")
|
||||
parser.add_argument(
|
||||
moduleparser.add_argument(
|
||||
"--noninteractive", action="store_true", help="Don't ask for any user input (useful for automation)"
|
||||
)
|
||||
parser.add_argument("--silent", action="store_true", help="Ignore errors (useful for automation)")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.version:
|
||||
print("OpenWebRX Admin CLI version {version}".format(version=openwebrx_version))
|
||||
sys.exit(0)
|
||||
moduleparser.add_argument("--silent", action="store_true", help="Ignore errors (useful for automation)")
|
||||
|
||||
def run_admin_action(parser, args):
|
||||
if hasattr(args, "cls"):
|
||||
command = args.cls()
|
||||
else:
|
||||
@ -67,3 +56,4 @@ def main():
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
4
setup.py
4
setup.py
@ -24,13 +24,13 @@ setup(
|
||||
"owrx.config",
|
||||
"owrx.reporting",
|
||||
"owrx.audio",
|
||||
"owrx.admin",
|
||||
"csdr",
|
||||
"htdocs",
|
||||
"owrxadmin",
|
||||
]
|
||||
),
|
||||
package_data={"htdocs": [f[len("htdocs/") :] for f in glob("htdocs/**/*", recursive=True)]},
|
||||
entry_points={"console_scripts": ["openwebrx=owrx.__main__:main", "openwebrx-admin=owrxadmin.__main__:main"]},
|
||||
entry_points={"console_scripts": ["openwebrx=owrx.__main__:main"]},
|
||||
url="https://www.openwebrx.de/",
|
||||
author="Jakob Ketterl",
|
||||
author_email="jakob.ketterl@gmx.de",
|
||||
|
Loading…
Reference in New Issue
Block a user