Compare commits
36 Commits
support-tl
...
master
Author | SHA1 | Date |
---|---|---|
dsc | e44818bdc6 | 2 months ago |
dsc | 9bcec54dfd | 2 months ago |
dsc | 154cefff7b | 2 months ago |
dsc | 1c1cd62454 | 9 months ago |
dsc | 9fc50acd8f | 9 months ago |
dsc | e410bd9f15 | 9 months ago |
dsc | 8b8fb1a7d4 | 9 months ago |
dsc | 7e07546c66 | 1 year ago |
wowario | 0a05a421c8 | 1 year ago |
dsc | c7b187ebf1 | 2 years ago |
dsc | 5a807ba755 | 2 years ago |
dsc | 7faf59c31d | 2 years ago |
dsc | 56714c7411 | 2 years ago |
dsc | 5cf04fd60c | 2 years ago |
dsc | 58c72e8c76 | 2 years ago |
dsc | 7e64dcd133 | 2 years ago |
dsc | c3138a6fb3 | 2 years ago |
dsc | 0619522bb1 | 2 years ago |
dsc | e79059820f | 2 years ago |
dsc | d9f3ea2343 | 2 years ago |
Sander | 35e2815c94 | 2 years ago |
dsc | e431c90a21 | 3 years ago |
qvqc | 609bc69725 | 3 years ago |
wowario | 98b36d0c6f | 3 years ago |
dsc | 70d574e7e1 | 3 years ago |
wowario | 400b4c5414 | 3 years ago |
dsc | 8e1c33ff3e | 3 years ago |
wowario | ed952c1ec5 | 3 years ago |
dsc | 0f82b1420e | 3 years ago |
wowario | 37642ca6a3 | 3 years ago |
dsc | 947f34da0f | 3 years ago |
wowario | 7fc99af8b9 | 3 years ago |
dsc | d3df925902 | 3 years ago |
wowario | ba87a744f6 | 3 years ago |
wowario | 9e6c01a841 | 3 years ago |
dsc | 3347306ba6 | 3 years ago |
@ -0,0 +1,32 @@
|
|||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
# Copyright (c) 2020, The Monero Project.
|
||||||
|
# Copyright (c) 2020, dsc@xmr.pm
|
||||||
|
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from typing import List
|
||||||
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
import settings
|
||||||
|
from wowlet_backend.utils import httpget
|
||||||
|
from wowlet_backend.tasks import WowletTask
|
||||||
|
|
||||||
|
|
||||||
|
class ForumThreadsTask(WowletTask):
|
||||||
|
"""Fetch recent forum threads."""
|
||||||
|
def __init__(self, interval: int = 300):
|
||||||
|
from wowlet_backend.factory import app
|
||||||
|
super(ForumThreadsTask, self).__init__(interval)
|
||||||
|
|
||||||
|
self._cache_key = "forum"
|
||||||
|
self._cache_expiry = self.interval * 10
|
||||||
|
|
||||||
|
# url
|
||||||
|
self._http_endpoint = "https://forum.wownero.com/latest.json"
|
||||||
|
|
||||||
|
self._websocket_cmd = "forum"
|
||||||
|
|
||||||
|
async def task(self):
|
||||||
|
from wowlet_backend.factory import app
|
||||||
|
|
||||||
|
blob = await httpget(self._http_endpoint, json=True)
|
||||||
|
return blob
|
@ -0,0 +1,62 @@
|
|||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
# Copyright (c) 2020, The Monero Project.
|
||||||
|
# Copyright (c) 2020, dsc@xmr.pm
|
||||||
|
|
||||||
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
import settings
|
||||||
|
from wowlet_backend.utils import httpget
|
||||||
|
from wowlet_backend.tasks import WowletTask
|
||||||
|
|
||||||
|
|
||||||
|
class WowletReleasesTask(WowletTask):
|
||||||
|
"""Fetches the latest Wowlet releases using gitea's API"""
|
||||||
|
def __init__(self, interval: int = 3600):
|
||||||
|
super(WowletReleasesTask, self).__init__(interval)
|
||||||
|
|
||||||
|
self._cache_key = "wowlet_releases"
|
||||||
|
self._cache_expiry = self.interval
|
||||||
|
|
||||||
|
self._websocket_cmd = "wowlet_releases"
|
||||||
|
|
||||||
|
self._http_endpoint = "https://git.wownero.com/api/v1/repos/wowlet/wowlet/releases?limit=1"
|
||||||
|
|
||||||
|
async def task(self) -> dict:
|
||||||
|
blob = await httpget(self._http_endpoint)
|
||||||
|
if not isinstance(blob, list) or not blob:
|
||||||
|
raise Exception(f"Invalid JSON response for {self._http_endpoint}")
|
||||||
|
|
||||||
|
blob = blob[0]
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
for asset in blob['assets']:
|
||||||
|
operating_system = "linux"
|
||||||
|
if "msvc" in asset['name'] or "win64" in asset['name'] or "windows" in asset['name']:
|
||||||
|
operating_system = "windows"
|
||||||
|
elif "macos" in asset["name"]:
|
||||||
|
operating_system = "macos"
|
||||||
|
|
||||||
|
data[operating_system] = {
|
||||||
|
"name": asset["name"],
|
||||||
|
"created_at": parse(asset["created_at"]).strftime("%Y-%m-%d"),
|
||||||
|
"url": asset['browser_download_url'],
|
||||||
|
"download_count": asset["download_count"],
|
||||||
|
"size": asset['size']
|
||||||
|
}
|
||||||
|
|
||||||
|
tag = blob['tag_name']
|
||||||
|
if tag.startswith("v"):
|
||||||
|
tag = tag[1:]
|
||||||
|
|
||||||
|
try:
|
||||||
|
t = [int(z) for z in tag.split(".")]
|
||||||
|
if len(t) != 3:
|
||||||
|
raise Exception()
|
||||||
|
except:
|
||||||
|
raise Exception(f"invalid tag: {tag}")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"assets": data,
|
||||||
|
"body": blob['body'],
|
||||||
|
"version": tag
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
# Copyright (c) 2022, The Monero Project.
|
||||||
|
# Copyright (c) 2022, dsc@xmr.pm
|
||||||
|
|
||||||
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
import settings
|
||||||
|
from wowlet_backend.utils import httpget
|
||||||
|
from wowlet_backend.tasks import WowletTask
|
||||||
|
|
||||||
|
|
||||||
|
class WownerodTask(WowletTask):
|
||||||
|
"""Fetches the latest Wownerod releases using gitea's API"""
|
||||||
|
def __init__(self, interval: int = 3600):
|
||||||
|
super(WownerodTask, self).__init__(interval)
|
||||||
|
|
||||||
|
self._cache_key = "wownerod_releases"
|
||||||
|
self._cache_expiry = self.interval
|
||||||
|
|
||||||
|
self._websocket_cmd = "wownerod_releases"
|
||||||
|
|
||||||
|
self._http_endpoint = "https://git.wownero.com/api/v1/repos/wownero/wownero/releases?limit=1"
|
||||||
|
|
||||||
|
async def task(self) -> dict:
|
||||||
|
blob = await httpget(self._http_endpoint)
|
||||||
|
if not isinstance(blob, list) or not blob:
|
||||||
|
raise Exception(f"Invalid JSON response for {self._http_endpoint}")
|
||||||
|
|
||||||
|
blob = blob[0]
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
for asset in blob['assets']:
|
||||||
|
operating_system = "linux"
|
||||||
|
if "w64" in asset['name'] or "msvc" in asset['name'] or "win64" in asset['name'] or "windows" in asset['name']:
|
||||||
|
operating_system = "windows"
|
||||||
|
elif "macos" in asset["name"] or "apple" in asset["name"]:
|
||||||
|
operating_system = "macos"
|
||||||
|
|
||||||
|
data.setdefault(operating_system, [])
|
||||||
|
data[operating_system].append({
|
||||||
|
"name": asset["name"],
|
||||||
|
"created_at": parse(asset["created_at"]).strftime("%Y-%m-%d"),
|
||||||
|
"url": asset['browser_download_url'],
|
||||||
|
"download_count": asset["download_count"],
|
||||||
|
"size": asset['size']
|
||||||
|
})
|
||||||
|
|
||||||
|
tag = blob['tag_name']
|
||||||
|
if tag.startswith("v"):
|
||||||
|
tag = tag[1:]
|
||||||
|
|
||||||
|
return {
|
||||||
|
"version": tag,
|
||||||
|
"assets": data
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
# Copyright (c) 2022, The Monero Project.
|
||||||
|
# Copyright (c) 2022, dsc@xmr.pm
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
import settings
|
||||||
|
from wowlet_backend.utils import httpget
|
||||||
|
from wowlet_backend.tasks import WowletTask
|
||||||
|
|
||||||
|
|
||||||
|
class YellWowTask(WowletTask):
|
||||||
|
"""Fetches yellwowpages usernames/addresses"""
|
||||||
|
def __init__(self, interval: int = 3600):
|
||||||
|
super(YellWowTask, self).__init__(interval)
|
||||||
|
|
||||||
|
self._cache_key = "yellwow"
|
||||||
|
self._cache_expiry = self.interval * 10
|
||||||
|
|
||||||
|
self._websocket_cmd = "yellwow"
|
||||||
|
|
||||||
|
self._http_endpoint = "https://yellow.wownero.com/api/user/"
|
||||||
|
|
||||||
|
async def task(self) -> List[dict]:
|
||||||
|
blob = await httpget(self._http_endpoint)
|
||||||
|
if not isinstance(blob, list) or not blob:
|
||||||
|
raise Exception(f"Invalid JSON response for {self._http_endpoint}")
|
||||||
|
return blob
|
@ -0,0 +1,26 @@
|
|||||||
|
import re, sys, os
|
||||||
|
from datetime import datetime
|
||||||
|
import time
|
||||||
|
|
||||||
|
from wowlet_backend.factory import broadcast
|
||||||
|
|
||||||
|
HISTORY = []
|
||||||
|
|
||||||
|
|
||||||
|
async def add_chat(message: str, balance: float = 0):
|
||||||
|
global HISTORY
|
||||||
|
item = {
|
||||||
|
"message": message,
|
||||||
|
"balance": balance,
|
||||||
|
"date": int(time.time())
|
||||||
|
}
|
||||||
|
|
||||||
|
HISTORY.append(item)
|
||||||
|
if len(HISTORY) >= 25:
|
||||||
|
HISTORY = HISTORY[:25]
|
||||||
|
|
||||||
|
await broadcast.put({
|
||||||
|
"cmd": "trollEntry",
|
||||||
|
"data": item
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in new issue