Create pages branch
This commit is contained in:
parent
5223550529
commit
541a219d3b
@ -1,60 +0,0 @@
|
||||
name: Deploy Jekyll site to Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
RUBY_VERSION: "3.3.5"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: checkout pages
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'pages'
|
||||
path: 'pages'
|
||||
- name: Setup Ruby
|
||||
run: |
|
||||
apt-get update && \
|
||||
apt-get install curl wget tar build-essential zlib1g-dev gpg -y && \
|
||||
curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
|
||||
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \
|
||||
curl -sSL https://get.rvm.io | bash -s stable && \
|
||||
source /etc/profile.d/rvm.sh && \
|
||||
rvm mount -r https://raw.morlana.space/morlana/rvm-binaries/@binaries/ubuntu/22.04/aarch64/ruby-$RUBY_VERSION.tar.bz2 && \
|
||||
rvm use $RUBY_VERSION && ruby -v && gem -v && \
|
||||
gem install bundler jekyll webrick
|
||||
- name: Build with Jekyll
|
||||
run: |
|
||||
source /etc/profile.d/rvm.sh && \
|
||||
rvm use $RUBY_VERSION && ruby -v && gem -v && \
|
||||
mv README.md index.md && \
|
||||
bundle install && \
|
||||
bundle exec jekyll build --destination pages
|
||||
env:
|
||||
JEKYLL_ENV: production
|
||||
- name: push pages
|
||||
run: |
|
||||
cd pages && \
|
||||
cp ../.domains ./.domains && \
|
||||
git config user.name "${{ gitea.actor }}" && \
|
||||
git config user.email ""${{ gitea.actor }}"@noreply.git.morlana.online" && \
|
||||
git add . && \
|
||||
git commit -m "jekyll build from Action ${GITHUB_SHA}" && \
|
||||
git push
|
@ -1,26 +0,0 @@
|
||||
name: Update Cloudflare DNS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: "cloudflare"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
update-dns:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Dependencies
|
||||
run: pip install pyyaml requests
|
||||
|
||||
- name: Update Cloudflare DNS
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||
run: python update_cloudflare_dns.py
|
179
.gitignore
vendored
179
.gitignore
vendored
@ -1,179 +0,0 @@
|
||||
# ---> Jekyll
|
||||
_site/
|
||||
.sass-cache/
|
||||
.jekyll-cache/
|
||||
.jekyll-metadata
|
||||
# Ignore folders generated by Bundler
|
||||
.bundle/
|
||||
vendor/
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# UV
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
#uv.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
25
404.html
25
404.html
@ -1,25 +0,0 @@
|
||||
---
|
||||
permalink: /404.html
|
||||
layout: default
|
||||
---
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
.container {
|
||||
margin: 10px auto;
|
||||
max-width: 600px;
|
||||
text-align: center;
|
||||
}
|
||||
h1 {
|
||||
margin: 30px 0;
|
||||
font-size: 4em;
|
||||
line-height: 1;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<h1>404</h1>
|
||||
|
||||
<p><strong>Page not found :(</strong></p>
|
||||
<p>The requested page could not be found. <a href="/">Go back</a></p>
|
||||
</div>
|
36
Gemfile
36
Gemfile
@ -1,36 +0,0 @@
|
||||
source "https://rubygems.org"
|
||||
# Hello! This is where you manage which Jekyll version is used to run.
|
||||
# When you want to use a different version, change it below, save the
|
||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||
#
|
||||
# bundle exec jekyll serve
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
gem "jekyll", "~> 4.3.4"
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
gem "minima", "~> 2.5"
|
||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||
# gem "github-pages", group: :jekyll_plugins
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed", "~> 0.12"
|
||||
gem "jekyll-remote-theme"
|
||||
end
|
||||
|
||||
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
# and associated library.
|
||||
platforms :mingw, :x64_mingw, :mswin, :jruby do
|
||||
gem "tzinfo", ">= 1", "< 3"
|
||||
gem "tzinfo-data"
|
||||
end
|
||||
|
||||
# Performance-booster for watching directories on Windows
|
||||
gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin]
|
||||
|
||||
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
|
||||
# do not have a Java counterpart.
|
||||
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
|
||||
|
||||
gem "webrick", "~> 1.9"
|
190
Gemfile.lock
190
Gemfile.lock
@ -1,190 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
bigdecimal (3.1.8)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.3.4)
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.17.0)
|
||||
ffi (1.17.0-aarch64-linux-gnu)
|
||||
ffi (1.17.0-aarch64-linux-musl)
|
||||
ffi (1.17.0-arm-linux-gnu)
|
||||
ffi (1.17.0-arm-linux-musl)
|
||||
ffi (1.17.0-arm64-darwin)
|
||||
ffi (1.17.0-x86-linux-gnu)
|
||||
ffi (1.17.0-x86-linux-musl)
|
||||
ffi (1.17.0-x86_64-darwin)
|
||||
ffi (1.17.0-x86_64-linux-gnu)
|
||||
ffi (1.17.0-x86_64-linux-musl)
|
||||
forwardable-extended (2.6.0)
|
||||
google-protobuf (4.28.3)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.28.3-aarch64-linux)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.28.3-arm64-darwin)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.28.3-x86-linux)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.28.3-x86_64-darwin)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.28.3-x86_64-linux)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.3.4)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 1.0)
|
||||
jekyll-sass-converter (>= 2.0, < 4.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 2.3, >= 2.3.1)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
liquid (~> 4.0)
|
||||
mercenary (>= 0.3.6, < 0.5)
|
||||
pathutil (~> 0.9)
|
||||
rouge (>= 3.0, < 5.0)
|
||||
safe_yaml (~> 1.0)
|
||||
terminal-table (>= 1.8, < 4.0)
|
||||
webrick (~> 1.7)
|
||||
jekyll-feed (0.17.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-remote-theme (0.4.3)
|
||||
addressable (~> 2.0)
|
||||
jekyll (>= 3.5, < 5.0)
|
||||
jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
|
||||
rubyzip (>= 1.3.0, < 3.0)
|
||||
jekyll-sass-converter (3.0.0)
|
||||
sass-embedded (~> 1.54)
|
||||
jekyll-seo-tag (2.8.0)
|
||||
jekyll (>= 3.8, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.4)
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.4.0)
|
||||
minima (2.5.2)
|
||||
jekyll (>= 3.5, < 5.0)
|
||||
jekyll-feed (~> 0.9)
|
||||
jekyll-seo-tag (~> 2.1)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (6.0.1)
|
||||
rake (13.2.1)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.11.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.3.9)
|
||||
rouge (4.5.1)
|
||||
rubyzip (2.3.2)
|
||||
safe_yaml (1.0.5)
|
||||
sass-embedded (1.80.7)
|
||||
google-protobuf (~> 4.28)
|
||||
rake (>= 13)
|
||||
sass-embedded (1.80.7-aarch64-linux-android)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-aarch64-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-aarch64-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-aarch64-mingw-ucrt)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-arm-linux-androideabi)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-arm-linux-gnueabihf)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-arm-linux-musleabihf)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-arm64-darwin)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-riscv64-linux-android)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-riscv64-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-riscv64-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86-cygwin)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86-linux-android)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86-mingw-ucrt)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86_64-cygwin)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86_64-darwin)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86_64-linux-android)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86_64-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.80.7-x86_64-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
unicode-display_width (2.6.0)
|
||||
webrick (1.9.0)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux
|
||||
aarch64-linux-android
|
||||
aarch64-linux-gnu
|
||||
aarch64-linux-musl
|
||||
aarch64-mingw-ucrt
|
||||
arm-linux-androideabi
|
||||
arm-linux-gnu
|
||||
arm-linux-gnueabihf
|
||||
arm-linux-musl
|
||||
arm-linux-musleabihf
|
||||
arm64-darwin
|
||||
riscv64-linux-android
|
||||
riscv64-linux-gnu
|
||||
riscv64-linux-musl
|
||||
ruby
|
||||
x86-cygwin
|
||||
x86-linux
|
||||
x86-linux-android
|
||||
x86-linux-gnu
|
||||
x86-linux-musl
|
||||
x86-mingw-ucrt
|
||||
x86_64-cygwin
|
||||
x86_64-darwin
|
||||
x86_64-linux
|
||||
x86_64-linux-android
|
||||
x86_64-linux-gnu
|
||||
x86_64-linux-musl
|
||||
|
||||
DEPENDENCIES
|
||||
http_parser.rb (~> 0.6.0)
|
||||
jekyll (~> 4.3.4)
|
||||
jekyll-feed (~> 0.12)
|
||||
jekyll-remote-theme
|
||||
minima (~> 2.5)
|
||||
tzinfo (>= 1, < 3)
|
||||
tzinfo-data
|
||||
wdm (~> 0.1)
|
||||
webrick (~> 1.9)
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.23
|
11
LICENSE
11
LICENSE
@ -1,11 +0,0 @@
|
||||
Copyright (c) 2025 Morlana.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,9 +0,0 @@
|
||||
title: Morlana - Pages
|
||||
description: >-
|
||||
Free Subdomains provided by Morlana
|
||||
baseurl: "/"
|
||||
url: "https://morlana.page"
|
||||
show_downloads: false
|
||||
remote_theme: pages-themes/midnight@v0.2.0
|
||||
plugins:
|
||||
- jekyll-remote-theme
|
16
domains.yaml
16
domains.yaml
@ -1,16 +0,0 @@
|
||||
reserved_domains:
|
||||
- "^(www\\.|api\\.|mail\\.|status\\.)morlana\\.page$"
|
||||
- "^admin\\..*"
|
||||
- "^internal\\..*"
|
||||
|
||||
subdomains:
|
||||
- name: sitiriotv
|
||||
target: justin.morlana.space
|
||||
# - name: "example"
|
||||
# target: "example.com"
|
||||
# proxy: true
|
||||
# note: "Test Subdomain"
|
||||
# - name: "test"
|
||||
# target: "test.example.com"
|
||||
# proxy: false
|
||||
# note: "Proxy deaktiviert"
|
5
index.html
Normal file
5
index.html
Normal file
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hello, World!</h1>
|
||||
</body>
|
||||
</html>
|
@ -1,62 +0,0 @@
|
||||
import yaml
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
|
||||
# Cloudflare API Konfiguration
|
||||
CLOUDFLARE_API_TOKEN = os.getenv("CLOUDFLARE_API_TOKEN")
|
||||
CLOUDFLARE_ZONE_ID = os.getenv("CLOUDFLARE_ZONE_ID")
|
||||
CLOUDFLARE_API_URL = f"https://api.cloudflare.com/client/v4/zones/{CLOUDFLARE_ZONE_ID}/dns_records"
|
||||
|
||||
HEADERS = {
|
||||
"Authorization": f"Bearer {CLOUDFLARE_API_TOKEN}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
def load_domains(file_path="domains.yaml"):
|
||||
with open(file_path, "r") as file:
|
||||
return yaml.safe_load(file)
|
||||
|
||||
def is_reserved(domain, reserved_patterns):
|
||||
return any(re.match(pattern, domain) for pattern in reserved_patterns)
|
||||
|
||||
def get_existing_records():
|
||||
response = requests.get(CLOUDFLARE_API_URL, headers=HEADERS)
|
||||
if response.status_code == 200:
|
||||
return {rec["name"]: rec for rec in response.json().get("result", [])}
|
||||
return {}
|
||||
|
||||
def update_cloudflare():
|
||||
data = load_domains()
|
||||
reserved_patterns = data.get("reserved_domains", [])
|
||||
subdomains = data.get("subdomains", [])
|
||||
|
||||
existing_records = get_existing_records()
|
||||
|
||||
for subdomain in subdomains:
|
||||
full_domain = f"{subdomain['name']}.morlana.page"
|
||||
|
||||
if is_reserved(full_domain, reserved_patterns):
|
||||
print(f"Skipping reserved domain: {full_domain}")
|
||||
continue
|
||||
|
||||
record_data = {
|
||||
"type": "CNAME",
|
||||
"name": full_domain,
|
||||
"content": subdomain["target"],
|
||||
"proxied": subdomain.get("proxy", True)
|
||||
}
|
||||
|
||||
if full_domain in existing_records:
|
||||
record_id = existing_records[full_domain]["id"]
|
||||
response = requests.put(f"{CLOUDFLARE_API_URL}/{record_id}", json=record_data, headers=HEADERS)
|
||||
else:
|
||||
response = requests.post(CLOUDFLARE_API_URL, json=record_data, headers=HEADERS)
|
||||
|
||||
if response.status_code in [200, 201]:
|
||||
print(f"Successfully updated {full_domain}")
|
||||
else:
|
||||
print(f"Failed to update {full_domain}: {response.text}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
update_cloudflare()
|
Reference in New Issue
Block a user