Django HTML generation

This commit is contained in:
koalasat 2024-09-18 08:37:37 +02:00
parent 305f51512c
commit 36472ea89e
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
5 changed files with 270 additions and 104 deletions

View File

@ -1,62 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="onion-location" content="{{ ONION_LOCATION }}" />
<link rel="shortcut icon" href="./static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="./static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="./static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="./static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
{% load static %}
<link rel="stylesheet" href="./static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/leaflet.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = '<%= htmlWebpackPlugin.options.robosatsSettings %>'
</script>
</body>
</html>

View File

@ -10,15 +10,21 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required."> <meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<% if (pro) { %>
<title>RoboSats PRO - Simple and Private Bitcoin Exchange</title> <title>RoboSats PRO - Simple and Private Bitcoin Exchange</title>
{% load static %}
<link rel="stylesheet" href="./static/css_pro/fonts.css"/> <link rel="stylesheet" href="./static/css_pro/fonts.css"/>
<link rel="stylesheet" type="text/css" href="./static/css_pro/react-grid-layout.css"/>
<link rel="stylesheet" type="text/css" href="./static/css_pro/react-resizable.css"/>
<% } else { %>
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" href="./static/css/fonts.css"/>
<% } %>
{% load static %}
<link rel="stylesheet" type="text/css" href="./static/css/loader.css"/> <link rel="stylesheet" type="text/css" href="./static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/index.css"/> <link rel="stylesheet" type="text/css" href="./static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/leaflet.css"/> <link rel="stylesheet" type="text/css" href="./static/css/leaflet.css"/>
<link rel="stylesheet" type="text/css" href="./static/css_pro/react-grid-layout.css"/>
<link rel="stylesheet" type="text/css" href="./static/css_pro/react-resizable.css"/>
</head> </head>
<body> <body>
<noscript> <noscript>

View File

@ -35,30 +35,72 @@ const configNode: Configuration = {
publicPath: './static/frontend/', publicPath: './static/frontend/',
}, },
plugins: [ plugins: [
// Django HTML
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'), template: path.resolve(__dirname, 'templates/frontend/index.ejs'),
filename: path.resolve(__dirname, '../nodeapp/basic.html'), templateParameters: {
robosatsSettings: 'selfhosted-basic', pro: false,
},
filename: path.resolve(__dirname, 'templates/frontend/basic.html'),
inject: 'body', inject: 'body',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/pro.html'),
filename: path.resolve(__dirname, '../nodeapp/pro.html'),
robosatsSettings: 'selfhosted-pro',
inject: 'body',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'),
filename: path.resolve(__dirname, '../web/basic.html'),
robosatsSettings: 'web-basic', robosatsSettings: 'web-basic',
inject: 'body',
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/pro.html'), template: path.resolve(__dirname, 'templates/frontend/index.ejs'),
filename: path.resolve(__dirname, '../web/pro.html'), templateParameters: {
robosatsSettings: 'web-pro', pro: true,
},
filename: path.resolve(__dirname, 'templates/frontend/pro.html'),
inject: 'body', inject: 'body',
robosatsSettings: 'web-pro',
}), }),
// Node App HTML
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/index.ejs'),
templateParameters: {
pro: false,
},
filename: path.resolve(__dirname, '../nodeapp/basic.html'),
inject: 'body',
robosatsSettings: 'selfhosted-basic',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/index.ejs'),
templateParameters: {
pro: true,
},
filename: path.resolve(__dirname, '../nodeapp/pro.html'),
inject: 'body',
robosatsSettings: 'selfhosted-pro',
}),
// Desktop App HTML
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/index.ejs'),
templateParameters: {
pro: false,
},
filename: path.resolve(__dirname, '../desktopApp/index.html'),
inject: 'body',
robosatsSettings: 'desktop-basic',
}),
// Web App HTML
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'templates/frontend/basic.html'),
to: path.resolve(__dirname, '../web/basic.html'),
},
],
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'templates/frontend/pro.html'),
to: path.resolve(__dirname, '../web/pro.html'),
},
],
}),
// Static files
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
{ {
@ -75,24 +117,6 @@ const configNode: Configuration = {
}, },
], ],
}), }),
],
};
const configDesktop: Configuration = {
...config,
output: {
path: path.resolve(__dirname, '../desktopApp/static/frontend'),
filename: `main.v${version}.[contenthash].js`,
clean: true,
publicPath: './static/frontend/',
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'),
filename: path.resolve(__dirname, '../desktopApp/index.html'),
robosatsSettings: 'desktop-basic',
inject: 'body',
}),
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
{ {
@ -153,10 +177,13 @@ const configMobile: Configuration = {
}, },
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'), template: path.resolve(__dirname, 'templates/frontend/index.ejs'),
templateParameters: {
pro: false,
},
filename: path.resolve(__dirname, '../mobile/html/Web.bundle/index.html'), filename: path.resolve(__dirname, '../mobile/html/Web.bundle/index.html'),
robosatsSettings: 'mobile-basic',
inject: 'body', inject: 'body',
robosatsSettings: 'mobile-basic',
}), }),
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
@ -175,4 +202,4 @@ const configMobile: Configuration = {
}, },
}; };
export default [configNode, configDesktop, configMobile]; export default [configNode, configMobile];

192
package-lock.json generated
View File

@ -6,6 +6,25 @@
"": { "": {
"dependencies": { "dependencies": {
"js-yaml": "^4.1.0" "js-yaml": "^4.1.0"
},
"devDependencies": {
"ejs": "^3.1.10"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/argparse": { "node_modules/argparse": {
@ -13,6 +32,153 @@
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
}, },
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
"dev": true,
"license": "MIT"
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true,
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"license": "MIT"
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true,
"license": "MIT"
},
"node_modules/ejs": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
"integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"jake": "^10.8.5"
},
"bin": {
"ejs": "bin/cli.js"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"minimatch": "^5.0.1"
}
},
"node_modules/filelist/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/filelist/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/jake": {
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz",
"integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"async": "^3.2.3",
"chalk": "^4.0.2",
"filelist": "^1.0.4",
"minimatch": "^3.1.2"
},
"bin": {
"jake": "bin/cli.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
@ -23,6 +189,32 @@
"bin": { "bin": {
"js-yaml": "bin/js-yaml.js" "js-yaml": "bin/js-yaml.js"
} }
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
} }
} }
} }

View File

@ -1,5 +1,8 @@
{ {
"dependencies": { "dependencies": {
"js-yaml": "^4.1.0" "js-yaml": "^4.1.0"
},
"devDependencies": {
"ejs": "^3.1.10"
} }
} }