Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 GitHub - cyprich/filamenty: Semestrálna práca z predmetu Unix - Vývojové prostredie
Nothing Special   »   [go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

cyprich/filamenty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filamenty

Fullstack webová aplikácia na správu filamentov do 3D tlačiarne

Aplikácia umožňuje vytvoriť zoznam filamentov a následne v ňom upravovať, pridávať a odoberať filamenty
Navyše aplikácia generuje pre filamenty štítky s QR kódami, ktoré po naskenovaní umožňujú jednoducho spravovať dané filamenty



Obsah

Použité technológie

  • Backend
    • Python - Hlavný programovací jazyk
    • Flask - Webový framework na vytvorenie API a obsluhu požiadaviek
    • SQLite - Databáza na uchovávanie informácií o filamentoch
    • qrcode - Python knižnica na generovanie QR kódov
  • Frontend
    • React a JavaScript - Tvorba dynamického používateľského rozhrania
    • Tailwind CSS - CSS framework na vizuálne formátovanie webovej aplikácie
    • Axios - Vykonávanie HTTP požiadaviek
  • Ostatné
    • Docker a docker-compose - Kontajnerizácia pre jednoduchšie nasadenie aplikácie

Požiadavky a spúštanie aplikácie

  1. Klonovanie Git repozitára
    • Repozitár je verejne dostupný na GitHub
    • Uistite sa, že máte nainštalovaný git, a spustite nasledovný príkaz
      • git clone https://github.com/cyprich/filamenty filamenty
    • Následne sa presuňte do priečinku klonovaného repozitára
      • cd filamenty
  2. Inštalácia potrebných balíčkov
    • docker
    • docker-compose
    • Konkrétny príkaz na inštaláciu balíčkov závisí od vašej Linux distribúcie, napr.:
      • sudo apt install docker docker-compose pre Ubunutu-based distribúcie
      • sudo pacman -Syu docker docker-compose pre Arch-based distribúcie
  3. Spustenie systémových procesov pre Docker
    • sudo systemctl start docker
    • sudo systemctl enable docker - nepovinné - automaticky spustí proces pri bootovaní zariadenia
  4. Pridanie používateľa do skupiny docker
    • sudo usermod -aG docker ${USER}
  5. Používateľ sa musí odhlásiť a znova prihlásiť pre aplikovanie zmien
  6. Inicializácia pred prvým spustením na novom zariadení
    • Inicializáciu je možné vykonať spustením súboru init.sh príkazom ./init.sh
    • Vykonávajú sa tieto 2 kroky:
      • Nastavenie IP adresy
        • Zistite IP adresu vášho zariadenia cez GUI (v nastaveniach) alebo pomocou príkazu ip -c address
        • IP adresa by mala vyzerať nejak takto: 192.168.1.100
      • Nepovinné - naplnenie databázy počiatočnými hodnotami
        • Pozor! - spustenie súboru vymaže všetky údaje v terajšej databáze bez možnosti návratu!
        • Na spustenie súboru je potrebné mať nainštalovaný balíček python3
  7. Spustenie aplikácie pomocou súboru run.sh
    • ./run.sh
  8. Príkazový riadok nechajte otvorený
  9. Aplikáciu zobrazíte vo webovom prehliadači na adrese http://vaša_IP_adresa:3000 alebo http://localhost:3000
  10. Pre zastavenie aplikácie použite klávesovú skratku ctrl + c v príkazovom riadku

Databáza

Štruktúra tabuľky filaments

Názov hodnoty Typ Popis
id INTEGER Jednoznačný číselný identifikátor filamentu, určuje sa automaticky
vendor TEXT Výrobca filamentu
meterial TEXT Materiál filamentu (napr. PLA, TPU)
price REAL Cena filamentu
color_hex TEXT Farba filamentu reprezentovaná hexadecimálnym kódom farby (napr. #111111)
color_second_hex TEXT Sekundárna farba filamentu reprezentovaná hexadecimálnym kódom farby (nepovinné, iba pri viacfarebných filamentoch)< 7440 /td>
weight INT Aktuálne zostávajúca hmotnosť filamentu + hmotnosť cievky, na ktorej je filament navinutý (v gramoch)
weight_orig INT Pôvodná hmotnosť filamentu (v gramoch)
weight_spool INT Hmotnosť cievky, na ktorej je filament navinutý (v gramoch)
temp_min INT Minimálna odporúčaná teplota tlače (v stupňoch Celzia)
temp_max INT Maximálna odporúčaná teplota tlače (v stupňoch Celzia)
temp_bed_min INT Minimálna odporúčaná teplota podložky (v stupňoch Celzia)
temp_bed_max INT Maximálna odporúčaná teplota podložky (v stupňoch Celzia)
image_url TEXT URL adresa obrázku filamentu
  • Stĺpec id je primárny kľúč databázy
  • Kombinácia stĺpcov vendor, material a color_hex je unikátna (v databáze nemôžu existovať dva filamenty s rovnakým výrobcom, materiálom a farbou)

Príklad záznamov

id vendor material price color_hex color_second_hex weight weight_orig weight_spool temp_min temp_max temp_bed_min temp_bed_max image_url
1 Bambu Lab PLA 29.99 #111111 NULL 290 1000 250 190 230 45 65 http://192.168.1.10/api/images/filaments/1.png
2 eSun Silk PLA 25.99 #e41e95 #123cea 876 1000 220 190 230 45 60 http://192.168.1.10/api/images/filaments/2.png
3 Fiberlogy TPU 40D 25.30 #222222 NULL 438 500 250 200 220 50 70 http://192.168.1.10/api/images/filaments/3.png

API

Base URL: http://localhost:5000/api/

GET http://localhost:5000/api/

Vráti uvítaciu správu od backendu

Response

{
  "message": "Hello from backend!"
}

GET http://localhost:5000/api/filaments/

Vráti informácie o všetkých filamentoch

Response

{
{
  "filaments": [
    {
      "color_hex": "#111",
      "color_second_hex": null,
      "id": 1,
      "image_url": "http://192.168.1.10:5000/api/images/filaments/1.png",
      "material": "PLA",
      "price": 29.99,
      "temp_bed_max": 65,
      "temp_bed_min": 45,
      "temp_max": 230,
      "temp_min": 190,
      "vendor": "Bambu Lab",
      "weight": 0,
      "weight_orig": 1000,
      "weight_spool": 250
    },
    {
      "color_hex": "#c12e1f",
      "color_second_hex": null,
      "id": 2,
      "image_url": "http://192.168.1.10:5000/api/images/filaments/2.png",
      "material": "PLA",
      "price": 29.99,
      "temp_bed_max": 65,
      "temp_bed_min": 45,
      "temp_max": 230,
      "temp_min": 190,
      "vendor": "Bambu Lab",
      "weight": 290,
      "weight_orig": 1000,
      "weight_spool": 250
    }
  ]
}
}

POST http://localhost:5000/api/filaments/

Pridá nový filament do databázy

Body (form data)

vendor: "ABC"
material: "XYZ"
price: "19.99"
color_hex: "#ffffff"
weight: "500"
weight_orig: "1000"
weight_spool: "250"
temp_min: "200"
temp_max: "220"
temp_bed_min: "50"
temp_bed_max: "60"
image: <file>

Response

{
  "filaments": {
    "color_hex": "#ffffff",
    "color_second_hex": null,
    "id": 3,
    "image_url": "http://192.168.1.10:5000/api/images/filaments/3.png",
    "material": "XYZ",
    "price": 19.99,
    "temp_bed_max": 60,
    "temp_bed_min": 50,
    "temp_max": 220,
    "temp_min": 200,
    "vendor": "ABC",
    "weight": 500,
    "weight_orig": 1000,
    "weight_spool": 250
  }
}

GET http://localhost:5000/api/filaments/<int:id>/

Vráti informácie o konkrétnom filamente na základe id

Response

{
  "filaments": {
    "color_hex": "#73bab5",
    "color_second_hex": null,
    "id": 4,
    "image_url": "http://192.168.1.10:5000/api/images/filaments/4.png",
    "material": "PLA+",
    "price": 23.9,
    "temp_bed_max": null,
    "temp_bed_min": 60,
    "temp_max": 210,
    "temp_min": 190,
    "vendor": "Filament PM",
    "weight": 870,
    "weight_orig": 1000,
    "weight_spool": 216
  }
}

PUT http://localhost:5000/api/filaments/<int:id>/

Aktualizuje informáciu o konkrétnom filamente na základe id

Body (JSON)

{
  "key": "weight",
  "value": "199"
}

Response

{
  "filaments": {
    "color_hex": "#111111",
    "color_second_hex": null,
    "id": 1,
    "image_url": "http://192.168.1.10:5000/api/images/filaments/1.png",
    "material": "PLA",
    "price": 29.99,
    "temp_bed_max": 65,
    "temp_bed_min": 45,
    "temp_max": 230,
    "temp_min": 190,
    "vendor": "Bambu Lab",
    "weight": 199,
    "weight_orig": 1000,
    "weight_spool": 250
  }
}

DELETE http://localhost:5000/api/filaments/<int:id>/

Vymaže konkrétny filament na základe id

Response

{
  "filaments": {
    "color_hex": "#111111",
    "color_second_hex": null,
    "id": 1,
    "image_url": "http://192.168.1.10:5000/api/images/filaments/1.png",
    "material": "PLA",
    "price": 29.99,
    "temp_bed_max": 65,
    "temp_bed_min": 45,
    "temp_max": 230,
    "temp_min": 190,
    "vendor": "Bambu Lab",
    "weight": 199,
    "weight_orig": 1000,
    "weight_spool": 250
  }
}

GET http://locahost:5000/api/filaments/random/

Vráti informácie o filamente

Response

{
  "filaments": {
    "color_hex": "#111111",
    "color_second_hex": null,
    "id": 1,
    "image_url": "http://192.168.1.10:5000/api/images/filaments/1.png",
    "material": "PLA",
    "price": 29.99,
    "temp_bed_max": 65,
    "temp_bed_min": 45,
    "temp_max": 230,
    "temp_min": 190,
    "vendor": "Bambu Lab",
    "weight": 199,
    "weight_orig": 1000,
    "weight_spool": 250
  }
}

GET http://locahost:5000/api/info/

Vráti všeobecné informácie of filamentoch v databáze

Response

{
  "filament_count": 15,
  "ids": [2, 4, 6, 7, 8],
  "invalid_ids": [1, 3, 5]
}

Použité zdroje

Popis Autor Súbor Link
Dokumentácia Python knižnice qrcode Lincoln Loop backend/generate_qrcodes.py riadky 45 - 50 https://pypi.org/project/qrcode/
Dokumentácia Tailwind CSS Tailwind Labs Inc. frontend/src/Filaments.jsx riadky 27 - 89 https://tailwindcss.com/
Článok "How to use Axios With React" Reed frontend/src/Filaments.jsx riadky 18 - 24 https://www.freecodecamp.org/news/how-to-use-axios-with-react/
Článok "How to upload files in React app using Axios?" Ushna Ijaz frontend/src/AddFilament.jsx riadky 31 - 65 https://rapidapi.com/guides/upload-files-react-axios
Príspevok "Get the data received in a Flask request" na Stack Overflow bkoiki950 backend/main.py riadok 118 https://stackoverflow.com/a/69941645
Hlavná ikonka stránky Freepik frontend/src/images/icon.png
frontend/public/favicon.ico
https://www.flaticon.com/free-icon/3d-printing-filament_2442882
Ikonka pre chýbajúci obrázok Vectorink backend/images/filaments/unknown.png https://en.m.wikipedia.org/wiki/File:Icon-round-Question_mark.svg
Ostatné použité ikonky Ilham Fitroutul Hayat frontend/src/images/edit.png
frontend/src/images/delete.png
https://www.flaticon.com/search?author_id=448&style_id=1223
Obrázky filamentov Bambu Lab EU
Plasty Mladeč
eSun
Majkl3D-Technology s.r.o.
Prusa Research a.s.
Všetky súbory v priečinku backend/images/filaments eu.store.bambulab.com
www.filament-pm.cz
esun3dstoreeu.com
www.majkl3d.sk
www.prusa3d.com

Upozornenie

Tento repozitár obsahuje moje riešenia zadaní, prípadne semestrálnej práce
Kód je zverejnený výhradne na vzdelávacie účely ako inšpirácia pre ostatných
Použitie tohto kódu na odovzdanie ako vlastné riešenie (plagiátorstvo) je prísne zakázané a môže viesť k disciplinárnym opatreniam
Ak si z tohto repozitára beriete inšpiráciu, uistite sa, že rozumiete riešeniam a vytvorte si vlastnú implementáciu
Autor nenesie zodpovednosť za akékoľvek následky vyplývajúce z nesprávneho použitia tohto materiálu, vrátane prípadných obvinení z plagiátorstva


0