示例#1
0
def acess(dire, filename):
    valida = load_token(request.cookies.get('token', '0'))

    if (dire in ['csslogin', 'jslogin']):
        return static_file(filename, root='../frontend/' + dire)
    if (dire in ['css', 'js']):
        if (valida):
            return static_file(filename, root='../frontend/' + dire)
        else:
            return '<b>Acess Denied, go to <a href="http://127.0.0.1:8080/index.html">Login</a></b>!'
示例#2
0
def log_in(login=None,
           password=None,
           twofactor_handler=None,
           captcha_handler=None,
           logout=False):

    global api

    if logout:
        api = None
        _save_token(token='')
        return False

    token = load_token()

    session_params = {
        'auth_handler': twofactor_handler,
        'captcha_handler': captcha_handler,
        'app_id': '6045412',
        'scope': '70660',  # messages, status, photos, offline
        'api_version': '5.69'
    }

    if login and password:
        session_params['login'] = login
        session_params['password'] = password

        session = vk.VkApi(**session_params)
        session.auth(reauth=True)

        api = session.get_api()

        _save_token()
    else:
        if not token:
            raise Exception('No token')

        session_params['token'] = token

        session = vk.VkApi(**session_params)

        if not session.check_token():
            return False

        api = session.get_api()

    return True
示例#3
0
import discord
from discord.ext import commands
from utils import load_paywalls, load_token
from librarian import Librarian
from rando import Creeper, Utes, RateLimiter
from wordle import Wordle
from collector import Collector

if __name__ == "__main__":
    """local resource loads"""
    # load paywalled sites
    paywalled_sites = load_paywalls()
    # load bot token
    token = load_token()
    """bot instantiation"""
    # creates discord bot object (with member intents enabled to grab members)
    intents = discord.Intents.default()
    intents.members = True
    bot = commands.Bot(intents=intents,
                       command_prefix="!",
                       case_insensitive=True)
    # add command cogs to bot
    bot.add_cog(Librarian(paywalled_sites))  # archive is commands and listener
    bot.add_cog(RateLimiter())  # gripe at sal and aj when they fight
    bot.add_cog(Utes())  # calc and gif
    bot.add_cog(Creeper(bot))  # listen to say weird things
    bot.add_cog(Wordle(bot))  # calculate wordle stats
    bot.add_cog(Collector(bot))  # aggregate yee data
    # run the bot
    bot.run(token)
示例#4
0
def main():
    global TOKEN
    if TOKEN == '':
        TOKEN = load_token()
    client.run(TOKEN)
示例#5
0
def send_css(filename):
    token = request.cookies.get('token', '0')
    if load_token(token):
        return static_file(filename, root='../frontend')
    else:
        return '<b>Acess Denied, go to <a href="http://127.0.0.1:8080/index.html">Login</a></b>!'