Beispiel #1
0
def addHTTP():
    form = HTTPForm()
    types = current_user.getallcomm()
    form.frpc.choices = types
    if form.validate_on_submit():
        proxy = FrpProxy_HTTP(
            name=form.name.data,
            local_ip=form.local_ip.data,
            local_port=form.local_port.data,
            use_encryption=form.use_encryption.data,
            use_compression=form.use_compression.data,
            http_user=form.http_user.data,
            http_pwd=form.http_pwd.data,
            subdomain=form.subdomain.data,
            custom_domains=form.custom_domains.data,
            locations=form.locations.data,
            host_header_rewrite=form.host_header_rewrite.data,
            servcomm=FrpServiceCommon.query.filter_by(
                id=int(form.frpc.data)).first(),
            webuser=current_user)
        db.session.add(proxy)
        db.session.commit()
        return redirect(url_for("manage.index"))
    if form.errors:
        return 'err'
    return render_template('user/addForm.html', form=form)
Beispiel #2
0
def addPluginUnixSocket():
    form = PluginUnixSocketForm()
    types = current_user.getallcomm()
    form.frpc.choices = types
    if form.validate_on_submit():
        proxy = FrpProxy_PluginUnixSocket(
            name=form.name.data,
            remote_port=form.remote_port.data,
            plugin_unix_path=form.plugin_unix_path.data,
            servcomm=FrpServiceCommon.query.filter_by(
                id=int(form.frpc.data)).first(),
            webuser=current_user)
        db.session.add(proxy)
        db.session.commit()
        return redirect(url_for("manage.index"))
    if form.errors:
        return 'err'
    return render_template('user/addForm.html', form=form)
Beispiel #3
0
def addstcp():
    form = stcpForm()
    types = current_user.getallcomm()
    form.frpc.choices = types
    if form.validate_on_submit():
        proxy = FrpProxy_STCP(name=form.name.data,
                              sk=form.sk.data,
                              local_ip=form.local_ip.data,
                              local_port=form.local_port.data,
                              use_encryption=form.use_encryption.data,
                              use_compression=form.use_compression.data,
                              servcomm=FrpServiceCommon.query.filter_by(
                                  id=int(form.frpc.data)).first(),
                              webuser=current_user)
        db.session.add(proxy)
        db.session.commit()
        return redirect(url_for("manage.index"))
    if form.errors:
        return 'err'
    return render_template('user/addForm.html', form=form)