Compare commits
187
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da4b86f4d3 | ||
|
|
b5ef38bc0d | ||
|
|
c5b7e9dcde | ||
|
|
b611d41e8a | ||
|
|
c3ba43b0fa | ||
|
|
dc0e006e0f | ||
|
|
0b66858969 | ||
|
|
16c8fba623 | ||
|
|
852fccd95c | ||
|
|
316d07db61 | ||
|
|
bf99f618f6 | ||
|
|
534f0cb7cb | ||
|
|
974f6820d4 | ||
|
|
6ccf910e29 | ||
|
|
d05a3e2dc6 | ||
|
|
8be8b44584 | ||
|
|
4a028c04c9 | ||
|
|
1f1d7ab75d | ||
|
|
e0e5d9e290 | ||
|
|
181eb67501 | ||
|
|
8af976c528 | ||
|
|
beba1f16b4 | ||
|
|
76d0cbdb8d | ||
|
|
6ff0bb31d3 | ||
|
|
e78825b99f | ||
|
|
33a9d6fec7 | ||
|
|
b01145e6bd | ||
|
|
06024c82c1 | ||
|
|
ce4a4838f1 | ||
|
|
f80cfbeba7 | ||
|
|
61e5966083 | ||
|
|
f49a606693 | ||
|
|
2b866b32bb | ||
|
|
97896b5170 | ||
|
|
3647ff15e1 | ||
|
|
267f753452 | ||
|
|
c33e463e09 | ||
|
|
40cfc3c9f5 | ||
|
|
632ba5257e | ||
|
|
7127effdaf | ||
|
|
ca3f7e964e | ||
|
|
904e779b59 | ||
|
|
63054b4a3a | ||
|
|
871f3c5ba8 | ||
|
|
9c706bb9b1 | ||
|
|
06c57ca837 | ||
|
|
39a3ec055b | ||
|
|
401cf8e1a7 | ||
|
|
f50d624d22 | ||
|
|
4aeee1acb5 | ||
|
|
b6a9cfed19 | ||
|
|
a67dcf763b | ||
|
|
0f58c2dcae | ||
|
|
9cb1418b0d | ||
|
|
f62e6ca651 | ||
|
|
0c6ddd4904 | ||
|
|
14d4dbfe97 | ||
|
|
50d0c2cd4d | ||
|
|
4fe45169c3 | ||
|
|
78d93a16eb | ||
|
|
b94bf528be | ||
|
|
11ad57bce4 | ||
|
|
495a55f8c1 | ||
|
|
c611360c04 | ||
|
|
ada418374b | ||
|
|
3bf7f2a195 | ||
|
|
2d22cab6e7 | ||
|
|
96dcbe1798 | ||
|
|
ac6dc5b426 | ||
|
|
b4f22ffeea | ||
|
|
ca3ed630ed | ||
|
|
e2d3868a9e | ||
|
|
47314620be | ||
|
|
f26f3f2665 | ||
|
|
938b37e920 | ||
|
|
2c5a989306 | ||
|
|
88a6dd9316 | ||
|
|
77742c1d6f | ||
|
|
ba16c6475a | ||
|
|
1735098b3a | ||
|
|
2fdaaa47ab | ||
|
|
bd4e4aed27 | ||
|
|
94a8240ad4 | ||
|
|
be03af61ea | ||
|
|
4da34c98f3 | ||
|
|
12253f0621 | ||
|
|
369954f5d2 | ||
|
|
4eee702dce | ||
|
|
e90daa2e61 | ||
|
|
cc8570d02f | ||
|
|
98e5ea965c | ||
|
|
7a98ab1c6d | ||
|
|
70973a63fb | ||
|
|
ad82f73c1d | ||
|
|
e08016c103 | ||
|
|
a65e99b199 | ||
|
|
4853150f07 | ||
|
|
a341e66c13 | ||
|
|
874779d230 | ||
|
|
779e8a8b0f | ||
|
|
8f35e88ce4 | ||
|
|
71e874cfb4 | ||
|
|
622b8942b5 | ||
|
|
7aeb7d094c | ||
|
|
4ee80f8b7e | ||
|
|
4859fa6877 | ||
|
|
a1d831cdf2 | ||
|
|
a3ee639d77 | ||
|
|
cd274aea81 | ||
|
|
aaa548eb21 | ||
|
|
99f05a055d | ||
|
|
e614d50f9c | ||
|
|
20526c829c | ||
|
|
c9ed33f108 | ||
|
|
4d728c8e68 | ||
|
|
ef3aed4ba2 | ||
|
|
8f30fdb88c | ||
|
|
d4b67906cd | ||
|
|
075fa32ea2 | ||
|
|
f71f678662 | ||
|
|
457857df32 | ||
|
|
49adc84f5c | ||
|
|
a2a9a8c3a0 | ||
|
|
a62db898aa | ||
|
|
a2a6e5c5fe | ||
|
|
b9307efba2 | ||
|
|
52ccff4086 | ||
|
|
7f59856da3 | ||
|
|
10dc913080 | ||
|
|
1d2f190459 | ||
|
|
859ab9cfaf | ||
|
|
924d3dabb9 | ||
|
|
b227337ced | ||
|
|
717ffb4b8a | ||
|
|
08121fc701 | ||
|
|
460f18d85a | ||
|
|
6c34d510e5 | ||
|
|
789fc8bcbc | ||
|
|
31e72f28b0 | ||
|
|
3d0b87998d | ||
|
|
6c7b9a4ad8 | ||
|
|
f4379b07ca | ||
|
|
55364da10b | ||
|
|
e28b34b49b | ||
|
|
7ce3167d57 | ||
|
|
b0b9ae068a | ||
|
|
54349b4e8a | ||
|
|
2483e71d98 | ||
|
|
6b46873009 | ||
|
|
685a76bdd1 | ||
|
|
933a8bf3c8 | ||
|
|
e228d20d0b | ||
|
|
19ec49778e | ||
|
|
17dbe04c4b | ||
|
|
e5404fa1b9 | ||
|
|
f6506aeeca | ||
|
|
795720dcd2 | ||
|
|
85962b11a6 | ||
|
|
c1229b348e | ||
|
|
06358c4c07 | ||
|
|
fffde38fed | ||
|
|
13bfc40c6a | ||
|
|
9024a1eab6 | ||
|
|
aa851a7779 | ||
|
|
ac3d20d072 | ||
|
|
02f16516f1 | ||
|
|
c8301113e5 | ||
|
|
73fd35ad40 | ||
|
|
996ed3d776 | ||
|
|
05feced28f | ||
|
|
fe844437fb | ||
|
|
3de05c08bc | ||
|
|
e6509e0932 | ||
|
|
ce95ed4854 | ||
|
|
3bf2d553c8 | ||
|
|
b3fb490c16 | ||
|
|
5e8c2c73fd | ||
|
|
a75aabbec6 | ||
|
|
583522a422 | ||
|
|
a9b4a95e0c | ||
|
|
8b68d52be0 | ||
|
|
8f52aca2b4 | ||
|
|
744f920854 | ||
|
|
fe43d274cb | ||
|
|
53f4c17a08 | ||
|
|
f728cdafb4 | ||
|
|
21b4b9b7fb |
@@ -2,33 +2,70 @@ name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'django_testing/dockerfile'
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
container:
|
||||
image: gitea.tryton.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:1.0.6
|
||||
volumes:
|
||||
- act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default
|
||||
runs-on: host-runner
|
||||
steps:
|
||||
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
|
||||
- name: restore git folder if exist
|
||||
run: if [ -d "/opt/hostedtoolcache/${{ github.event.repository.name }}/" ]; then cp -r /opt/hostedtoolcache/${{ github.event.repository.name }}/ ${{ gitea.workspace }}; fi
|
||||
|
||||
- name: Check Docker Version
|
||||
run: whereis docker
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
clean: false
|
||||
fetch-depth: 1
|
||||
ref: 'main'
|
||||
|
||||
# - name: Manually check out repository code
|
||||
# run: cd ${{ gitea.workspace }} ; git pull origin main
|
||||
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v3
|
||||
- name: Compute next version
|
||||
id: versioning
|
||||
run: |
|
||||
latest="${{ vars.VERSION }}"
|
||||
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||
echo "next_version=$next_version" >> $GITHUB_ENV
|
||||
echo "Variables used :"
|
||||
echo "------------------------------------------------"
|
||||
echo "Next version: $next_version"
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.cache/pip
|
||||
key: pip
|
||||
restore-keys: pip
|
||||
path: /opt/hostedtoolcache/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
|
||||
- name: inject cache into docker
|
||||
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
|
||||
with:
|
||||
cache-source: /root/.cache/pip
|
||||
|
||||
cache-source: /opt/hostedtoolcache/pip
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@@ -44,15 +81,41 @@ jobs:
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
#build-contexts: pip_cache=${{steps.vars.outputs.pip-dir}}
|
||||
tags: gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
|
||||
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache
|
||||
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache,mode=max
|
||||
build-args: |
|
||||
ALLOWED_HOSTS='django.tryton.geeraert.eu'
|
||||
DEBUG='True'
|
||||
tags: |
|
||||
gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
|
||||
gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }}
|
||||
cache-from: type=local,src=/opt/hostedtoolcache/.buildx-cache
|
||||
cache-to: type=local,dest=/opt/hostedtoolcache/.buildx-cache-new,mode=max
|
||||
|
||||
- name: drop the pod to force pulling the new image
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /opt/hostedtoolcache/.buildx-cache
|
||||
mv /opt/hostedtoolcache/.buildx-cache-new /opt/hostedtoolcache/.buildx-cache
|
||||
|
||||
- name: Rollout Django to force pulling the new image
|
||||
uses: actions-hub/kubectl@master
|
||||
env:
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
with:
|
||||
args: rollout restart deployment django -n django
|
||||
|
||||
- name: Rollout Celery worker to force pulling the new image
|
||||
uses: actions-hub/kubectl@master
|
||||
env:
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
with:
|
||||
args: rollout restart deployment celery-worker -n django
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
||||
- name: update version in the variable
|
||||
run: |
|
||||
curl -X PUT -H "Content-Type: application/json" \
|
||||
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
|
||||
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION \
|
||||
-d "{\"Value\":\"$next_version\"}"
|
||||
|
||||
- name: backup git for future use
|
||||
run: cp -r ${{ gitea.workspace }} /opt/hostedtoolcache/${{ github.event.repository.name }}/
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "testing"
|
||||
paths:
|
||||
- 'django_testing/dockerfile'
|
||||
tags-ignore:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Compute next version
|
||||
id: versioning
|
||||
run: |
|
||||
latest="${{ vars.VERSION_TESTING }}"
|
||||
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||
echo "next_version=$next_version" >> $GITHUB_ENV
|
||||
echo "Variables used :"
|
||||
echo "------------------------------------------------"
|
||||
echo "Next version: $next_version"
|
||||
|
||||
|
||||
- name: Login to gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.tryton.geeraert.eu
|
||||
username: ${{ secrets.USERNAME_GITEA }}
|
||||
password: ${{ secrets.PASSWORD_GITEA }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: django_testing/
|
||||
push: true
|
||||
tags: |
|
||||
gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:latest
|
||||
gitea.tryton.geeraert.eu/pi-ux-ce/django-testing:${{ env.next_version }}
|
||||
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache
|
||||
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:buildcache,mode=max
|
||||
|
||||
- name: update version in the variable
|
||||
run: |
|
||||
curl -X PUT -H "Content-Type: application/json" \
|
||||
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
|
||||
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION_TESTING \
|
||||
-d "{\"Value\":\"$next_version\"}"
|
||||
|
||||
- name: Rollout Django to force pulling the new image
|
||||
uses: actions-hub/kubectl@master
|
||||
env:
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
with:
|
||||
args: rollout restart deployment django-testing -n django-testing
|
||||
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
@@ -0,0 +1,23 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "testing"
|
||||
tags-ignore:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
|
||||
- name: Rollout Django to force pulling the new image
|
||||
uses: actions-hub/kubectl@master
|
||||
env:
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
with:
|
||||
args: rollout restart deployment django-testing -n django-testing
|
||||
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
@@ -2,3 +2,5 @@
|
||||
*/.idea
|
||||
venv/*
|
||||
*__pycache__*
|
||||
Webcal-python/*
|
||||
.idea/*
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: django-python
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: django-webserver
|
||||
namespace: django-python
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: django-python
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: django-python
|
||||
spec:
|
||||
containers:
|
||||
- name: django-python
|
||||
image: gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: webserver-port
|
||||
volumeMounts:
|
||||
## - name: django-python-code
|
||||
# mountPath: /code
|
||||
- name: servarr-data
|
||||
mountPath: /data
|
||||
readOnly: true
|
||||
- name: secret-kubeconfig
|
||||
mountPath: /kubeconfig
|
||||
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 200Mi
|
||||
volumes:
|
||||
- name: django-python-code
|
||||
persistentVolumeClaim:
|
||||
claimName: django-python-code
|
||||
- name: servarr-data
|
||||
hostPath:
|
||||
path: /data
|
||||
- name: secret-kubeconfig
|
||||
secret:
|
||||
defaultMode: 420
|
||||
secretName: kubeconfig
|
||||
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: webserver
|
||||
namespace: django-python
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 8000
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: django-python
|
||||
@@ -0,0 +1,3 @@
|
||||
from .celery_settings import app as celery_app
|
||||
|
||||
__all__ = ("celery_app",)
|
||||
@@ -0,0 +1,8 @@
|
||||
import os
|
||||
from celery import Celery
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings')
|
||||
|
||||
app = Celery("django_code")
|
||||
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||
app.autodiscover_tasks()
|
||||
@@ -0,0 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django_hosts import patterns, host
|
||||
|
||||
host_patterns = patterns('',
|
||||
host(r"django-testing", settings.ROOT_URLCONF, name="django-testing"),
|
||||
host(r"redirect", 'website_redirection.urls', name="redirect"),
|
||||
)
|
||||
@@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
@@ -23,10 +23,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'django-insecure-71%)_#e#o9-dl2o^6mfud-*rw+4+8vy-nd*bzeier&(34ap-p9'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
#DEBUG = os.getenv("DEBUG")
|
||||
DEBUG = os.getenv("DEBUG", "False").lower() in ("true", "1", "t")
|
||||
|
||||
ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu','localhost']
|
||||
|
||||
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",")
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -38,9 +39,11 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'bootstrap5',
|
||||
'django_hosts',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django_hosts.middleware.HostsRequestMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@@ -48,15 +51,19 @@ MIDDLEWARE = [
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django_hosts.middleware.HostsResponseMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'django_code.urls'
|
||||
ROOT_HOSTCONF = 'django_code.hosts'
|
||||
DEFAULT_HOST = 'django-testing'
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
#'DIRS': ["/code/django_code/templates","/code/django_code/dashboard/templates/"],
|
||||
'DIRS': [BASE_DIR / "templates","django_code/dashboard/templates/"],
|
||||
'DIRS': [BASE_DIR / "templates","django_code/dashboard/templates/","django_code/stash_management/templates","django_code/website_redirection/templates"],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@@ -124,3 +131,11 @@ STATIC_URL = 'static/'
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
#
|
||||
# Celery settings
|
||||
CELERY_BROKER_URL = "redis://django-redis-svc:6379"
|
||||
CELERY_RESULT_BACKEND = "redis://django-redis-svc:6379"
|
||||
|
||||
CELERY_IMPORTS = [
|
||||
'stash_management.apps', # This line imports the tasks.py file
|
||||
# Add other app tasks here if needed
|
||||
]
|
||||
|
||||
@@ -24,6 +24,9 @@ from dashboard import apps as dashboardapp
|
||||
from dashboard import views as dashboardview
|
||||
from kubernetes_connection import apps as kubernetes_connection
|
||||
from stash_management import apps as stashapp
|
||||
from stash_management import views as stashview
|
||||
from website_redirection import apps as website_redirectionapp
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
# path('admin/', admin.site.urls),
|
||||
@@ -33,6 +36,15 @@ urlpatterns = [
|
||||
path('simpsons/', random_simpsons.simpsons),
|
||||
path('download_file/', random_simpsons.download_file),
|
||||
|
||||
################### Redirect ###################
|
||||
path('redirect/hello/', website_redirectionapp.hello),
|
||||
path('redirect/set/', website_redirectionapp.redirect),
|
||||
path('redirect/get/<str:key>', website_redirectionapp.display_key),
|
||||
path('redirect/go/<str:key>', website_redirectionapp.redirect_to_key),
|
||||
path('redirect/redirect-form/', website_redirectionapp.redirect_process, name='submit_form'),
|
||||
path('redirect/clearkey/', website_redirectionapp.clearkey_process, name='submit_form'),
|
||||
|
||||
|
||||
################### paperless ###################
|
||||
path('paperless/hello/', paperless_django.hello),
|
||||
# path('simpsons/', random_simpsons.simpsons),
|
||||
@@ -58,11 +70,17 @@ urlpatterns = [
|
||||
path('kubernetes_connection/scale_up/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_up),
|
||||
path('kubernetes_connection/scale_down/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_down),
|
||||
|
||||
################## kubernetes_connection#####
|
||||
################## stash#####
|
||||
path('stash/', stashview.home),
|
||||
path('stash/hello/', stashapp.hello),
|
||||
path('stash/form/', stashapp.form),
|
||||
path('stash/incremental/', stashapp.incremental),
|
||||
path('stash/album/', stashapp.album),
|
||||
path('stash/album-form/', stashapp.album_form, name='submit_form'),
|
||||
path('stash/simple/', stashapp.simple),
|
||||
path('stash/simple-form/', stashapp.simple_form, name='submit_form'),
|
||||
path('stash/submit-form/', stashapp.handle_survey_form, name='submit_form'),
|
||||
|
||||
path('stash/incremental-form/', stashapp.incremental_form, name='submit_form'),
|
||||
|
||||
# path('bookstack/', docker_connection.apps.hello),
|
||||
# path('test/', docker_connection.apps.http_call_test),
|
||||
|
||||
@@ -14,3 +14,10 @@ from django.core.wsgi import get_wsgi_application
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
https_proxy = "gluetun-svc.gluetun.svc:8888"
|
||||
|
||||
proxyDict = {
|
||||
"https" : https_proxy,
|
||||
}
|
||||
|
||||
#os.environ["PROXIES"] = proxyDict
|
||||
@@ -2,45 +2,272 @@ from django.apps import AppConfig
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import redirect
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from django.core.files import File
|
||||
from kubernetes import client, config
|
||||
from celery import shared_task
|
||||
|
||||
from lxml import html
|
||||
import requests
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
import random
|
||||
import mimetypes
|
||||
import ruamel.yaml
|
||||
import yaml
|
||||
import urllib.request
|
||||
from urllib import request as urlrequest
|
||||
from urllib import parse as urlparse
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
proxy_url = 'http://gluetun-svc.gluetun.svc:8888'
|
||||
proxy = urlrequest.ProxyHandler({
|
||||
'http': proxy_url,
|
||||
'https': proxy_url # Add the handler for HTTPS
|
||||
})
|
||||
|
||||
proxies = {
|
||||
"http" : proxy_url,
|
||||
"https" : proxy_url
|
||||
}
|
||||
|
||||
destination_folder = "/stash/"
|
||||
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello stash!</h1>')
|
||||
def form(request):
|
||||
return render(request, 'stash_form.html',{})
|
||||
def album(request):
|
||||
return render(request, 'album_form.html',{})
|
||||
def simple(request):
|
||||
return render(request, 'simple_form.html',{})
|
||||
def check_and_create_destination_folder(name):
|
||||
#check if the output directory exist and create if not
|
||||
if not os.path.isdir(destination_folder):
|
||||
os.makedirs(destination_folder)
|
||||
|
||||
#check if the named directory exist and create if not
|
||||
destination_named_folder = os.path.join(destination_folder,name)
|
||||
if not os.path.isdir(destination_named_folder):
|
||||
os.makedirs(destination_named_folder)
|
||||
|
||||
return destination_named_folder
|
||||
|
||||
def album_form(request):
|
||||
name = request.GET.get('name')
|
||||
url = request.GET.get('url')
|
||||
external_galleries = request.GET.get('external_galleries')
|
||||
|
||||
album_downloader.delay(name=name,url=url,external_galleries=external_galleries)
|
||||
|
||||
text_generated = "successfully sent to the album downloader"
|
||||
return HttpResponse(text_generated, content_type="text/plain")
|
||||
|
||||
@shared_task()
|
||||
def album_downloader(name,url,external_galleries):
|
||||
print(name+" "+url+" "+external_galleries)
|
||||
|
||||
opener = urlrequest.build_opener(proxy)
|
||||
urlrequest.install_opener(opener)
|
||||
|
||||
req = urlrequest.Request(url)
|
||||
urlcurl = urlrequest.urlopen(req).read()
|
||||
|
||||
page = requests.get(url,proxies=proxies)
|
||||
webpage = html.fromstring(page.content)
|
||||
|
||||
#create the prerequisites folder
|
||||
destination_named_folder = check_and_create_destination_folder(name=name)
|
||||
|
||||
|
||||
#get all URLs from the code source (searching for href tag on the code)
|
||||
#https://stackoverflow.com/questions/21455349/xpath-query-get-attribute-href-from-a-tag
|
||||
|
||||
webpage_all_url = webpage.xpath('//a/@href')
|
||||
|
||||
#search for the href that contains the galleries
|
||||
webpage_all_album_url = webpage.xpath("//a[contains(@href,'pornpics.com/galleries/')]/@href")
|
||||
#print(webpage_all_album_url[3])
|
||||
#print(webpage_all_album_url)
|
||||
|
||||
|
||||
for album in webpage_all_album_url:
|
||||
print("Album "+album)
|
||||
print("")
|
||||
page = requests.get(album,proxies=proxies)
|
||||
webpage = html.fromstring(page.content)
|
||||
|
||||
images_list = webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href")
|
||||
images_downloader.delay(name=name,images_url_list=images_list,destination_named_folder=destination_named_folder)
|
||||
print(images_list)
|
||||
return 0
|
||||
|
||||
@shared_task()
|
||||
def images_downloader(name,images_url_list,destination_named_folder):
|
||||
for image_url in images_url_list:
|
||||
split = urlparse.urlsplit(image_url)
|
||||
#filename = destination_folder + split.path.split("/")[-1]
|
||||
filename = os.path.join(destination_named_folder,split.path.split("/")[-1])
|
||||
|
||||
|
||||
print("downloading: "+filename+" -- "+image_url)
|
||||
|
||||
opener = urlrequest.build_opener(proxy)
|
||||
|
||||
urlrequest.install_opener(opener)
|
||||
try:
|
||||
urlrequest.urlretrieve(image_url, filename )
|
||||
except:
|
||||
print("Can't download "+filename+" -- "+image_url)
|
||||
individual_image_downloader.delay(image_url=image_url, filename=filename)
|
||||
|
||||
return 0
|
||||
|
||||
@shared_task()
|
||||
def individual_image_downloader(image_url, filename ):
|
||||
print("Downloading again: "+filename+" -- "+image_url)
|
||||
|
||||
opener = urlrequest.build_opener(proxy)
|
||||
|
||||
urlrequest.install_opener(opener)
|
||||
try:
|
||||
urlrequest.urlretrieve(image_url, filename )
|
||||
except:
|
||||
print("Still Can't download "+filename+" -- "+image_url+" == Cancelling")
|
||||
return 0
|
||||
|
||||
def simple_form(request):
|
||||
name = request.GET.get('name')
|
||||
reddit_downloader(username=name)
|
||||
|
||||
text_generated = "successfully sent to the reddit downloader"
|
||||
return HttpResponse(text_generated, content_type="text/plain")
|
||||
|
||||
def reddit_downloader(username):
|
||||
|
||||
#create the prerequisites folder
|
||||
destination_named_folder = check_and_create_destination_folder(name=username)
|
||||
|
||||
|
||||
|
||||
url = "https://www.reddit.com/user/"+username+"/submitted/.json?limit=1000"
|
||||
opener = urlrequest.build_opener(proxy)
|
||||
urlrequest.install_opener(opener)
|
||||
|
||||
req = urlrequest.Request(url)
|
||||
urlcurl = urlrequest.urlopen(req).read()
|
||||
data = json.loads(urlcurl)
|
||||
|
||||
picture_list=[]
|
||||
for children in data['data']['children']:
|
||||
print("adding to the list : "+children['data']['url'])
|
||||
picture_list.append(children['data']['url'])
|
||||
|
||||
images_downloader.delay(name=username,images_url_list=picture_list,destination_named_folder=destination_named_folder)
|
||||
|
||||
return 0
|
||||
|
||||
def redgif_donloader(username):
|
||||
#on te front page of the user , https://www.redgifs.com/users/princesspizookie
|
||||
# F12 and search network , find something that start as api.redgifs.com
|
||||
# and the file is search?order=new&count=40&type=g
|
||||
# copy as curl and you got the bearer
|
||||
|
||||
#curl curl 'https://api.redgifs.com/v2/users/princesspizookie/search?order=new&count=40&type=g'
|
||||
#and you get the URLS , needs to be parsedw
|
||||
return 0
|
||||
def incremental(request):
|
||||
return render(request, 'incremental_form.html',{})
|
||||
|
||||
def incremental_form(request):
|
||||
name = request.GET.get('name')
|
||||
url = request.GET.get('url')
|
||||
url_suffix = request.GET.get('url_suffix')
|
||||
maximum_increment = int(request.GET.get('maximum_increment'))
|
||||
minimum_increment = request.GET.get('minimum_increment')
|
||||
|
||||
increment_and_download.delay(minimum_increment=minimum_increment,maximum_increment=maximum_increment,url=url,url_suffix=url_suffix,name=name)
|
||||
|
||||
text_generated = "successfully sent to celery"
|
||||
return HttpResponse(text_generated, content_type="text/plain")
|
||||
|
||||
@shared_task()
|
||||
def increment_and_download(minimum_increment,maximum_increment,url,url_suffix,name):
|
||||
if minimum_increment == None:
|
||||
minimum_increment = 1
|
||||
|
||||
text_generated = ""
|
||||
minimum_increment = int(minimum_increment)
|
||||
maximum_increment = int(maximum_increment)
|
||||
|
||||
#check if the output directory exist and create if not
|
||||
if not os.path.isdir(destination_folder):
|
||||
os.makedirs(destination_folder)
|
||||
|
||||
#check if the named directory exist and create if not
|
||||
destination_named_folder = os.path.join(destination_folder,name)
|
||||
if not os.path.isdir(destination_named_folder):
|
||||
os.makedirs(destination_named_folder)
|
||||
|
||||
print("\n downloading for "+name+" "+url+"XXX"+url_suffix)
|
||||
|
||||
for increment in range(minimum_increment,maximum_increment):
|
||||
print("increment : "+str(increment)+"/"+str(maximum_increment))
|
||||
if len(str(increment)) == 3:
|
||||
increment_generated ='0' + str(increment)
|
||||
elif len(str(increment)) == 2:
|
||||
increment_generated ='00' + str(increment)
|
||||
elif len(str(increment)) == 1:
|
||||
increment_generated ='000' + str(increment)
|
||||
|
||||
url_generated = url+increment_generated+url_suffix
|
||||
print(url_generated)
|
||||
destination_filename = increment_generated+url_suffix
|
||||
destination_file = os.path.join(destination_named_folder,destination_filename)
|
||||
print(destination_file)
|
||||
opener = urlrequest.build_opener(proxy)
|
||||
urlrequest.install_opener(opener)
|
||||
urlrequest.urlretrieve(url_generated, destination_file )
|
||||
|
||||
text_generated = "\n downloading for "+name+" "+url+increment_generated+url_suffix
|
||||
print("download completed for "+name+" of "+str(maximum_increment)+" images")
|
||||
return text_generated
|
||||
def handle_survey_form(request):
|
||||
config.load_kube_config(config_file='/kubeconfig/config')
|
||||
v1 = client.BatchV1Api()
|
||||
name = request.GET.get('name')
|
||||
url = request.GET.get('url')
|
||||
external_galleries = request.GET.get('external_galleries')
|
||||
external_galleries = str(request.GET.get('external_galleries'))
|
||||
|
||||
stash_folder = "/stash"
|
||||
|
||||
if external_galleries:
|
||||
print("external_galleries is not null")
|
||||
performer_external_galleries = stash_folder+"/"+name+"_external_galleries.txt"
|
||||
with open(performer_external_galleries, "a") as f:
|
||||
f.write(external_galleries)
|
||||
skip_searching_gallery = True
|
||||
else:
|
||||
print("external_galleries is null")
|
||||
skip_searching_gallery = False
|
||||
|
||||
with open('django_code/stash_management/templates/template.stash-pornpics-dowloader.job.yml', 'r') as file:
|
||||
#get the manifest in a variable template_manifest from the manifest file
|
||||
template_manifest = yaml.safe_load(file)
|
||||
|
||||
#edit the container name
|
||||
template_manifest['metadata']['name'] ="stash-pornpics-dowloader"+name
|
||||
template_manifest['metadata']['name'] ="stash-pornpics-dowloader-"+name
|
||||
template_manifest['spec']['template']['spec']['containers'][0]['name'] ="stash-pornpics-dowloader-"+name
|
||||
|
||||
#edit the command based on the input
|
||||
command=['bash', '/config/download.sh', '--http_proxy', 'http://gluetun-svc.gluetun.svc:8888', '--BASE_URL', url, '--pornstars', name,'--external_gallery', external_galleries]
|
||||
command=['bash', '/config/download.sh', '--http_proxy', 'http://gluetun-svc.gluetun.svc:8888', '--BASE_URL', url, '--pornstars', name]
|
||||
template_manifest['spec']['template']['spec']['containers'][0]['command']=command
|
||||
|
||||
|
||||
#execute based on the value
|
||||
api_response = v1.create_namespaced_job(body=template_manifest,namespace='stash')
|
||||
|
||||
return HttpResponse(api_response)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Stash form</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
|
||||
<style>
|
||||
@charset "UTF-8";
|
||||
.m-b-xs {
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 10%;
|
||||
}
|
||||
|
||||
.m-t-xs {
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
.m-t-sm {
|
||||
margin-top: 5%;
|
||||
}
|
||||
|
||||
* {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 2% 0;
|
||||
background-color: #37404a;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 2.2em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#survey-form label,
|
||||
#survey-form .labels {
|
||||
display: block;
|
||||
margin-bottom: 2%;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
#survey-form input::-webkit-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input::-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-ms-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input,
|
||||
#survey-form select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
outline: none;
|
||||
border: 2px solid #333;
|
||||
}
|
||||
#survey-form input {
|
||||
margin-top: 1.5%;
|
||||
padding: 0 0 5px 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
border-bottom: 2px solid #fff;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form input:focus {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
margin: 0px 10px 0 0;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
margin: 0 10px 0 0 !important;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
-o-appearance: none;
|
||||
appearance: none;
|
||||
height: 23px;
|
||||
width: 23px;
|
||||
transition: all 0.15s ease-out 0s;
|
||||
background: #37404a;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
z-index: 1000;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
#survey-form [type=checkbox]:hover,
|
||||
#survey-form [type=radio]:hover {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:checked:before,
|
||||
#survey-form [type=radio]:checked:before {
|
||||
display: inline-block;
|
||||
height: 21px;
|
||||
width: 21px;
|
||||
position: relative;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
text-align: center;
|
||||
font-family: "Glyphicons Halflings";
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:focus,
|
||||
#survey-form [type=radio]:focus {
|
||||
outline: none;
|
||||
border-color: #fff;
|
||||
}
|
||||
#survey-form [type=radio] {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=radio]:after {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=number] {
|
||||
width: 45px;
|
||||
}
|
||||
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#survey-form select {
|
||||
height: 40px;
|
||||
padding-left: 5px;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form select option {
|
||||
padding: 5px 10px;
|
||||
font-weight: 300;
|
||||
cursor: pointer;
|
||||
}
|
||||
#survey-form select option:hover {
|
||||
background-color: #85ffc7;
|
||||
}
|
||||
#survey-form textarea {
|
||||
resize: none;
|
||||
margin-top: 2%;
|
||||
padding: 10px 10px 0px 20px;
|
||||
width: 100%;
|
||||
height: 90px;
|
||||
color: #85ffc7;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
#survey-form .btn {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 3% 0 0 0;
|
||||
height: 45px;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border: 3px solid #85ffc7;
|
||||
border-radius: 0;
|
||||
font-weight: 500;
|
||||
font-size: 1.2em;
|
||||
color: #85ffc7;
|
||||
text-align: center;
|
||||
background: none;
|
||||
transition: color 0.25s ease;
|
||||
}
|
||||
#survey-form .btn:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
background-color: #85ffc7;
|
||||
transform-origin: left;
|
||||
transition: width 0.5s ease;
|
||||
z-index: -1;
|
||||
}
|
||||
#survey-form .btn:hover {
|
||||
color: #37404a;
|
||||
}
|
||||
#survey-form .btn:hover:after {
|
||||
width: 100%;
|
||||
}
|
||||
#survey-form fieldset {
|
||||
margin: 5% 0 0 0;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.copyright i {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
padding: 8% 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<main id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
|
||||
<div class="m-b-md text-center">
|
||||
<h1 id="title">Stash Form</h1>
|
||||
<p id="description" class="description" class="text-center">Download form</p>
|
||||
</div>
|
||||
<form method="GET" action="/stash/album-form/" id="survey-form" name="survey-form">
|
||||
|
||||
<fieldset>
|
||||
<label for="name" id="name-label">
|
||||
Name *
|
||||
<input class="" type="text" id="name" name="name" placeholder="Enter your name (required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="url" id="url-label">
|
||||
URL *
|
||||
<input class="" type="url" id="url" name="url" placeholder="Enter the URL (required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="external_galleries">
|
||||
Any external galleries ?
|
||||
<textarea id="external_galleries" name="external_galleries" ></textarea>
|
||||
</label>
|
||||
</fieldset>
|
||||
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</html>
|
||||
@@ -0,0 +1,299 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Stash form</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
|
||||
<style>
|
||||
@charset "UTF-8";
|
||||
.m-b-xs {
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 10%;
|
||||
}
|
||||
|
||||
.m-t-xs {
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
.m-t-sm {
|
||||
margin-top: 5%;
|
||||
}
|
||||
|
||||
* {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 2% 0;
|
||||
background-color: #37404a;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 2.2em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#survey-form label,
|
||||
#survey-form .labels {
|
||||
display: block;
|
||||
margin-bottom: 2%;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
#survey-form input::-webkit-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input::-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-ms-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input,
|
||||
#survey-form select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
outline: none;
|
||||
border: 2px solid #333;
|
||||
}
|
||||
#survey-form input {
|
||||
margin-top: 1.5%;
|
||||
padding: 0 0 5px 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
border-bottom: 2px solid #fff;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form input:focus {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
margin: 0px 10px 0 0;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
margin: 0 10px 0 0 !important;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
-o-appearance: none;
|
||||
appearance: none;
|
||||
height: 23px;
|
||||
width: 23px;
|
||||
transition: all 0.15s ease-out 0s;
|
||||
background: #37404a;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
z-index: 1000;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
#survey-form [type=checkbox]:hover,
|
||||
#survey-form [type=radio]:hover {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:checked:before,
|
||||
#survey-form [type=radio]:checked:before {
|
||||
display: inline-block;
|
||||
height: 21px;
|
||||
width: 21px;
|
||||
position: relative;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
text-align: center;
|
||||
font-family: "Glyphicons Halflings";
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:focus,
|
||||
#survey-form [type=radio]:focus {
|
||||
outline: none;
|
||||
border-color: #fff;
|
||||
}
|
||||
#survey-form [type=radio] {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=radio]:after {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=number] {
|
||||
width: 45px;
|
||||
}
|
||||
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#survey-form select {
|
||||
height: 40px;
|
||||
padding-left: 5px;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form select option {
|
||||
padding: 5px 10px;
|
||||
font-weight: 300;
|
||||
cursor: pointer;
|
||||
}
|
||||
#survey-form select option:hover {
|
||||
background-color: #85ffc7;
|
||||
}
|
||||
#survey-form textarea {
|
||||
resize: none;
|
||||
margin-top: 2%;
|
||||
padding: 10px 10px 0px 20px;
|
||||
width: 100%;
|
||||
height: 90px;
|
||||
color: #85ffc7;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
#survey-form .btn {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 3% 0 0 0;
|
||||
height: 45px;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border: 3px solid #85ffc7;
|
||||
border-radius: 0;
|
||||
font-weight: 500;
|
||||
font-size: 1.2em;
|
||||
color: #85ffc7;
|
||||
text-align: center;
|
||||
background: none;
|
||||
transition: color 0.25s ease;
|
||||
}
|
||||
#survey-form .btn:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
background-color: #85ffc7;
|
||||
transform-origin: left;
|
||||
transition: width 0.5s ease;
|
||||
z-index: -1;
|
||||
}
|
||||
#survey-form .btn:hover {
|
||||
color: #37404a;
|
||||
}
|
||||
#survey-form .btn:hover:after {
|
||||
width: 100%;
|
||||
}
|
||||
#survey-form fieldset {
|
||||
margin: 5% 0 0 0;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.copyright i {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
padding: 8% 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<main id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
|
||||
<div class="m-b-md text-center">
|
||||
<h1 id="title">Incremental Form</h1>
|
||||
<p id="description" class="description" class="text-center">Download form</p>
|
||||
</div>
|
||||
<form method="GET" action="/stash/incremental-form/" id="survey-form" name="survey-form">
|
||||
|
||||
<fieldset>
|
||||
<label for="name" id="name-label">
|
||||
Name *
|
||||
<input class="" type="text" id="name" name="name" placeholder="Enter your name (required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="url" id="url-label">
|
||||
URL of one image before the increment *
|
||||
<input class="" type="url" id="url" name="url" placeholder="Enter the URL before the increment(required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="url_suffix" id="url_suffix-label">
|
||||
suffix URL of one image after the increment *
|
||||
<input class="" type="string" id="url_suffix" name="url_suffix" placeholder="Enter the URL suffix (Example .png)(required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="maximum_increment" id="maximum_increment_label">
|
||||
Maximum increment value *
|
||||
<input class="" type="text" id="maximum_increment" name="maximum_increment" placeholder="Enter the maximum increment(required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="Minimum_increment" id="Minimum_increment_label">
|
||||
Minimum increment value
|
||||
<input class="" type="text" id="Minimum_increment" name="Minimum_increment" placeholder="Enter the minimum increment (default 1)" />
|
||||
</label>
|
||||
</fieldset>
|
||||
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,275 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Simple form</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
|
||||
<style>
|
||||
@charset "UTF-8";
|
||||
.m-b-xs {
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 10%;
|
||||
}
|
||||
|
||||
.m-t-xs {
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
.m-t-sm {
|
||||
margin-top: 5%;
|
||||
}
|
||||
|
||||
* {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 2% 0;
|
||||
background-color: #37404a;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 2.2em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#survey-form label,
|
||||
#survey-form .labels {
|
||||
display: block;
|
||||
margin-bottom: 2%;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
#survey-form input::-webkit-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input::-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-ms-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input,
|
||||
#survey-form select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
outline: none;
|
||||
border: 2px solid #333;
|
||||
}
|
||||
#survey-form input {
|
||||
margin-top: 1.5%;
|
||||
padding: 0 0 5px 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
border-bottom: 2px solid #fff;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form input:focus {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
margin: 0px 10px 0 0;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
margin: 0 10px 0 0 !important;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
-o-appearance: none;
|
||||
appearance: none;
|
||||
height: 23px;
|
||||
width: 23px;
|
||||
transition: all 0.15s ease-out 0s;
|
||||
background: #37404a;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
z-index: 1000;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
#survey-form [type=checkbox]:hover,
|
||||
#survey-form [type=radio]:hover {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:checked:before,
|
||||
#survey-form [type=radio]:checked:before {
|
||||
display: inline-block;
|
||||
height: 21px;
|
||||
width: 21px;
|
||||
position: relative;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
text-align: center;
|
||||
font-family: "Glyphicons Halflings";
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:focus,
|
||||
#survey-form [type=radio]:focus {
|
||||
outline: none;
|
||||
border-color: #fff;
|
||||
}
|
||||
#survey-form [type=radio] {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=radio]:after {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=number] {
|
||||
width: 45px;
|
||||
}
|
||||
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#survey-form select {
|
||||
height: 40px;
|
||||
padding-left: 5px;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form select option {
|
||||
padding: 5px 10px;
|
||||
font-weight: 300;
|
||||
cursor: pointer;
|
||||
}
|
||||
#survey-form select option:hover {
|
||||
background-color: #85ffc7;
|
||||
}
|
||||
#survey-form textarea {
|
||||
resize: none;
|
||||
margin-top: 2%;
|
||||
padding: 10px 10px 0px 20px;
|
||||
width: 100%;
|
||||
height: 90px;
|
||||
color: #85ffc7;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
#survey-form .btn {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 3% 0 0 0;
|
||||
height: 45px;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border: 3px solid #85ffc7;
|
||||
border-radius: 0;
|
||||
font-weight: 500;
|
||||
font-size: 1.2em;
|
||||
color: #85ffc7;
|
||||
text-align: center;
|
||||
background: none;
|
||||
transition: color 0.25s ease;
|
||||
}
|
||||
#survey-form .btn:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
background-color: #85ffc7;
|
||||
transform-origin: left;
|
||||
transition: width 0.5s ease;
|
||||
z-index: -1;
|
||||
}
|
||||
#survey-form .btn:hover {
|
||||
color: #37404a;
|
||||
}
|
||||
#survey-form .btn:hover:after {
|
||||
width: 100%;
|
||||
}
|
||||
#survey-form fieldset {
|
||||
margin: 5% 0 0 0;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.copyright i {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
padding: 8% 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<main id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
|
||||
<div class="m-b-md text-center">
|
||||
<h1 id="title">Stash Form</h1>
|
||||
<p id="description" class="description" class="text-center">Download form</p>
|
||||
</div>
|
||||
<form method="GET" action="/stash/simple-form/" id="survey-form" name="survey-form">
|
||||
|
||||
<fieldset>
|
||||
<label for="name" id="name-label">
|
||||
Name *
|
||||
<input class="" type="text" id="name" name="name" placeholder="Enter your name (required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</html>
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Scaled up</title>
|
||||
<title>Stash form</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
@@ -277,7 +277,7 @@
|
||||
<fieldset>
|
||||
<label for="external_galleries">
|
||||
Any external galleries ?
|
||||
<textarea id="external_galleries" maxlength="194"></textarea>
|
||||
<textarea id="external_galleries" name="external_galleries" ></textarea>
|
||||
</label>
|
||||
</fieldset>
|
||||
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||
@@ -5,4 +5,8 @@ from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello Django!</h1>')
|
||||
return HttpResponse('<h1>Hello stash!</h1>')
|
||||
|
||||
|
||||
def home(request):
|
||||
return render(request, 'listing.html')
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -0,0 +1,53 @@
|
||||
import redis
|
||||
from django.http import HttpResponse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
|
||||
r = redis.Redis(
|
||||
host='django-redis-svc',
|
||||
port=6379,
|
||||
db=0 # The default Redis database index
|
||||
)
|
||||
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello redirect!</h1>')
|
||||
|
||||
|
||||
def redirect(request):
|
||||
return render(request, 'redirect_form.html',{})
|
||||
|
||||
def clearkey_process(request):
|
||||
key = request.GET.get('key')
|
||||
r.delete(key)
|
||||
return 0
|
||||
|
||||
def redirect_process(request):
|
||||
key = request.GET.get('key')
|
||||
value = request.GET.get('value')
|
||||
key = key.lower()
|
||||
|
||||
r.set(key, value)
|
||||
|
||||
text_generated = "successfully set "+value+" to "+key
|
||||
return HttpResponse(text_generated, content_type="text/plain")
|
||||
|
||||
def display_key(request,key):
|
||||
value = r.get(key)
|
||||
value_extracted = str(value.decode())
|
||||
text_generated = key+" is set to "+value_extracted
|
||||
return HttpResponse(text_generated, content_type="text/plain")
|
||||
|
||||
|
||||
def redirect_to_key(request,key):
|
||||
value = r.get(key)
|
||||
if value == None:
|
||||
icon_url = r.get('icon')
|
||||
if icon_url == None:
|
||||
icon_url = "https://cdn-icons-png.flaticon.com/512/6402/6402576.png"
|
||||
print(key+" is not setup, displaying default page")
|
||||
return render(request, 'blank_page.html', {'title': key,'icon_url':icon_url})
|
||||
else:
|
||||
value_extracted = str(value.decode('utf-8'))
|
||||
print(key+" is setup to : "+value_extracted)
|
||||
print(value_extracted)
|
||||
return HttpResponseRedirect(value_extracted)
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="icon" type="image/x-icon" href="https://cdn-icons-png.flaticon.com/512/6402/6402576.png">
|
||||
<title>{{ title }}</title>
|
||||
|
||||
</head>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,294 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Redirect form</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
|
||||
<style>
|
||||
@charset "UTF-8";
|
||||
.m-b-xs {
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 10%;
|
||||
}
|
||||
|
||||
.m-t-xs {
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
.m-t-sm {
|
||||
margin-top: 5%;
|
||||
}
|
||||
|
||||
* {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 2% 0;
|
||||
background-color: #37404a;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 2.2em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#survey-form label,
|
||||
#survey-form .labels {
|
||||
display: block;
|
||||
margin-bottom: 2%;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
#survey-form input::-webkit-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input::-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-ms-input-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input:-moz-placeholder {
|
||||
color: transparent !important;
|
||||
}
|
||||
#survey-form input,
|
||||
#survey-form select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
outline: none;
|
||||
border: 2px solid #333;
|
||||
}
|
||||
#survey-form input {
|
||||
margin-top: 1.5%;
|
||||
padding: 0 0 5px 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
border-bottom: 2px solid #fff;
|
||||
font-size: 1.1em;
|
||||
font-weight: 300;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form input:focus {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
margin: 0px 10px 0 0;
|
||||
}
|
||||
#survey-form [type=checkbox],
|
||||
#survey-form [type=radio] {
|
||||
display: inline-block;
|
||||
margin: 0 10px 0 0 !important;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
-o-appearance: none;
|
||||
appearance: none;
|
||||
height: 23px;
|
||||
width: 23px;
|
||||
transition: all 0.15s ease-out 0s;
|
||||
background: #37404a;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
z-index: 1000;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
#survey-form [type=checkbox]:hover,
|
||||
#survey-form [type=radio]:hover {
|
||||
border-color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:checked:before,
|
||||
#survey-form [type=radio]:checked:before {
|
||||
display: inline-block;
|
||||
height: 21px;
|
||||
width: 21px;
|
||||
position: relative;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
text-align: center;
|
||||
font-family: "Glyphicons Halflings";
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form [type=checkbox]:focus,
|
||||
#survey-form [type=radio]:focus {
|
||||
outline: none;
|
||||
border-color: #fff;
|
||||
}
|
||||
#survey-form [type=radio] {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=radio]:after {
|
||||
border-radius: 50%;
|
||||
}
|
||||
#survey-form [type=number] {
|
||||
width: 45px;
|
||||
}
|
||||
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#survey-form select {
|
||||
height: 40px;
|
||||
padding-left: 5px;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
color: #85ffc7;
|
||||
}
|
||||
#survey-form select option {
|
||||
padding: 5px 10px;
|
||||
font-weight: 300;
|
||||
cursor: pointer;
|
||||
}
|
||||
#survey-form select option:hover {
|
||||
background-color: #85ffc7;
|
||||
}
|
||||
#survey-form textarea {
|
||||
resize: none;
|
||||
margin-top: 2%;
|
||||
padding: 10px 10px 0px 20px;
|
||||
width: 100%;
|
||||
height: 90px;
|
||||
color: #85ffc7;
|
||||
background-color: #37404a;
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
#survey-form .btn {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 3% 0 0 0;
|
||||
height: 45px;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border: 3px solid #85ffc7;
|
||||
border-radius: 0;
|
||||
font-weight: 500;
|
||||
font-size: 1.2em;
|
||||
color: #85ffc7;
|
||||
text-align: center;
|
||||
background: none;
|
||||
transition: color 0.25s ease;
|
||||
}
|
||||
#survey-form .btn:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
background-color: #85ffc7;
|
||||
transform-origin: left;
|
||||
transition: width 0.5s ease;
|
||||
z-index: -1;
|
||||
}
|
||||
#survey-form .btn:hover {
|
||||
color: #37404a;
|
||||
}
|
||||
#survey-form .btn:hover:after {
|
||||
width: 100%;
|
||||
}
|
||||
#survey-form fieldset {
|
||||
margin: 5% 0 0 0;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.copyright i {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
padding: 8% 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<main id="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
|
||||
<div class="m-b-md text-center">
|
||||
<h1 id="title">Redirect Form</h1>
|
||||
<p id="description" class="description" class="text-center">Download form</p>
|
||||
</div>
|
||||
<form method="GET" action="/redirect-form/" id="survey-form" name="survey-form">
|
||||
|
||||
<fieldset>
|
||||
<label for="key" id="key-label">
|
||||
Key *
|
||||
<input class="" type="text" id="key" name="key" placeholder="Enter your key (required)" required />
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="value" id="value-label">
|
||||
Value *
|
||||
<input class="" type="value" id="value" name="value" placeholder="Enter the value (required)" />
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||
<button id="clearkey" type="submit" formaction="/clearkey/" class="btn">Clear the key</button>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="button" onclick="location.href='/go/streaming'" class="btn">Streaming</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button type="button" onclick="location.href='/go/streaming-sam'" class="btn">Streaming Sam</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</html>
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
URL configuration for django_code project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from website_redirection import apps as website_redirectionapp
|
||||
|
||||
urlpatterns = [
|
||||
# path('admin/', admin.site.urls),
|
||||
|
||||
################### Redirect ###################
|
||||
path('', website_redirectionapp.redirect),
|
||||
path('hello/', website_redirectionapp.hello),
|
||||
path('set/', website_redirectionapp.redirect),
|
||||
path('get/<str:key>', website_redirectionapp.display_key),
|
||||
path('go/<str:key>', website_redirectionapp.redirect_to_key),
|
||||
path('redirect-form/', website_redirectionapp.redirect_process, name='submit_form'),
|
||||
path('clearkey/', website_redirectionapp.clearkey_process, name='submit_form'),
|
||||
|
||||
|
||||
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello Django!</h1>')
|
||||
@@ -0,0 +1,32 @@
|
||||
# Stage 1: Build the module
|
||||
FROM python:3
|
||||
|
||||
MAINTAINER pi-ux-ce
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
WORKDIR /code/
|
||||
|
||||
# Install build tools and MaxMind library
|
||||
RUN apt-get update && \
|
||||
apt-get install -y git nano && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Clone the specific GeoIP2 module project
|
||||
RUN git clone -b testing https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
|
||||
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
|
||||
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r Django_kube/requirements.txt
|
||||
|
||||
RUN python Django_kube/django_code/manage.py migrate
|
||||
|
||||
COPY entrypoint.sh /code/entrypoint.sh
|
||||
RUN chmod +x /code/entrypoint.sh
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/code/entrypoint.sh"]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd Django_kube
|
||||
|
||||
#another methid but needs to rm -rf before
|
||||
#git clone --depth 1 -b main https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
|
||||
|
||||
git pull
|
||||
|
||||
pip install -r requirements.txt
|
||||
|
||||
python django_code/manage.py migrate
|
||||
|
||||
python django_code/manage.py runserver "0.0.0.0:8000"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
services:
|
||||
db:
|
||||
image: django:local
|
||||
restart: always
|
||||
volumes:
|
||||
- type: bind
|
||||
target: /code
|
||||
source: ./django_code
|
||||
command: python manage.py runserver 0.0.0.0:7000
|
||||
ports:
|
||||
- 7000:7000
|
||||
|
||||
+21
-5
@@ -1,13 +1,29 @@
|
||||
FROM python:3
|
||||
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
#ENV ALLOWED_HOSTS 'django.tryton.geeraert.eu'
|
||||
#ENV DEBUG 'True'
|
||||
|
||||
ARG ALLOWED_HOSTS
|
||||
ARG DEBUG
|
||||
ENV ALLOWED_HOSTS=$ALLOWED_HOSTS
|
||||
ENV DEBUG=$DEBUG
|
||||
|
||||
WORKDIR /code/
|
||||
|
||||
# Copy only the requirements file first (Changes infrequently)
|
||||
COPY requirements.txt ./
|
||||
COPY django_code ./
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
|
||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
|
||||
COPY . .
|
||||
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
|
||||
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
|
||||
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r requirements.txt
|
||||
|
||||
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
|
||||
COPY . ./
|
||||
RUN python django_code/manage.py migrate
|
||||
|
||||
# CMD is the command run when the container starts
|
||||
CMD [ "python","django_code/manage.py","runserver","0.0.0.0:8000" ]
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
#install required packages
|
||||
apk add curl wget
|
||||
|
||||
#named argument generation
|
||||
skip_searching_gallery="${skip_searching_gallery:-false}"
|
||||
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
if [[ $1 == "--"* ]]; then
|
||||
v="${1/--/}"
|
||||
declare "$v"="$2"
|
||||
shift
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
#check if we will use a HTTP proxy or not
|
||||
|
||||
if [[ -z $http_proxy ]]; then
|
||||
echo "not using proxy"
|
||||
curl_command="curl"
|
||||
else
|
||||
echo "using proxy"
|
||||
curl_command="curl -x $http_proxy"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
#dowload from https://www.pornpics.com/pornstars/eiby-shine/
|
||||
DESTINATION_FOLDER="/data"
|
||||
PROXY_HTTP="http://gluetun-svc.gluetun.svc:8888"
|
||||
|
||||
#BASE_URL="https://www.pornpics.com/pornstars/eiby-shine/"
|
||||
#pornstars="eiby-shine"
|
||||
|
||||
#BASE_URL="https://www.pornpics.com/?q=shy+imp"
|
||||
#pornstars="shy-imp"
|
||||
|
||||
#BASE_URL="https://www.pornpics.com/pornstars/gloria-sol/"
|
||||
#pornstars="gloria-sol"
|
||||
|
||||
|
||||
#BASE_URL="https://www.pornpics.com/pornstars/becky-summer"
|
||||
#pornstars="becky-summer"
|
||||
|
||||
|
||||
#clear files beforehand
|
||||
|
||||
echo "Pornstar: "$pornstars
|
||||
echo "URL: "$BASE_URL
|
||||
|
||||
mkdir -p $DESTINATION_FOLDER/$pornstars
|
||||
|
||||
if [[ $skip_searching_gallery == true ]]; then
|
||||
echo "not looping through galleries"
|
||||
echo "using existing file instead"
|
||||
#because we need to keep the file $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt with the existing URL , in this condition,
|
||||
#no deletion of this file
|
||||
echo $external_gallery > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
|
||||
else
|
||||
echo "looping through galleries"
|
||||
#because we will re-generate this file, can be emptied
|
||||
echo "" > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
|
||||
$curl_command -s $BASE_URL | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://www.pornpics.com/galleries/" |sort -u >> $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
|
||||
fi
|
||||
|
||||
echo "" > $DESTINATION_FOLDER/$pornstars-image_to_download.txt
|
||||
|
||||
|
||||
for f in $(cat $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt ); do
|
||||
$curl_command $f | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://cdni.pornpics.com/1280" >> $DESTINATION_FOLDER/$pornstars-image_to_download.txt
|
||||
echo $f
|
||||
done
|
||||
|
||||
|
||||
for g in $(cat $DESTINATION_FOLDER/$pornstars-image_to_download.txt ); do
|
||||
$curl_command -O --output-dir $DESTINATION_FOLDER/$pornstars $g
|
||||
# wget -e use_proxy=yes -e http_proxy=$PROXY_HTTP $g -P $DESTINATION_FOLDER/$pornstars
|
||||
echo $g
|
||||
done
|
||||
exit 0
|
||||
@@ -8,3 +8,9 @@ ruamel.yaml
|
||||
pyyaml
|
||||
django-bootstrap-v5
|
||||
jinja2
|
||||
watchdog
|
||||
celery
|
||||
redis
|
||||
lxml
|
||||
requests
|
||||
django-hosts
|
||||
|
||||
Reference in New Issue
Block a user