Compare commits

..

No commits in common. "4bcd13a713391c67871029cda337853ddc85f51b" and "005fba6010d5283ddf0bbd0cb2b35e4446817e57" have entirely different histories.

13 changed files with 119 additions and 161 deletions

1
.gitignore vendored
View File

@ -1,6 +1,5 @@
venv/ venv/
site/*.html site/*.html
site/en/*.html
site/atom_blog.xml site/atom_blog.xml
site/atom_events.xml site/atom_events.xml
poster.html poster.html

View File

@ -9,11 +9,10 @@ PAGES = [
{'name': 'webring', 'titleSR': 'Webring', 'titleEN': 'Webring', 'style': ''}, {'name': 'webring', 'titleSR': 'Webring', 'titleEN': 'Webring', 'style': ''},
] ]
def buildPage(filename: str, pageTitle: str, pageHtml: str, pageStyle: str, template: str) -> str: def buildPage(pageTitle: str, pageHtml: str, pageStyle: str, template: str) -> str:
template = template.replace('<!--TITLE-->', pageTitle) template = template.replace('<!--TITLE-->', pageTitle)
style = '' if not pageStyle else f'<link rel=\"stylesheet\" href=\"/styles/{pageStyle}.css\">' style = '' if not pageStyle else f'<link rel=\"stylesheet\" href=\"/styles/{pageStyle}.css\">'
template = template.replace('<!--ADDITIONAL_STYLE-->', style) template = template.replace('<!--ADDITIONAL_STYLE-->', style)
template = template.replace('PAGE_NAME', filename)
template = template.replace('<!--MAIN-->', pageHtml) template = template.replace('<!--MAIN-->', pageHtml)
return template return template
@ -25,16 +24,10 @@ def main():
for page in PAGES: for page in PAGES:
with open(f'pages/sr/{page["name"]}.html') as f: with open(f'pages/sr/{page["name"]}.html') as f:
pageHtml = f.read() pageHtml = f.read()
html = buildPage(page['name'], page['titleSR'], pageHtml, page['style'], templateSR) html = buildPage(page['titleSR'], pageHtml, page['style'], templateSR)
f = open(f'site/{page["name"]}.html', 'w') f = open(f'site/{page["name"]}.html', 'w')
f.write(html) f.write(html)
f.close() f.close()
with open(f'pages/en/{page["name"]}.html') as f:
pageHtml = f.read()
html = buildPage(page['name'], page['titleEN'], pageHtml, page['style'], templateEN)
f = open(f'site/en/{page["name"]}.html', 'w')
f.write(html)
f.close()
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -1,7 +0,0 @@
<p>If you have created an account on dmz.rs, you can use our XMPP and e-mail server, as well as other services that support LDAP login.<p>
<p>For more on XMPP see <a href="https://wiki.dmz.rs/en/tutorial/conversations">this tutorial</a>. <p>
<p>You can see settings for the <a href="https://thunderbird.org">Thundebird</a> mail client on this <a href="/img/mailsettings.png">image</a>.<p>
<p><a href="/account/register/">Register</a><p>
<p><a href="/account/unregister/">Delete account</a><p>
<p><a href="/account/changepassword/">Change password</a><p>

View File

@ -1,5 +0,0 @@
<h1>Contact</h1>
<p>You can send mail to <a href="mailto:dmz@dmz.rs">dmz@dmz.rs</a> or you can register on <a href="https://forum.dmz.rs">our Forum</a>.</p>
<p>Also, we are available on the <a href="https://balkan.fedive.rs/@decentrala">Fediverse!</a></p>
<br>
<p>If you find a bug on the site, please do tell us. We would be very grateful.</p>

View File

@ -1 +0,0 @@
<h1>Events</h1>

View File

@ -1,31 +0,0 @@
<h1>Welcome!</h1>
<p>
We are <em>Decentrala</em> - a group of enthusiasts gathered around the idea of decentralization and knowledge sharing.
Here are some more facts about us:
</p>
<dl>
<dt>Knowledge:</dt>
<dd>
All our workshops are free and open to everyone.
Also, if you have something to share, feel free to announce the event on the <a href="https://forum.dmz.rs"></a>Forum</a>.
</dd>
<dt>Actions:</dt>
<dd>From time to time we organize actions, hackathons, crypto parties, exhibitions, etc.</dd>
<dt>Services:</dt>
<dd>Our servers run various services (like e-mail, git, wiki, etc...) that are open to everyone.</dd>
<dt>Donations:</dt>
<dd>
Decentrala accepts donations exclusively from persons and without any obligations.
We are independent and we try to keep it that way.
You can donate old hardware (laptops, phones, PC components) to us, and we will find a use for it in Decentrala or give it to people who need it.
Also, you can donate bitcoin and monero by sending to the following addresses:
<p>Bitcoin: bc1qjhsfgq79wuzzv32yml9zglwzf9qcwfj3atuy74</p>
<p>Monero: 8BESz45LnxrgCwZP32KieiN1D4LinCfsS1YjdFHfGXrVCmPs35167QsW1gd7qbff4UAtBbT6oWrkbfZnJm71HornVRiRZFS</p>
</dd>
</dl>
<p>
If you are still interested, you can create an <a href="/en/account">account</a>
on our server which will enable the use of all our <a href="/en/services">services</a>.
If you want to see first how it all looks, you can come to one of our
<a href="/en/events">event</a>, and meet us there!
</p>

View File

@ -1,54 +0,0 @@
<h1>Services</h1>
<table>
<tr>
<th>Service</th>
<th>Description</th>
</tr>
<tr>
<td><a href="/account">E-mail</a></td>
<td>E-mail account that you can use with any e-mail client (for example, with the <a href="https://www.thunderbird.net/">Thunderbird</a>).</td>
</tr>
<tr>
<td><a href="https://forum.dmz.rs/">Forum</a></td>
<td>Forum for general discussion and <a href="/events">event</a> organization.</td>
</tr>
<tr>
<td>Chat</td>
<td>
We have our XMPP server, on which you can make an account.
If you already have an account, you can find us at group <a href="decentrala@conference.dmz.rs">decentrala@conference.dmz.rs</a>.
</td>
</tr>
<tr>
<td><a href="https://gitea.dmz.rs/">Git</a></td>
<td><a href="https://gitea.io/en-us/">Gitea</a> instance on which we host our code and resources (including the code for this site).
</td>
</tr>
<tr>
<td><a href="https://wiki.dmz.rs/">Wiki</a></td>
<td><a href="https://js.wiki/">Wiki.js</a> instance on which we publish documentation for our projects,
<a href="/events">events</a> resources, and tutorials.
</td>
</tr>
<tr>
<td><a href="https://search.dmz.rs/">Search</a></td>
<td><a href="https://github.com/searxng/searxng/">SearXNG</a> instance used for Web searching.</td>
</tr>
<tr>
<td><a href="https://pastebin.dmz.rs/">Pastebin</a></td>
<td><a href="https://privatebin.info/">PrivateBin</a> instance we use for sharing text files</td>
</tr>
<tr>
<td><a href="ssh://soft.dmz.rs:2222/">Soft Serve</a></td>
<td>
<a href="https://github.com/charmbracelet/soft-serve">Soft Serve</a> instance that we use as a replacement for the Gitea service.
Soft Serve works entirely from the terminal.
</td>
</tr>
</table>
<p>
These are some of the services we currently maintain on our servers.
To use these services, you can register for each service separately,
or you can create a unique <a href="/pages/account.html">account</a>
on our server and use all services with the same account.
</p>

View File

@ -1,3 +0,0 @@
<ul>
<li><a href="https://tilde.zone/explore">Tilde Zone</a></li>
</ul>

View File

@ -1 +1,59 @@
<h1>Događaji</h1> <h1>Događaji</h1>
<table>
<tbody>
<tr>
<th>Datum</th>
<th>Vreme</th>
<th>Mesto</th>
<th>Tema</th>
</tr>
<tr>
<td> Ponedeljak, 7. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Linux ricing </td>
</tr>
<tr>
<td> Utorak, 8. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Lambda račun </td>
</tr>
<tr>
<td> Ponedeljak, 14. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Linux distro diskusija </td>
</tr>
<tr>
<td> Utorak, 15. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Pirati 777 mora </td>
</tr>
<tr>
<td> Ponedeljak, 21. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Python vežbe </td>
</tr>
<tr>
<td> Utorak, 22. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Autentifikacija na internetu </td>
</tr>
<tr>
<td> Ponedeljak, 28. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Podešvanje Mail servera </td>
</tr>
<tr>
<td> Utorak, 29. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Prevođenje wiki-ja </td>
</tr>
</tbody>
</table>

85
prep.py
View File

@ -3,16 +3,30 @@
from datetime import datetime from datetime import datetime
from functools import cmp_to_key from functools import cmp_to_key
DAYS_SR = ["Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota", "Nedelja"] days = [
DAYS_EN = ["Monday ", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] "Ponedeljak",
MONTHS_SR = [ "Utorak",
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Sreda",
"Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar", "Četvrtak",
] "Petak",
MONTHS_EN = [ "Subota",
"January", "February", "March", "April", "May", "June", "Nedelja",
"July", "August", "September", "October", "November", "December", ]
]
months = [
"Januar",
"Februar",
"Mart",
"April",
"Maj",
"Jun",
"Jul",
"Avgust",
"Septembar",
"Oktobar",
"Novembar",
"Decembar",
]
today = datetime.today().date() today = datetime.today().date()
@ -52,41 +66,36 @@ def sort_events(events):
return sorted(events, key = cmp_to_key(compare_events)) return sorted(events, key = cmp_to_key(compare_events))
def build_html(events, dayNames, monthNames):
newevents = []
for event in events:
date, time, location, title = event.split(", ")
date = parse_date(date)
if is_past_event(date):
continue
date = dayNames[date.weekday()]+", "+str(date.day)+". "+monthNames[date.month-1]+" "+str(date.year)+"."
time = time+"h"
future_event = []
future_event.append("<td> "+date+" </td>")
future_event.append("<td> "+time+" </td>")
if "https://" in location:
place,link = location.split("https://")
future_event.append("<td> <a href=\"https://"+link+"\""+"> "+place.strip()+" </a> </td>")
else:
future_event.append("<td> "+location.strip()+" </td>")
future_event.append("<td> "+title+" </td>")
newevents.append("<tr>\n"+"\n".join(future_event)+"\n</tr>")
return newevents
events = load_events() events = load_events()
events = sort_events(events) events = sort_events(events)
write_events(events) write_events(events)
newevents = build_html(events, DAYS_SR, MONTHS_SR) newevents = []
for event in events:
date, time, location, title = event.split(", ")
date = parse_date(date)
if is_past_event(date):
continue
date = days[date.weekday()]+", "+str(date.day)+". "+months[date.month-1]+" "+str(date.year)+"."
time = time+"h"
future_event = []
future_event.append("<td> "+date+" </td>")
future_event.append("<td> "+time+" </td>")
if "https://" in location:
place,link = location.split("https://")
future_event.append("<td> <a href=\"https://"+link+"\""+"> "+place.strip()+" </a> </td>")
else:
future_event.append("<td> "+location.strip()+" </td>")
future_event.append("<td> "+title+" </td>")
newevents.append("<tr>\n"+"\n".join(future_event)+"\n</tr>")
with open("pages/sr/events.html","wt") as file: with open("pages/sr/events.html","wt") as file:
file.writelines(["<h1>Događaji</h1>\n", "<table>\n", "<tr><th>Datum</th><th>Vreme</th><th>Mesto</th><th>Tema</th></tr>\n"]) file.writelines(["<h1>Događaji</h1>\n", "<table>\n", "<tr><th>Datum</th><th>Vreme</th><th>Mesto</th><th>Tema</th></tr>\n"])
file.writelines(newevents) file.writelines(newevents)
file.writelines(["</table>"]) file.writelines(["</table>"])
newevents = build_html(events, DAYS_EN, MONTHS_EN) #with open("pages/en/events.html","wt") as file:
# file.writelines(["<h1>Events</h1>", "<table>", "<tr>\n<th>Date</th>\n<th>Time</th>\n<th>Place</th>\n<th>Theme</th>\n</tr>"])
with open("pages/en/events.html","wt") as file: # file.writelines(events)
file.writelines(["<h1>Events</h1>\n", "<table>\n", "<tr><th>Date</th><th>Time</th><th>Place</th><th>Topic</th></tr>"]) # file.writelines(["</table>"])
file.writelines(newevents)
file.writelines(["</table>"])

View File

@ -111,7 +111,7 @@ a:focus {
background: linear-gradient(90deg, var(--hightlight) 0%, var(--hightlight) 50%, var(--bg) 51%, var(--bg) 100%); background: linear-gradient(90deg, var(--hightlight) 0%, var(--hightlight) 50%, var(--bg) 51%, var(--bg) 100%);
} }
.lang { .account {
font-size: 2rem; font-size: 2rem;
} }
@ -210,4 +210,8 @@ screen and (max-width: 1500px) {
#theme-switcher { #theme-switcher {
margin-right: 1rem; margin-right: 1rem;
} }
.account {
font-size: 1rem;
}
} }

View File

@ -9,13 +9,12 @@
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<script src="/scripts/main.js" defer></script> <script src="/scripts/main.js" defer></script>
<title><!--TITLE--> Decentrala</title> <title><!--TITLE--> Decentrala</title>
<link rel="alternate" hreflang="sr" href="/PAGE_NAME" />
</head> </head>
<body> <body>
<header> <header>
<a id="logo" href="/en/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a> <a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
<button id="theme-switcher"></button> <button id="theme-switcher"></button>
<a class="lang" hreflang="sr" href="/PAGE_NAME">SR</a> <a class="account" href="/en/account">Account</a>
</header> </header>
<main> <main>
<!--MAIN--> <!--MAIN-->
@ -23,10 +22,9 @@
<footer> <footer>
<button id="sections-button" opened="false"><img src="/img/strelica-closed-light.svg" alt="OpenMenu"></button> <button id="sections-button" opened="false"><img src="/img/strelica-closed-light.svg" alt="OpenMenu"></button>
<nav> <nav>
<a href="/en/events">Events</a> <a href="/en/events">Događaji</a>
<a href="/en/services">Services</a> <a href="/en/services">Servisi</a>
<a href="/en/contact">Contact</a> <a href="/en/contact">Kontakt</a>
<a href="/en/account">Account</a>
</nav> </nav>
<span class="links"> <span class="links">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a> <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>

View File

@ -9,13 +9,12 @@
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<script src="/scripts/main.js" defer></script> <script src="/scripts/main.js" defer></script>
<title><!--TITLE--> Decentrala</title> <title><!--TITLE--> Decentrala</title>
<link rel="alternate" hreflang="en" href="/en/PAGE_NAME" />
</head> </head>
<body> <body>
<header> <header>
<a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a> <a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
<button id="theme-switcher"></button> <button id="theme-switcher"></button>
<a class="lang" hreflang="en" href="/en/PAGE_NAME">EN</a> <a class="account" href="/account">Nalog</a>
</header> </header>
<main> <main>
<!--MAIN--> <!--MAIN-->
@ -26,7 +25,6 @@
<a href="/events">Događaji</a> <a href="/events">Događaji</a>
<a href="/services">Servisi</a> <a href="/services">Servisi</a>
<a href="/contact">Kontakt</a> <a href="/contact">Kontakt</a>
<a class="account" href="/account">Nalog</a>
</nav> </nav>
<span class="links"> <span class="links">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a> <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>