dodati dinamicku boju, slike, te lijepsi kod

This commit is contained in:
marin 2025-03-12 20:23:53 +01:00
parent d2872a8fbf
commit 1c216985f1
8 changed files with 122 additions and 106 deletions

View file

@ -1,8 +1,9 @@
from flask import Flask, render_template_string
from flask import Flask, render_template_string, send_file
import subprocess
import os
import re
import datetime
from waitress import serve
pocelo = datetime.datetime.now()
app = Flask(__name__)
visits = 0
@ -22,7 +23,11 @@ base_dir = os.path.abspath('..')
html_files = {
'index.html': os.path.join(base_dir, 'html', 'index.html'),
'projects.html': os.path.join(base_dir, 'html', 'projects.html'),
'contribute.html': os.path.join(base_dir, 'html', 'contribute.html')
'contribute.html': os.path.join(base_dir, 'html', 'contribute.html'),
'foss.jpg': os.path.join(base_dir, 'html', 'foss.jpg'),
'git.png': os.path.join(base_dir, 'html', 'git.png'),
'main.css': os.path.join(base_dir, 'html', 'main.css'),
'main.js': os.path.join(base_dir, 'html', 'main.js'),
}
visit_file = os.path.join(base_dir, 'visits.txt')
@ -62,10 +67,16 @@ def home():
@app.route('/<page>')
def other_pages(page):
if page in html_files:
if(not page.endswith('.html')):
if(page.endswith('.css')):
with open(html_files[page], 'rb') as file:
return send_file(html_files[page], mimetype="text/css")
with open(html_files[page], 'rb') as file:
return file.read()
content = replace_placeholders(html_files[page])
return content
else:
return "<h1>Stranica nije pronađena</h1>", 404
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8000)
serve(app,host='0.0.0.0', port=8000)

View file

@ -1,41 +1,11 @@
<!DOCTYPE html>
<html lang="hr">
<head>
<script defer src="main.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kako doprinijeti Open Source zajednici</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
text-align: center;
}
nav {
background: #333;
padding: 10px;
}
nav a {
color: white;
text-decoration: none;
margin: 15px;
font-size: 18px;
}
.container {
max-width: 800px;
margin: auto;
background: white;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
border-radius: 10px;
}
ul {
text-align: left;
margin-left: 20px;
}
</style>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
{{nav}}
@ -53,6 +23,7 @@
</ul>
<p>Pridružite se open-source zajednici i doprinesite razvoju besplatnog softvera! Svaka mala pomoć je značajna.</p>
</div>
</div>
{{footer}}
</body>
</html>

BIN
html/foss.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
html/git.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,48 +1,11 @@
<!DOCTYPE html>
<html lang="hr">
<head>
<script defer src="main.js"></script>
<link rel="stylesheet" type="text/css" href="main.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dobrodošli u Open Source Svijet</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
text-align: center;
}
nav {
background: #333;
padding: 10px;
}
nav a {
color: white;
text-decoration: none;
margin: 15px;
font-size: 18px;
}
.container {
max-width: 800px;
margin: auto;
background: white;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
border-radius: 10px;
}
.section {
margin: 40px 0;
}
.section h2 {
font-size: 24px;
margin-bottom: 10px;
}
.section p {
font-size: 18px;
line-height: 1.6;
}
</style>
</head>
<body>
{{nav}}
@ -67,6 +30,11 @@
<li><strong>Bolja sigurnost:</strong> Otvoreni kod omogućava brzo prepoznavanje i ispravljanje sigurnosnih propusta, čineći FOSS sigurnijim od mnogih komercijalnih alternativa.</li>
</ul>
</div>
<div class="image-container">
<img src="foss.jpg" alt="FOSS Logo">
<span class="image-caption">Logo free and open source softvera</span>
</div>
{{footer}}
</body>
</html>

72
html/main.css Normal file
View file

@ -0,0 +1,72 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
text-align: center;
}
nav {
background: #333;
padding: 10px;
}
nav a {
color: white;
text-decoration: none;
margin: 15px;
font-size: 18px;
}
.container {
max-width: 800px;
margin: auto;
background: white;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
border-radius: 10px;
}
.image-container {
display: inline-block;
position: relative;
border: 2px solid black;
padding: 5px;
}
.image-container img {
display: block;
max-width: 100%;
height: auto;
}
.image-caption {
position: absolute;
bottom: 5px;
right: 5px;
background: rgba(0, 0, 0, 0.6);
color: white;
font-size: 12px;
padding: 2px 5px;
border-radius: 3px;
}
.section {
margin: 40px 0;
}
.section h2 {
font-size: 24px;
margin-bottom: 10px;
}
.section p {
font-size: 18px;
line-height: 1.6;
}
ul {
text-align: left;
margin-left: 20px;
}

19
html/main.js Normal file
View file

@ -0,0 +1,19 @@
function updateBackgroundColor() {
const now = new Date();
const hours = now.getHours();
let color = "#FFFFFF";
if (hours >= 6 && hours < 12) {
color = "#FFFAE3";
} else if (hours >= 12 && hours < 18) {
color = "#C7E9FB";
} else if (hours >= 18 && hours < 21) {
color = "#FFB87A";
} else {
color = "#1E1E30";
}
document.body.style.backgroundColor = color;
}
window.onload = () => {
updateBackgroundColor();
setInterval(updateBackgroundColor, 60000);
};

View file

@ -1,41 +1,11 @@
<!DOCTYPE html>
<html lang="hr">
<head>
<script defer src="main.js"></script>
<link rel="stylesheet" type="text/css" href="main.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Open Source Projekti</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
text-align: center;
}
nav {
background: #333;
padding: 10px;
}
nav a {
color: white;
text-decoration: none;
margin: 15px;
font-size: 18px;
}
.container {
max-width: 800px;
margin: auto;
background: white;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
border-radius: 10px;
}
ul {
text-align: left;
margin-left: 20px;
}
</style>
</head>
<body>
{{nav}}
@ -54,6 +24,11 @@
<li><strong><a href="https://www.apache.org/" target="_blank">Apache HTTP Server</a></strong> Jedan od najpopularnijih web poslužitelja na svijetu, Apache omogućuje hosting web stranica i aplikacija s velikim brojem opcija za prilagodbu i proširenje putem modula.</li>
</ul>
</div>
<div class="image-container">
<img src="git.png" alt="Git logo" style="width: 50%; height: 50%;">
<span class="image-caption">Logo Git-a, kojeg ova stranica također
koristi</span>
</div>
{{footer}}
</body>
</html>