Example #1
0
def setCode():
    if request.method=='POST':
        tj_code=request.form.get('tj_code','')
        headCode=request.form.get('headCode','')
        footCode=request.form.get('footCode','')
        cssCode=request.form.get('cssCode','')
        #redis
        set('tj_code',tj_code)
        set('headCode',headCode)
        set('footCode',footCode)
        set('cssCode',cssCode)
        # reload()
        rd.set('tj_code',tj_code)
        rd.set('headCode',headCode)
        rd.set('footCode',footCode)
        rd.set('cssCode',cssCode)
        flash('更新成功')
        resp=make_response(render_template('admin/setCode/setCode.html'))
        resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
        resp.headers['Pragma'] = 'no-cache'
        resp.headers['Expires'] = '0'
        return resp
    resp=make_response(render_template('admin/setCode/setCode.html'))
    resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
    resp.headers['Pragma'] = 'no-cache'
    resp.headers['Expires'] = '0'
    return resp
Example #2
0
def panage():
    if request.method == 'POST':
        ####网盘信息处理
        for k, v in request.form.to_dict().items():
            if 'share_path' in k or 'other_name' in k:
                user = re.findall('\[(.*?)\]', k)[0]
                key = re.findall('(.*)\[', k)[0]
                print('setting {}\'s {}\'s value {}'.format(user, key, v))
                set(key, v, user)
        config_path = os.path.join(config_dir, 'config.py')
        with open(config_path, 'r') as f:
            text = f.read()
        rd.set('users', re.findall('od_users=([\w\W]*})', text)[0])
        flash('更新成功')
        return render_template('admin/pan_manage/pan_manage.html')
    return render_template('admin/pan_manage/pan_manage.html')
Example #3
0
def panage():
    if request.method=='POST':
        ####网盘信息处理
        for k,v in request.form.to_dict().items():
            if 'share_path' in k or 'other_name' in k:
                user=re.findall('\[(.*?)\]',k)[0]
                key=re.findall('(.*)\[',k)[0]
                print('setting {}\'s {}\'s value {}'.format(user,key,v))
                set(key,v,user)
        config_path=os.path.join(config_dir,'config.py')
        with open(config_path,'r') as f:
            text=f.read()
        rd.set('users',re.findall('od_users=([\w\W]*})',text)[0])
        flash('更新成功')
        resp=make_response(render_template('admin/pan_manage/pan_manage.html'))
        resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
        resp.headers['Pragma'] = 'no-cache'
        resp.headers['Expires'] = '0'
        return resp
    resp=make_response(render_template('admin/pan_manage/pan_manage.html'))
    resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
    resp.headers['Pragma'] = 'no-cache'
    resp.headers['Expires'] = '0'
    return resp
Example #4
0
def setCode():
    if request.method == 'POST':
        tj_code = request.form.get('tj_code', '')
        headCode = request.form.get('headCode', '')
        footCode = request.form.get('footCode', '')
        cssCode = request.form.get('cssCode', '')
        #redis
        set('tj_code', tj_code)
        set('headCode', headCode)
        set('footCode', footCode)
        set('cssCode', cssCode)
        # reload()
        rd.set('tj_code', tj_code)
        rd.set('headCode', headCode)
        rd.set('footCode', footCode)
        rd.set('cssCode', cssCode)
        flash('更新成功')
        return render_template('admin/setCode/setCode.html')
    return render_template('admin/setCode/setCode.html')
Example #5
0
def setting():
    if request.method == 'POST':
        title = request.form.get('title', 'PyOne')
        downloadUrl_timeout = request.form.get('downloadUrl_timeout', 5 * 60)
        allow_site = request.form.get('allow_site', 'no-referrer')
        ARIA2_HOST = request.form.get('ARIA2_HOST', 'localhost').replace(
            'https://', '').replace('http://', '')
        ARIA2_PORT = request.form.get('ARIA2_PORT', 6800)
        ARIA2_SECRET = request.form.get('ARIA2_SECRET', '')
        ARIA2_SCHEME = request.form.get('ARIA2_SCHEME', 'http')
        password1 = request.form.get('password1')
        password2 = request.form.get('password2')
        show_secret = request.form.get('show_secret', 'no')
        encrypt_file = request.form.get('encrypt_file', 'no')
        new_password = password
        if ((password1 is not None and password2 is None)
                or (password1 is None and password2 is not None)):
            flash(u'请输入新密码或者二次确认新密码')
        elif password1 is not None and password2 is not None and password1 != password2:
            flash(u'两次输入密码不相同')
        elif password1 is not None and password2 is not None and password1 == password2 and password1 != '':
            new_password = password1
        set('title', title)
        set('downloadUrl_timeout', downloadUrl_timeout)
        set('allow_site', allow_site)
        set('ARIA2_HOST', ARIA2_HOST)
        set('ARIA2_PORT', ARIA2_PORT)
        set('ARIA2_SECRET', ARIA2_SECRET)
        set('ARIA2_SCHEME', ARIA2_SCHEME)
        set('show_secret', show_secret)
        set('encrypt_file', encrypt_file)
        set('password', new_password)
        # reload()
        rd.set('title', title)
        rd.set('downloadUrl_timeout', downloadUrl_timeout)
        rd.set('allow_site', ','.join(allow_site.split(',')))
        rd.set('ARIA2_HOST', ARIA2_HOST)
        rd.set('ARIA2_PORT', ARIA2_PORT)
        rd.set('ARIA2_SECRET', ARIA2_SECRET)
        rd.set('ARIA2_SCHEME', ARIA2_SCHEME)
        rd.set('show_secret', show_secret)
        rd.set('encrypt_file', encrypt_file)
        rd.set('password', new_password)
        flash('更新成功')
        return render_template('admin/setting/setting.html')
    return render_template('admin/setting/setting.html')
Example #6
0
def setting():
    if request.method == 'POST':
        title = request.form.get('title', 'PyOne')
        downloadUrl_timeout = request.form.get('downloadUrl_timeout', 5 * 60)
        allow_site = request.form.get('allow_site', 'no-referrer')
        tj_code = request.form.get('tj_code', '')
        ARIA2_HOST = request.form.get('ARIA2_HOST', 'localhost').replace(
            'https://', '').replace('http://', '')
        ARIA2_PORT = request.form.get('ARIA2_PORT', 6800)
        ARIA2_SECRET = request.form.get('ARIA2_SECRET', '')
        ARIA2_SCHEME = request.form.get('ARIA2_SCHEME', 'http')
        password1 = request.form.get('password1')
        password2 = request.form.get('password2')
        new_password = password
        if ((password1 is not None and password2 is None)
                or (password1 is None and password2 is not None)):
            flash(u'请输入新密码或者二次确认新密码')
        elif password1 is not None and password2 is not None and password1 != password2:
            flash(u'两次输入密码不相同')
        elif password1 is not None and password2 is not None and password1 == password2 and password1 != '':
            new_password = password1
        set('title', title)
        set('downloadUrl_timeout', downloadUrl_timeout)
        set('allow_site', allow_site)
        set('tj_code', tj_code)
        set('ARIA2_HOST', ARIA2_HOST)
        set('ARIA2_PORT', ARIA2_PORT)
        set('ARIA2_SECRET', ARIA2_SECRET)
        set('ARIA2_SCHEME', ARIA2_SCHEME)
        set('password', new_password)
        ####网盘信息处理
        for k, v in request.form.to_dict().items():
            if 'share_path' in k or 'other_name' in k:
                user = re.findall('\[(.*?)\]', k)[0]
                key = re.findall('(.*)\[', k)[0]
                print('setting {}\'s {}\'s value {}'.format(user, key, v))
                set(key, v, user)
        # reload()
        rd.set('title', title)
        rd.set('tj_code', tj_code)
        rd.set('downloadUrl_timeout', downloadUrl_timeout)
        rd.set('allow_site', ','.join(allow_site.split(',')))
        rd.set('ARIA2_HOST', ARIA2_HOST)
        rd.set('ARIA2_PORT', ARIA2_PORT)
        rd.set('ARIA2_SECRET', ARIA2_SECRET)
        rd.set('ARIA2_SCHEME', ARIA2_SCHEME)
        rd.set('password', new_password)
        config_path = os.path.join(config_dir, 'config.py')
        with open(config_path, 'r') as f:
            text = f.read()
        rd.set('users', re.findall('od_users=([\w\W]*})', text)[0])
        flash('更新成功')
        return render_template('admin/setting.html')
    return render_template('admin/setting.html')
Example #7
0
def setting():
    if request.method=='POST':
        title=request.form.get('title','PyOne')
        theme=request.form.get('theme','material')
        title_pre=request.form.get('title_pre','index of ')
        downloadUrl_timeout=request.form.get('downloadUrl_timeout',5*60)
        allow_site=request.form.get('allow_site','no-referrer')
        ARIA2_HOST=request.form.get('ARIA2_HOST','localhost').replace('https://','').replace('http://','')
        ARIA2_PORT=request.form.get('ARIA2_PORT',6800)
        ARIA2_SECRET=request.form.get('ARIA2_SECRET','')
        ARIA2_SCHEME=request.form.get('ARIA2_SCHEME','http')
        password1=request.form.get('password1')
        password2=request.form.get('password2')
        show_secret=request.form.get('show_secret','no')
        encrypt_file=request.form.get('encrypt_file','no')
        new_password=password
        if ((password1 is not None and password2 is None) or (password1 is None and password2 is not None)):
            flash(u'请输入新密码或者二次确认新密码')
        elif password1 is not None and password2 is not None and password1!=password2:
            flash(u'两次输入密码不相同')
        elif password1 is not None and password2 is not None and password1==password2 and password1!='':
            new_password=password1
        set('title',title)
        set('title_pre',title_pre)
        set('theme',theme)
        set('downloadUrl_timeout',downloadUrl_timeout)
        set('allow_site',allow_site)
        set('ARIA2_HOST',ARIA2_HOST)
        set('ARIA2_PORT',ARIA2_PORT)
        set('ARIA2_SECRET',ARIA2_SECRET)
        set('ARIA2_SCHEME',ARIA2_SCHEME)
        set('show_secret',show_secret)
        set('encrypt_file',encrypt_file)
        set('password',new_password)
        # reload()
        rd.set('title',title)
        rd.set('title_pre',title_pre)
        rd.set('theme',theme)
        rd.set('downloadUrl_timeout',downloadUrl_timeout)
        rd.set('allow_site',','.join(allow_site.split(',')))
        rd.set('ARIA2_HOST',ARIA2_HOST)
        rd.set('ARIA2_PORT',ARIA2_PORT)
        rd.set('ARIA2_SECRET',ARIA2_SECRET)
        rd.set('ARIA2_SCHEME',ARIA2_SCHEME)
        rd.set('show_secret',show_secret)
        rd.set('encrypt_file',encrypt_file)
        rd.set('password',new_password)
        flash('更新成功')
        resp=make_response(render_template('admin/setting/setting.html'))
        resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
        resp.headers['Pragma'] = 'no-cache'
        resp.headers['Expires'] = '0'
        return resp
    resp=make_response(render_template('admin/setting/setting.html'))
    resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
    resp.headers['Pragma'] = 'no-cache'
    resp.headers['Expires'] = '0'
    return resp