예제 #1
0
def download(id):
    #URLが正しいか判定
    meta = fs_data.get_data(id)
    if meta is None: return msd('パラメータが不正です')
    #ダウンロードページを表示
    return render_template('info.html',
                           meta=meta,
                           mode='download',
                           url=request.host_url + 'download_go/' + id)
예제 #2
0
def download_go(id):
    # URLが正しいか再び判定
    meta = fs_data.get_data(id)
    print(meta['count'])
    if meta is None: return msg('パラメータが不正です。')
    # パスワードの確認
    pw = request.form.get('pw', '')
    if pw != meta['pw']: return msg('パスワードが違います。')
    # ダウンロード回数確認
    meta['count'] = meta['count'] - 1
    fs_data.set_data(id, meta)
    if meta['count'] < 0:
        return msg('ダウンロード回数を超えました。')
    # ダウンロード期限を確認
    if meta['time_limit'] < time.time():
        return msg('ダウンロード期限が過ぎています。')
    # ダウンロードできるようにファイルを送信
    return send_file(meta['path'], as_attachment=True, attachment_filename=meta['filename'])
예제 #3
0
def download_go(id):
    meta = fs_data.get_data(id)
    if meta is None:
        return msg('パラメータが不正です')
    
    pw = request.form.get('pw', '')
    if pw != meta['pw']:
        return msg('パスワードが違います')
    
    meta['count'] = meta['count'] -1
    if meta['count'] < 0:
        return msg('ダウンロード回数を超えました')
    fs_data.set_data(id, meta)
    
    if meta['time_limit'] < time.time():
        return msg('ダウンロードの期限が過ぎています')

    return send_file(meta['path'], as_attachment=True, attachment_filename=meta['filename'])
예제 #4
0
def download_go(id):
    # URLが正しいか再び判定 --- (*10)
    meta = fs_data.get_data(id)
    if meta is None: return msg('パラメータが不正です')
    # パスワードの確認 --- (*11)
    pw = request.form.get('pw', '')
    if pw != meta['pw']: return msg('パスワードが違います')
    # ダウンロード回数の確認 --- (*12)
    meta['count'] = meta['count'] - 1
    if meta['count'] < 0:
        return msg('ダウンロード回数を超えました。')
    fs_data.set_data(id, meta)
    # ダウンロード期限の確認 --- (*13)
    if meta['time_limit'] < time.time():
        return msg('ダウンロードの期限が過ぎています')
    # ダウンロードできるようにファイルを送信 --- (*14)
    return send_file(meta['path'],
                     as_attachment=True,
                     attachment_filename=meta['filename'])
예제 #5
0
def download_go(id):
    #URLが正しいか判定
    meta = fs_data.get_data(id)
    if meta is None: return msg('パラメータが不正です')
    #パスワードの確認
    pw = request.form.get('pw', '')
    print(pw, meta['pw'])  #テスト
    if pw != meta['pw']: return msg('パスワードが違います')
    #ダウンロード回数の制限
    meta['count'] -= 1
    if meta['count'] < 0:
        return msg('ダウンロード回数を超えました')
    fs_data.set_data(id, meta)
    #ダウンロード期限の確認
    if meta['time_limit'] < time.time():
        return msg('ダウンロードの期限過ぎています')
    #ダウンロードができるようにファイルを送信
    return send_file(meta['path'],
                     as_attachment=True,
                     attachment_filename=meta['filename'])
예제 #6
0
def download(id):
    meta = fs_data.get_data(id)
    if meta is None:
        return msg('パラメータが不正です')
    return render_template('info.html', meta=meta, mode='download',
                           url=request.host_url + 'download_go/' + id)