Help with Replit DB proxy

import os
import flask
import requests

app = flask.Flask(__name__)
sess = requests.Session()

required_repl_id = "https://replit.com/@Idkwhttph/Train-The-Chatbot?v=1"  # Replace with the desired Repl ID

@app.route("/", defaults={"path": ""}, methods=["GET", "POST", "DELETE"])
@app.route("/<path:path>", methods=["GET", "POST", "DELETE"])
def proxy(path):
  if os.environ['REPL_OWNER'] == 'Idkwhttph':
    repl_id = "https://replit.com/@Idkwhttph/Train-The-Chatbot?v=1"
  else:
    repl_id = f'https://replit.com/@Idkwhttph/{os.environ["REPL_SLUG"]}?v=1'

    if repl_id != required_repl_id:
        while True:
          try:
            exit()
          except:
            exit()


  if repl_id!= required_repl_id:
    while True:
      try:
        exit()
      except:
        exit()
  else:

      url = os.environ["REPLIT_DB_URL"]
      if flask.request.path != "/":
          url += flask.request.path
  
      req = requests.Request(
          flask.request.method,
          url,
          data=flask.request.form,
          params=flask.request.args
      ).prepare()
      resp = sess.send(req)
  
      proxy_resp = flask.make_response(resp.text)
      proxy_resp.status_code = resp.status_code
      for k, v in resp.headers.items():
          proxy_resp.headers[k] = v
  
      return proxy_resp

# Uncomment this to run:

app.run("0.0.0.0")

I am trying to make my database secure while also syncing with all the players. But there is a catch…

When I fork the repl and add keys to the database in an alt acc. It lets them access the database and add keys and rewrite them… I don’t know what to do! Can you help me?

???

don’t need this as you exit

there’s nothing you can do
there is literally nothing you can do
until Replit fixes Repl Identity
or if you have the cycles make the proxy private

also please be consistent with your "s and 's

3 Likes

Alright then. Looks like I have to scrap some of my projects, thank you.

or use a cli auth solution (I know grimsteel made one )(

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.