mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
unfinished work
This commit is contained in:
parent
4b5fde06cb
commit
c09631786f
3 changed files with 16 additions and 22 deletions
|
@ -5,13 +5,16 @@ import royalnet as r
|
||||||
import royalherald as rh
|
import royalherald as rh
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import keyring
|
import keyring
|
||||||
|
import starlette
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option("--telegram/--no-telegram", default=None,
|
@click.option("--telegram/--no-telegram", default=None,
|
||||||
help="Enable/disable the Telegram module.")
|
help="Enable/disable the Telegram bot.")
|
||||||
@click.option("--discord/--no-discord", default=None,
|
@click.option("--discord/--no-discord", default=None,
|
||||||
help="Enable/disable the Discord module.")
|
help="Enable/disable the Discord bot.")
|
||||||
|
@click.option("--webserver/--no-webserver", default=None,
|
||||||
|
help="Enable/disable the Web server.")
|
||||||
@click.option("-d", "--database", type=str, default=None,
|
@click.option("-d", "--database", type=str, default=None,
|
||||||
help="The PostgreSQL database path.")
|
help="The PostgreSQL database path.")
|
||||||
@click.option("-p", "--packs", type=str, multiple=True, default=[],
|
@click.option("-p", "--packs", type=str, multiple=True, default=[],
|
||||||
|
@ -26,6 +29,7 @@ import keyring
|
||||||
help="Print all possible debug information.")
|
help="Print all possible debug information.")
|
||||||
def run(telegram: typing.Optional[bool],
|
def run(telegram: typing.Optional[bool],
|
||||||
discord: typing.Optional[bool],
|
discord: typing.Optional[bool],
|
||||||
|
webserver: typing.Optional[bool],
|
||||||
database: typing.Optional[str],
|
database: typing.Optional[str],
|
||||||
packs: typing.Tuple[str],
|
packs: typing.Tuple[str],
|
||||||
network_address: typing.Optional[str],
|
network_address: typing.Optional[str],
|
||||||
|
@ -42,7 +46,8 @@ def run(telegram: typing.Optional[bool],
|
||||||
# Enable / Disable interfaces
|
# Enable / Disable interfaces
|
||||||
interfaces = {
|
interfaces = {
|
||||||
"telegram": telegram,
|
"telegram": telegram,
|
||||||
"discord": discord
|
"discord": discord,
|
||||||
|
"webserver": webserver
|
||||||
}
|
}
|
||||||
# If any interface is True, then the undefined ones should be False
|
# If any interface is True, then the undefined ones should be False
|
||||||
if any(interfaces[name] is True for name in interfaces):
|
if any(interfaces[name] is True for name in interfaces):
|
||||||
|
@ -129,6 +134,9 @@ def run(telegram: typing.Optional[bool],
|
||||||
daemon=True)
|
daemon=True)
|
||||||
discord_process.start()
|
discord_process.start()
|
||||||
|
|
||||||
|
if interfaces["webserver"]:
|
||||||
|
...
|
||||||
|
|
||||||
click.echo("Royalnet processes have been started. You can force-quit by pressing Ctrl+C.")
|
click.echo("Royalnet processes have been started. You can force-quit by pressing Ctrl+C.")
|
||||||
if server_process is not None:
|
if server_process is not None:
|
||||||
server_process.join()
|
server_process.join()
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
"""The production Royalnet available at ryg.steffo.eu ."""
|
|
||||||
|
|
||||||
import os
|
|
||||||
from royalnet.web import create_app
|
|
||||||
from royalnet.web.royalprints import *
|
|
||||||
|
|
||||||
|
|
||||||
class TestConfig:
|
|
||||||
DB_PATH = os.environ["DB_PATH"]
|
|
||||||
TG_AK = os.environ["TG_AK"]
|
|
||||||
SITE_NAME = "Royalnet"
|
|
||||||
|
|
||||||
|
|
||||||
app = create_app(TestConfig, [rp_home, rp_wikiview, rp_tglogin, rp_docs, rp_wikiedit, rp_mcstatus, rp_diarioview,
|
|
||||||
rp_profile, rp_login])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app.run()
|
|
5
royalnet/web/star.py
Normal file
5
royalnet/web/star.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import starlette
|
||||||
|
|
||||||
|
|
||||||
|
class Star:
|
||||||
|
...
|
Loading…
Reference in a new issue