This commit is contained in:
Benjamyn Love 2023-12-18 19:06:29 +11:00
commit 154c0a6b3a
13 changed files with 165 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
out/
__pycache__
venv/

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}

0
README.md Normal file
View File

13
brands/synergy.json Normal file
View File

@ -0,0 +1,13 @@
{
"file_suffix": "syn",
"name": "Synergy Wholesale",
"site_url": "https://synergywholesale.com",
"management_name": "Synergy Wholesale Management System",
"management_url": "https://manage.synergywholesale.com",
"logo": "https://synergywholesale.com/wp-content/uploads/2017/06/synergy-logo.png",
"web_hosting_example_server": "syn111.syd1.hostyourservices.net",
"email_hosting_example_server": "ax.email",
"bg_colour": "#4b3158",
"text_colour": "azure",
"port": 2683
}

13
brands/ventraip.json Normal file
View File

@ -0,0 +1,13 @@
{
"file_suffix": "vip",
"name": "VentraIP Australia",
"site_url": "https://ventraip.com.au",
"management_name": "VIPControl",
"management_url": "https://vip.ventraip.com.au",
"logo": "https://ventraip.com.au/wp-content/uploads/2022/07/ventra-ip-logo.svg",
"web_hosting_example_server": "s111.syd1.hostingplatform.net.au",
"email_hosting_example_server": "ventraip.email",
"bg_colour": "#2e2e2e",
"text_colour": "azure",
"port": 2683
}

View File

0
requirements.txt Normal file
View File

26
src/onedoc.py Normal file
View File

@ -0,0 +1,26 @@
import jinja2
import json
from pathlib import Path
# Define Jinja2 environment
environment = jinja2.Environment(loader=jinja2.FileSystemLoader("templates/"))
# Get list of templates and brands
templates = environment.list_templates()
brands = [json.load(brand.open()) for brand in Path("brands/").glob("*.json")]
# guides = [json.load(guide.open()) for guide in Path("guides/").glob("*.json")]
# template = environment.get_template('main.jinja')
# print(template)
for template in templates:
# guide = None
# for g in guides:
# if g['template_name'] == template:
# guide = g
if template.startswith("details"):
continue
for brand in brands:
rendered_template = environment.get_template(template).render(**brand)
with open(f"out/{template.split('.')[0]}_{brand['file_suffix']}.html", 'w') as f:
f.write(rendered_template)

View File

@ -0,0 +1,10 @@
<ul>
<li>Log into <a href="{{ management_url }}">{{ management_name }}</a></li>
<li>Click 'cPanel Hosting' but synergy</li>
<li>Click 'Manage' but synergy</li>
<li>Scroll down to 'Details' but synergy</li>
<li>Click 'Reset' next to the cPanel password but synergy</li>
</ul>

View File

@ -0,0 +1,10 @@
<ul>
<li>Log into <a href="{{ management_url }}">{{ management_name }}</a></li>
<li>Click 'cPanel Hosting'</li>
<li>Click 'Manage'</li>
<li>Scroll down to 'Details'</li>
<li>Click 'Reset' next to the cPanel password</li>
</ul>

22
templates/main.jinja Normal file
View File

@ -0,0 +1,22 @@
<!-- HTML template -->
<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<style>
body {
background-color: {{ bg_colour }};
color: {{ text_colour }};
}
</style>
</head>
<body>
{% block content %}
{% endblock %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>

View File

@ -0,0 +1,23 @@
{% extends 'main.jinja' %}
{% block content %}
<img src="{{ logo }}"/>
<h2>Reset your cPanel password</h2>
{% if file_suffix == "vip" %}
{% block ul %}
{% include 'details/reset_cpanel_pass_vip.jinja' %}
{% endblock %}
{% elif file_suffix == "syn" %}
{% include 'details/reset_cpanel_pass_syn.jinja' %}
{% endif %}
{# <ul>
<li>Log into <a href="{{ management_url }}" target="_blank">{{ management_name }}</a> here</li>
<li>Go to the hosting section (specific image with generic text?)</li>
<li>Go to the properties of the hosting service you wish to change the password for</li>
<li></li>
</ul> #}
{% endblock %}

29
templates/ssh.jinja Normal file
View File

@ -0,0 +1,29 @@
<!-- HTML template -->
<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<style>
body {
background-color: {{ bg_colour }};
color: {{ text_colour }};
}
</style>
</head>
<body>
<img src="{{ logo }}"/>
<h2> {{ name }}</h2>
<a href="https://{{ site_url }}"> {{ name }} homepage</a>
<p></p>
<a href="https://{{ management_url }}"> Management Panel </a>
<p></p>
To ssh into the server do
<p></p>
<code>ssh username@{{ web_hosting_example_server }} -p {{ port }} </code>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>