Compare commits
46 Commits
Author | SHA1 | Date |
---|---|---|
|
e44818bdc6 | 3 months ago |
|
9bcec54dfd | 3 months ago |
|
154cefff7b | 3 months ago |
|
1c1cd62454 | 10 months ago |
|
9fc50acd8f | 10 months ago |
|
e410bd9f15 | 10 months ago |
|
8b8fb1a7d4 | 10 months ago |
|
7e07546c66 | 1 year ago |
|
0a05a421c8 | 1 year ago |
|
c7b187ebf1 | 2 years ago |
|
5a807ba755 | 2 years ago |
|
7faf59c31d | 2 years ago |
|
56714c7411 | 2 years ago |
|
5cf04fd60c | 2 years ago |
|
58c72e8c76 | 2 years ago |
|
7e64dcd133 | 2 years ago |
|
c3138a6fb3 | 2 years ago |
|
0619522bb1 | 2 years ago |
|
e79059820f | 2 years ago |
|
d9f3ea2343 | 2 years ago |
|
35e2815c94 | 2 years ago |
|
e431c90a21 | 3 years ago |
|
609bc69725 | 3 years ago |
|
98b36d0c6f | 3 years ago |
|
70d574e7e1 | 3 years ago |
|
400b4c5414 | 3 years ago |
|
8e1c33ff3e | 3 years ago |
|
ed952c1ec5 | 3 years ago |
|
0f82b1420e | 3 years ago |
|
37642ca6a3 | 3 years ago |
|
947f34da0f | 3 years ago |
|
7fc99af8b9 | 3 years ago |
|
d3df925902 | 3 years ago |
|
ba87a744f6 | 3 years ago |
|
9e6c01a841 | 3 years ago |
|
3347306ba6 | 3 years ago |
|
24aeec9824 | 3 years ago |
|
a0bd7573ff | 3 years ago |
|
99684ac55b | 3 years ago |
|
625758e428 | 3 years ago |
|
891baaff71 | 3 years ago |
|
136e7909fa | 3 years ago |
|
140789d830 | 3 years ago |
|
fcf5f3b114 | 3 years ago |
|
e1432bb50a | 3 years ago |
|
e7c3a843ec | 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