diff --git a/code/main.py b/code/main.py index dc9cf46..7bd3202 100644 --- a/code/main.py +++ b/code/main.py @@ -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('/') 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 "

Stranica nije pronađena

", 404 if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0', port=8000) + serve(app,host='0.0.0.0', port=8000) diff --git a/html/contribute.html b/html/contribute.html index d0a03cc..af929d6 100644 --- a/html/contribute.html +++ b/html/contribute.html @@ -1,41 +1,11 @@ + Kako doprinijeti Open Source zajednici - + {{nav}} @@ -53,6 +23,7 @@

Pridružite se open-source zajednici i doprinesite razvoju besplatnog softvera! Svaka mala pomoć je značajna.

+ {{footer}} diff --git a/html/foss.jpg b/html/foss.jpg new file mode 100644 index 0000000..0792044 Binary files /dev/null and b/html/foss.jpg differ diff --git a/html/git.png b/html/git.png new file mode 100644 index 0000000..fc72354 Binary files /dev/null and b/html/git.png differ diff --git a/html/index.html b/html/index.html index b7202bd..82b51c0 100644 --- a/html/index.html +++ b/html/index.html @@ -1,48 +1,11 @@ + + Dobrodošli u Open Source Svijet - {{nav}} @@ -67,6 +30,11 @@
  • Bolja sigurnost: Otvoreni kod omogućava brzo prepoznavanje i ispravljanje sigurnosnih propusta, čineći FOSS sigurnijim od mnogih komercijalnih alternativa.
  • +
    + FOSS Logo + Logo free and open source softvera +
    + {{footer}} diff --git a/html/main.css b/html/main.css new file mode 100644 index 0000000..02307b6 --- /dev/null +++ b/html/main.css @@ -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; +} diff --git a/html/main.js b/html/main.js new file mode 100644 index 0000000..c163ef7 --- /dev/null +++ b/html/main.js @@ -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); +}; diff --git a/html/projects.html b/html/projects.html index 2fe1aa0..cd5db69 100644 --- a/html/projects.html +++ b/html/projects.html @@ -1,41 +1,11 @@ + + Open Source Projekti - {{nav}} @@ -54,6 +24,11 @@
  • Apache HTTP Server – 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.
  • +
    + Git logo + Logo Git-a, kojeg ova stranica također + koristi +
    {{footer}}