Example #1
0
 def share(self, file):
     file = walker.get_path(file)
     s = URLSafeTimedSerializer(current_app.config['SECRET_KEY'])
     share_code = s.dumps({'file': str(file.relative())})
     if request.args.get('modal', 'false') == 'true':
         return render_template('tree/share_modal.html', file=file, share_code=share_code)
     return render_template('tree/share.html', file=file, share_code=share_code)
Example #2
0
 def download(self, file):
     file = walker.get_path(file)
     return send_file(file.path.__str__(), as_attachment=True, attachment_filename=file.name)
Example #3
0
 def view(self, file, share=False):
     file = walker.get_path(file)
     if file.suffix in ['.mkv', '.mp4', '.avi', '.mp3']:
         return render_template('tree/view_video.html', file=file, share=share)
     return render_template('tree/view_file.html', file=file, share=share)