Compare commits
No commits in common. "a9f763c6493ba422fb6219f304851014834eb54a" and "0985bd3073b2fd3746d24bd0dd803798a42f7213" have entirely different histories.
a9f763c649
...
0985bd3073
@ -31,31 +31,6 @@ jobs:
|
||||
run: |
|
||||
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-api:$(cat version.txt)
|
||||
|
||||
build-redirector:
|
||||
runs-on: [runner]
|
||||
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: https://github.com/actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build docker
|
||||
run: |
|
||||
cd api
|
||||
docker build -f dockerfile_redirector -t git.sh-edraft.de/sh-edraft.de/open-redirect-redirector:$(cat ../version.txt) .
|
||||
|
||||
- name: Login to registry git.sh-edraft.de
|
||||
uses: https://github.com/docker/login-action@v1
|
||||
with:
|
||||
registry: git.sh-edraft.de
|
||||
username: ${{ secrets.CI_USERNAME }}
|
||||
password: ${{ secrets.CI_ACCESS_TOKEN }}
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-redirector:$(cat version.txt)
|
||||
|
||||
build-web:
|
||||
runs-on: [runner]
|
||||
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
||||
|
@ -3,14 +3,10 @@ FROM python:3.12.8-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./src/api/ ./api
|
||||
COPY ./src/core/ ./core
|
||||
COPY ./src/data/ ./data
|
||||
COPY ./src/service/ ./service
|
||||
|
||||
COPY ./src/static/ ./static
|
||||
COPY ./src/templates/ ./templates
|
||||
|
||||
COPY ./src/redirector.py .
|
||||
COPY ./src/redirector .
|
||||
|
||||
|
@ -13,4 +13,4 @@ fi
|
||||
|
||||
export PYTHONPATH=./:$PYTHONPATH
|
||||
|
||||
python3.12 -u main.py
|
||||
python3.12 main.py
|
||||
|
@ -13,4 +13,4 @@ fi
|
||||
|
||||
export PYTHONPATH=./:$PYTHONPATH
|
||||
|
||||
python3.12 -u redirector.py
|
||||
python3.12 redirector.py
|
||||
|
@ -40,8 +40,6 @@ async def _handle_request(path: str):
|
||||
return await _handle_short_url(path, short_url)
|
||||
|
||||
if short_url.loading_screen:
|
||||
await _track_visit(short_url)
|
||||
|
||||
return render_template(
|
||||
"redirect.html",
|
||||
key=short_url.short_url,
|
||||
@ -55,11 +53,6 @@ async def _handle_short_url(path: str, short_url: ShortUrl):
|
||||
if path.startswith("api/"):
|
||||
path = path.replace("api/", "")
|
||||
|
||||
await _track_visit(short_url)
|
||||
|
||||
return _do_redirect(short_url.target_url)
|
||||
|
||||
async def _track_visit(short_url: ShortUrl):
|
||||
try:
|
||||
await shortUrlVisitDao.create(
|
||||
ShortUrlVisit(0, short_url.id, request.headers.get("User-Agent"))
|
||||
@ -67,6 +60,9 @@ async def _track_visit(short_url: ShortUrl):
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to update short url {short_url.short_url} with error", e)
|
||||
|
||||
return _do_redirect(short_url.target_url)
|
||||
|
||||
|
||||
async def _find_short_url_by_url(url: str) -> ShortUrl:
|
||||
return await shortUrlDao.find_single_by({ShortUrl.short_url: url})
|
||||
|
||||
|
@ -1 +1 @@
|
||||
1.0.4
|
||||
0.3.1
|
Loading…
Reference in New Issue
Block a user