|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
from os import makedirs
|
|
|
|
|
from os import makedirs, getenv
|
|
|
|
|
from random import choice
|
|
|
|
|
|
|
|
|
|
import lorem
|
|
|
|
|
from flask import Blueprint
|
|
|
|
|
|
|
|
|
|
from suchwow._models import db, User, Post, AuditEvent, TipSent, TipReceived, Vote
|
|
|
|
@ -19,6 +21,36 @@ def init():
|
|
|
|
|
# init db
|
|
|
|
|
db.create_tables([User, Post, AuditEvent, TipSent, TipReceived, Vote])
|
|
|
|
|
|
|
|
|
|
@bp.cli.command('generate_data')
|
|
|
|
|
def generate_data():
|
|
|
|
|
if getenv('FLASK_DEBUG', 0) == '1':
|
|
|
|
|
users = ['lza_menace', 'wowario', 'jwinterm', 'dsc', 'asymptotically']
|
|
|
|
|
for user in users:
|
|
|
|
|
moderator = False
|
|
|
|
|
if not User.select().where(User.username == user):
|
|
|
|
|
if user == 'lza_menace':
|
|
|
|
|
moderator = True
|
|
|
|
|
User.create(
|
|
|
|
|
username=user,
|
|
|
|
|
moderator=moderator
|
|
|
|
|
)
|
|
|
|
|
print(f'Created user {user}')
|
|
|
|
|
|
|
|
|
|
for i in range(1, 5):
|
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
|
address_idx, address = wallet.new_address(config.WALLET_ACCOUNT)
|
|
|
|
|
wallet.store()
|
|
|
|
|
Post.create(
|
|
|
|
|
title=lorem.sentence(),
|
|
|
|
|
text=lorem.sentence(),
|
|
|
|
|
user=choice(list(User.select())),
|
|
|
|
|
image_name='test.jpg',
|
|
|
|
|
account_index=config.WALLET_ACCOUNT,
|
|
|
|
|
address_index=address_idx,
|
|
|
|
|
address=address
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.cli.command('rescan')
|
|
|
|
|
def rescan():
|
|
|
|
|