commit 154c0a6b3af217d1610bee79f4529907de0b0de6 Author: Benjamyn Love Date: Mon Dec 18 19:06:29 2023 +1100 Initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad25598 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +out/ +__pycache__ +venv/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..306f58e --- /dev/null +++ b/.vscode/launch.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/brands/synergy.json b/brands/synergy.json new file mode 100644 index 0000000..a683cb9 --- /dev/null +++ b/brands/synergy.json @@ -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 +} \ No newline at end of file diff --git a/brands/ventraip.json b/brands/ventraip.json new file mode 100644 index 0000000..988c784 --- /dev/null +++ b/brands/ventraip.json @@ -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 +} \ No newline at end of file diff --git a/guides/reset_cpanel_pass_vip.jinja2 b/guides/reset_cpanel_pass_vip.jinja2 new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/onedoc.py b/src/onedoc.py new file mode 100644 index 0000000..43622a8 --- /dev/null +++ b/src/onedoc.py @@ -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) diff --git a/templates/details/reset_cpanel_pass_syn.jinja b/templates/details/reset_cpanel_pass_syn.jinja new file mode 100644 index 0000000..c841a43 --- /dev/null +++ b/templates/details/reset_cpanel_pass_syn.jinja @@ -0,0 +1,10 @@ + + + + diff --git a/templates/details/reset_cpanel_pass_vip.jinja b/templates/details/reset_cpanel_pass_vip.jinja new file mode 100644 index 0000000..1f07716 --- /dev/null +++ b/templates/details/reset_cpanel_pass_vip.jinja @@ -0,0 +1,10 @@ + + + + diff --git a/templates/main.jinja b/templates/main.jinja new file mode 100644 index 0000000..905c885 --- /dev/null +++ b/templates/main.jinja @@ -0,0 +1,22 @@ + + + + + + + + + + +{% block content %} + +{% endblock %} + + + + \ No newline at end of file diff --git a/templates/reset_cpanel_pass.jinja b/templates/reset_cpanel_pass.jinja new file mode 100644 index 0000000..748172f --- /dev/null +++ b/templates/reset_cpanel_pass.jinja @@ -0,0 +1,23 @@ + +{% extends 'main.jinja' %} + +{% block content %} + + +

Reset your cPanel password

+ +{% 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 %} + +{# #} +{% endblock %} \ No newline at end of file diff --git a/templates/ssh.jinja b/templates/ssh.jinja new file mode 100644 index 0000000..a216e9c --- /dev/null +++ b/templates/ssh.jinja @@ -0,0 +1,29 @@ + + + + + + + + + + + + +

{{ name }}

+ {{ name }} homepage +

+ Management Panel +

+To ssh into the server do +

+ssh username@{{ web_hosting_example_server }} -p {{ port }} + + + + \ No newline at end of file