def login_page(): try: auth, user_id = RGUIController.do_auth() if auth is False: return RGUIController.ui_render_template("login.html") else: return redirect(url_for('RGBlog.auto_blog_page')) except: return RGUIController.ui_render_template("login.html")
def video_view_page(user_file_id): if is_int_number(user_file_id): user_file_id = int(user_file_id) auth, user_id = RGUIController.do_auth() if not auth: return redirect(url_for('login_page')) if user_file_id == -1 or files.user_file_info( user_id=user_id, id=user_file_id, type=1) is not None: code = RGRequestHelp.did_encode(user_file_id, user_id) return redirect( url_for('RGFileUpDown.play_list_page', user_id_directory_id=code)) return RGUIController.ui_render_template('VideoPreview.html')
def user_file_path_get(user_file_id, path): if user_file_id is None: return jsonify(form_res(RGResCode.lack_param)) user_file_id = re.sub("[^A-Za-z0-9].*", "", user_file_id) if not is_int_number(user_file_id): return jsonify(form_res(RGResCode.lack_param)) auth, user_id = RGUIController.do_auth() session.removeVaryCookie = True file = files.user_file_info(user_id=user_id, id=user_file_id, type=0) if path is not None: file['filename'] = file['filename'] + '/' + path file['name'] = path.split('/')[-1] del file['mime'] return __get_file_stream(file, max_age=86400)
def apple_icon(): try: auth, user_id = RGUIController.do_auth() if auth is True: from Model import user filename = user.get_user_icon_name(user_id) if filename: return RGFileUpDownApp.handle_download_file(filename=filename) return send_file("RGIgnoreConfig/apple-icon.png", mimetype='image/png', cache_timeout=0) except: return send_file("RGIgnoreConfig/apple-icon.png", mimetype='image/png', cache_timeout=0)
def home_page(art_user_id): t = get_data_with_request(request) page = t['page'] if 'page' in t else 0 size = t['size'] if 'size' in t else 10 auth, view_user_id = RGUIController.do_auth() arts, page_count, now_page, page_size, count, re_relation = article.page_list( other_id=view_user_id, art_user_id=art_user_id, page=page, size=size) t = { "list": arts, "pageCount": page_count, "pageSize": page_size, "nowPage": now_page, "count": count, "home": user.isHome(view_user_id, art_user_id), } return RGUIController.ui_render_template("home.html", **t)
def edit_blog_page_render(art_id): auth, user_id = RGUIController.do_auth() if auth is True: if art_id is not None: art = article.art_detail(user_id, art_id) if art is None: return redirect(url_for('RGBlog.new_blog_page')) a_user_id = art['user_id'] if a_user_id == user_id: return RGUIController.ui_render_template( "edit_blog.html", **{ 'art': art, "user": user.get_user(user_id), }) return redirect(url_for('RGBlog.new_blog_page')) else: return RGUIController.ui_render_template("login.html")
def art_detail(art_id): auth, user_id = RGUIController.do_auth() art = article.art_detail(user_id, art_id) if art is not None: a_user_id = art['user_id'] _user = user.get_user(a_user_id) home = a_user_id == user_id if home is False: collect_read_count(art_id=art_id, user_id=user_id) else: _user = None home = False return RGUIController.ui_render_template( "blog_page.html", **{ 'art': art, 'flag': art is not None, 'home': home, "user": _user, "authed": auth, })
def blog_view_page(other_id): if is_int_number(other_id): auth, view_user_id = RGUIController.do_auth() return blog_view_page_render(view_user_id, other_id) else: return redirect(url_for('RGBlog.auto_blog_view_page'))
def blog_page(other_id): if is_int_number(other_id): auth, view_user = RGUIController.do_auth() return blog_page_render(other_id, view_user) return redirect(url_for('login_page'))
def photos_page(other_id, album_id): if is_int_number(other_id) and is_int_number(album_id): auth, user_id = RGUIController.do_auth() return photos_page_render(user_id, other_id, album_id) return redirect(url_for('login_page'))
def photo_page(other_id): if is_int_number(other_id): auth, user_id = RGUIController.do_auth() return photo_page_render(user_id, other_id) else: return redirect(url_for('RGPhoto.auto_photo_page'))
def play_list_page(user_id_directory_id): auth, user_id = RGUIController.do_auth() if not auth: return redirect(url_for('login_page')) return RGUIController.ui_render_template('VideoPreview.html')