summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-06-08 16:03:42 +0200
committerGitHub <noreply@github.com>2020-06-08 16:03:42 +0200
commit6d5e61259b562c058db335e24c72fe6db937c659 (patch)
tree386288c539024d6692c8244e491e1828090dfc91
parentMerge pull request #22 from beziapp/dev (diff)
parentfixed grades for edge-case and removed performance optimizations (diff)
downloadbeziapp-6d5e61259b562c058db335e24c72fe6db937c659.tar
beziapp-6d5e61259b562c058db335e24c72fe6db937c659.tar.gz
beziapp-6d5e61259b562c058db335e24c72fe6db937c659.tar.bz2
beziapp-6d5e61259b562c058db335e24c72fe6db937c659.tar.lz
beziapp-6d5e61259b562c058db335e24c72fe6db937c659.tar.xz
beziapp-6d5e61259b562c058db335e24c72fe6db937c659.tar.zst
beziapp-6d5e61259b562c058db335e24c72fe6db937c659.zip
-rw-r--r--assets/css/styles.css4
-rw-r--r--assets/js/gsec.js14
-rw-r--r--assets/js/login.js2
-rwxr-xr-xdist/css/styles.css4
-rwxr-xr-xdist/js/app.js4
-rw-r--r--dist/js/gsec.js7
-rw-r--r--dist/js/login.js2
-rwxr-xr-xdist/pages/about.html4
-rwxr-xr-xdist/sw.js4
-rw-r--r--global.bvr2
-rw-r--r--server/freenomrenew.sh23
-rw-r--r--server/nadomescanja/output.pdfbin0 -> 1404099 bytes
-rwxr-xr-xserver/nadomescanja/script.sh21
13 files changed, 72 insertions, 19 deletions
diff --git a/assets/css/styles.css b/assets/css/styles.css
index 3f403e7..0e11125 100644
--- a/assets/css/styles.css
+++ b/assets/css/styles.css
@@ -424,4 +424,8 @@ h1, h2, h3, h4, h5, h6 {
.zakljucna-grade {
color: red;
+}
+
+ol {
+ color: var(--color-text) !important;
} \ No newline at end of file
diff --git a/assets/js/gsec.js b/assets/js/gsec.js
index 6cef90e..73e8fd2 100644
--- a/assets/js/gsec.js
+++ b/assets/js/gsec.js
@@ -481,7 +481,8 @@ class gsec {
let gradeSpans = parsed.getElementsByClassName("txtVOcObd");
for (const grade of gradeSpans) {
- var ist = grade.getElementsByTagName("span")[0].getAttribute("title").split("\n");
+ var whatever_ist_meant_in_my_head_back_then_but_as_a_string = grade.getElementsByTagName("span")[0].getAttribute("title");
+ var ist = whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("\n");
if (ist.length == 1) { // that means the txtVOcObd defines a zaključno oceno // gimsis is just utter crap
var gradeToAdd = {
"gradeType": GSEC_ZAKLJUCNA_GRADE,
@@ -496,11 +497,12 @@ class gsec {
var teacher = ist[1].split(": ")[1].trim();
var subject = ist[2].split(": ")[1].trim();
var name = [];
-
- name.push(ist[3].split(": ")[1].trim())
- name.push(ist[4].split(": ")[1].trim())
- name.push(ist[5].split(": ")[1].trim())
-
+
+ name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Ocenjevanje: ")[1].split("\nVrsta: ")[0].trim());
+ name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Vrsta: ")[1].split("\nRok: ")[0].trim())
+ name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Rok: ")[1].trim())
+ // prov predstavljam si enga profesorja, ke bo v polje Ocenjevanje vnesel "Vrsta: " in spet BREAKAL
+ // FKING algoritem.
var gradeNumber = Number(grade.getElementsByTagName("span")[0].innerHTML);
var temporary = grade.getElementsByTagName("span")[0].classList.contains("ocVmesna");
diff --git a/assets/js/login.js b/assets/js/login.js
index fc6dfcd..cdecf38 100644
--- a/assets/js/login.js
+++ b/assets/js/login.js
@@ -45,7 +45,7 @@ function login() {
localforage.setItem("username", username),
localforage.setItem("password", password)
];
- read_val(0);
+ // read_val(0);
Promise.all(promises_to_run).then(function () {
window.location.replace("/pages/timetable.html");
});
diff --git a/dist/css/styles.css b/dist/css/styles.css
index 3f403e7..0e11125 100755
--- a/dist/css/styles.css
+++ b/dist/css/styles.css
@@ -424,4 +424,8 @@ h1, h2, h3, h4, h5, h6 {
.zakljucna-grade {
color: red;
+}
+
+ol {
+ color: var(--color-text) !important;
} \ No newline at end of file
diff --git a/dist/js/app.js b/dist/js/app.js
index d44995d..f5c2f1b 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -2,8 +2,8 @@
-const app_version = "1.0.14.1-beta";
-const previous_commit = "ab895dc64437ac9ea42b2c9790a0b29550bdbc17";
+const app_version = "1.0.14.2-beta";
+const previous_commit = "c28c1c56dd807f620e916f9711d4c969817c6dd0";
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js")
diff --git a/dist/js/gsec.js b/dist/js/gsec.js
index 36d49a5..59d95bf 100644
--- a/dist/js/gsec.js
+++ b/dist/js/gsec.js
@@ -32,10 +32,9 @@ var dataToBeSent={"ctl00$ContentPlaceHolder1$edtDatZacetka":`${fromDate.getDay()
var absences=[];for(const izostanek of rowElements){var subFields=izostanek.getElementsByTagName("td");var date=subFields[0].innerHTML.trim().split(".");var dateObj=new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]}`));var subjects=[];subFields[2].innerHTML.match(SUBJECT_LIST_REGEX).forEach((subject)=>{subjects.push(subject);});var absencesBySubject={};for(const subject of subjects){const matched_info=FIELDS_REGEX.exec(subject);var subjectName=matched_info[1];var status=Number(matched_info[2]);var period=matched_info[3];period=period.includes("P")?Number(period.replace("P",""))+7:Number(period);absencesBySubject[period]={status:status,subject:subjectName};}
absences.push({subjects:absencesBySubject,date:dateObj});}
resolve(absences);});});}
-fetchGrades(){var grades=[];return new Promise((resolve,reject)=>{$.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"Page_Gim/Ucenec/OceneUcenec.aspx",cache:false,type:"GET",dataType:"html",processData:false,success:(data)=>{let parser=new DOMParser();let parsed=parser.parseFromString(data,"text/html");let gradeSpans=parsed.getElementsByClassName("txtVOcObd");for(const grade of gradeSpans){var ist=grade.getElementsByTagName("span")[0].getAttribute("title").split("\n");if(ist.length==1){var gradeToAdd={"gradeType":GSEC_ZAKLJUCNA_GRADE,"grade":Number(grade.getElementsByTagName("span")[0].innerHTML),"subject":grade.parentElement.parentElement.parentElement.parentElement.getElementsByTagName("th")[0].innerText}
-grades.push(gradeToAdd);}else{var date=ist[0].split(": ")[1].trim().split(".");var dateObj=new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]}`));var teacher=ist[1].split(": ")[1].trim();var subject=ist[2].split(": ")[1].trim();var name=[];name.push(ist[3].split(": ")[1].trim())
-name.push(ist[4].split(": ")[1].trim())
-name.push(ist[5].split(": ")[1].trim())
+fetchGrades(){var grades=[];return new Promise((resolve,reject)=>{$.ajax({xhrFields:{withCredentials:true},crossDomain:true,url:GSE_URL+"Page_Gim/Ucenec/OceneUcenec.aspx",cache:false,type:"GET",dataType:"html",processData:false,success:(data)=>{let parser=new DOMParser();let parsed=parser.parseFromString(data,"text/html");let gradeSpans=parsed.getElementsByClassName("txtVOcObd");for(const grade of gradeSpans){var whatever_ist_meant_in_my_head_back_then_but_as_a_string=grade.getElementsByTagName("span")[0].getAttribute("title");var ist=whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("\n");if(ist.length==1){var gradeToAdd={"gradeType":GSEC_ZAKLJUCNA_GRADE,"grade":Number(grade.getElementsByTagName("span")[0].innerHTML),"subject":grade.parentElement.parentElement.parentElement.parentElement.getElementsByTagName("th")[0].innerText}
+grades.push(gradeToAdd);}else{var date=ist[0].split(": ")[1].trim().split(".");var dateObj=new Date(Date.parse(`${date[2]}-${date[1]}-${date[0]}`));var teacher=ist[1].split(": ")[1].trim();var subject=ist[2].split(": ")[1].trim();var name=[];name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Ocenjevanje: ")[1].split("\nVrsta: ")[0].trim());name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Vrsta: ")[1].split("\nRok: ")[0].trim())
+name.push(whatever_ist_meant_in_my_head_back_then_but_as_a_string.split("Rok: ")[1].trim())
var gradeNumber=Number(grade.getElementsByTagName("span")[0].innerHTML);var temporary=grade.getElementsByTagName("span")[0].classList.contains("ocVmesna");var gradeToAdd={"gradeType":GSEC_NORMAL_GRADE,"date":dateObj,"teacher":teacher,"subject":subject,"name":name,"temporary":temporary,"grade":gradeNumber};if(grade.getElementsByTagName("span").length>1){if(grade.getElementsByTagName("span")[1].classList.contains("ocVmesna")){gradeToAdd["temporary"]=true;}else{gradeToAdd["temporary"]=false;}
gradeToAdd["grade"]=Number(grade.getElementsByTagName("span")[1].innerHTML);gradeToAdd["oldgrade"]=Number(grade.getElementsByTagName("span")[0].innerHTML);}
grades.push(gradeToAdd);}}
diff --git a/dist/js/login.js b/dist/js/login.js
index 2d79576..88cf081 100644
--- a/dist/js/login.js
+++ b/dist/js/login.js
@@ -2,4 +2,4 @@
document.addEventListener("DOMContentLoaded",()=>{setupEventListeners();})
function setupEventListeners(){$("#login-button").click(()=>{login();});window.addEventListener("keyup",(event)=>{if(event.keyCode===13){event.preventDefault();login();}});}
function login(){let username=$("#username").val();let password=$("#password").val();var gsecInstance;try{gsecInstance=new gsec();}catch(error){$.ajax({url:'js/gsec.js?ajaxload',async:false,dataType:"script",});try{gsecInstance=new gsec();}catch(error){alert(D("browserNotSupported"));}}
-gsecInstance.login(username,password).then((value)=>{if(typeof value=="string"){let promises_to_run=[localforage.setItem("logged_in",true),localforage.setItem("username",username),localforage.setItem("password",password)];read_val(0);Promise.all(promises_to_run).then(function(){window.location.replace("/pages/timetable.html");});}else{UIAlert("loginFailed");$("#password").val("");}}).catch((err)=>{gsecErrorHandlerUI(err);$("#password").val("");});} \ No newline at end of file
+gsecInstance.login(username,password).then((value)=>{if(typeof value=="string"){let promises_to_run=[localforage.setItem("logged_in",true),localforage.setItem("username",username),localforage.setItem("password",password)];Promise.all(promises_to_run).then(function(){window.location.replace("/pages/timetable.html");});}else{UIAlert("loginFailed");$("#password").val("");}}).catch((err)=>{gsecErrorHandlerUI(err);$("#password").val("");});} \ No newline at end of file
diff --git a/dist/pages/about.html b/dist/pages/about.html
index a08ae16..834a0a6 100755
--- a/dist/pages/about.html
+++ b/dist/pages/about.html
@@ -73,7 +73,7 @@
<b class="title-secondary">Beži</b><span class="title-primary">App</span>
</h3>
<!-- One day in the future we may have sw cache version covered by this as well -->
- <h5 class="subheader"><x-su>version</x-su> 1.0.14.1-beta</h5>
+ <h5 class="subheader"><x-su>version</x-su> 1.0.14.2-beta</h5>
</div>
</div>
<div class="row">
@@ -142,7 +142,7 @@
<div class="row">
<p>
<small>
- ^HEAD ab895dc64437ac9ea42b2c9790a0b29550bdbc17
+ ^HEAD c28c1c56dd807f620e916f9711d4c969817c6dd0
</small>
</p>
</div>
diff --git a/dist/sw.js b/dist/sw.js
index c1ccb21..36962ce 100755
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -3,8 +3,8 @@
// Change version to cause cache refresh
-const static_cache_name = "site-static-1.0.14.1-beta-ab895dc";
-// commit before the latest is ab895dc64437ac9ea42b2c9790a0b29550bdbc17
+const static_cache_name = "site-static-1.0.14.2-beta-c28c1c5";
+// commit before the latest is c28c1c56dd807f620e916f9711d4c969817c6dd0
// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js
// sw.js NE SME BITI CACHAN, ker vsebuje verzijo!
diff --git a/global.bvr b/global.bvr
index a6b170e..5ef7f98 100644
--- a/global.bvr
+++ b/global.bvr
@@ -1,3 +1,3 @@
<@?s bvr_include_path assets/pages-src/ assets/pages-src/misc/@>
<@?s latest_commit ?u 0 -1 ?i .git/refs/heads/dev@>
-<@?s app_version 1.0.14.1-beta@>
+<@?s app_version 1.0.14.2-beta@>
diff --git a/server/freenomrenew.sh b/server/freenomrenew.sh
new file mode 100644
index 0000000..46886c9
--- /dev/null
+++ b/server/freenomrenew.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# chrome generated this curly script when I was renewing zavij.ga.
+
+curl 'https://my.freenom.com/domains.php?submitrenewals=true' \
+ -H 'Connection: keep-alive' \
+ -H 'Cache-Control: max-age=0' \
+ -H 'Upgrade-Insecure-Requests: 1' \
+ -H 'Origin: https://my.freenom.com' \
+ -H 'Content-Type: application/x-www-form-urlencoded' \
+ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/83.0.4103.61 Chrome/83.0.4103.61 Safari/537.36' \
+ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
+ -H 'Sec-Fetch-Site: same-origin' \
+ -H 'Sec-Fetch-Mode: navigate' \
+ -H 'Sec-Fetch-User: ?1' \
+ -H 'Sec-Fetch-Dest: document' \
+ -H 'Referer: https://my.freenom.com/domains.php?a=renewdomain&domain=1064714470' \
+ -H 'Accept-Language: en-US,en;q=0.9' \
+ -H 'Cookie: G_ENABLED_IDPS=google; __zlcmid=yWjBN83fd0bq6c; mydottk_languagenr=0; dottyLn=en; wwwLn=en; WHMCSZH5eHTGhfvzP=54n5ikbop5na02s7qbf3ld1n64; WHMCSUser=1006649624%3Ae3c7c7706689fce5e12a4faa0644c87dabbae7a0' \
+ --data-raw 'token=d1d5c56d9dbedaa1e32d8fb66310591a2d1f1da8&renewalid=1064714470&renewalperiod%5B1064714470%5D=12M&paymentmethod=credit' \
+ --compressed
+
+# don't worry, I've invalidated cookies. At least I hope that's what logout does.
diff --git a/server/nadomescanja/output.pdf b/server/nadomescanja/output.pdf
new file mode 100644
index 0000000..ada8a98
--- /dev/null
+++ b/server/nadomescanja/output.pdf
Binary files differ
diff --git a/server/nadomescanja/script.sh b/server/nadomescanja/script.sh
new file mode 100755
index 0000000..496b869
--- /dev/null
+++ b/server/nadomescanja/script.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# this is a script to test if we can get files from sharepoint in an easy way. #fuckrosoft
+
+curl 'https://gimnazijabezigrad.sharepoint.com/Gim/DatSpl/Gimb%20%C5%A0olska%20pravila%20ocenjevanja%202019_20.pdf' \
+ -H 'authority: gimnazijabezigrad.sharepoint.com' \
+ -H 'cache-control: max-age=0' \
+ -H 'upgrade-insecure-requests: 1' \
+ -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/83.0.4103.61 Chrome/83.0.4103.61 Safari/537.36' \
+ -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
+ -H 'sec-fetch-site: none' \
+ -H 'sec-fetch-mode: navigate' \
+ -H 'sec-fetch-user: ?1' \
+ -H 'sec-fetch-dest: document' \
+ -H 'accept-language: en-US,en;q=0.9' \
+ -H 'cookie: nSGt-0F5C552C67D73B521FBC79E429B19BDACAD60901BA94F0F7=gYEwMThFQjM0NTU1MjE0RkQyOTMyRUY3MEFBM0EyNTc1RTMwMjk4QTlEQjk0RjJBRDY5MDBGNUM1NTJDNjdENzNCNTIxRkJDNzlFNDI5QjE5QkRBQ0FENjA5MDFCQTk0RjBGNxIxMzIzNTc1NzEwNDE4MDQ3NTIgZ2ltbmF6aWphYmV6aWdyYWQuc2hhcmVwb2ludC5jb20l6emYjLtdSZH+qYiO8V6/lU1eeE4X4HEulbeqPNPqfZ84humJDzVIOi5BgnAVXq2FhXmQUJFVpRO83UVCPWy8jR3s5QweUhfiB6SJP6vVltUwKzbjyPGQf7h1ykLNXvOBJL+icoKtulLKHZ1nwZuYcByYHHoJFLHERm/PKVhaN4ixIepiui3mEZrv8yzxZdX7Brzz2lAHF/DvqnK10U2p6FzcvmkBHTBpyFL86QYnuEwEXVmHsWq+uFBMYwQemY3S1goKVZONN8oUDKbr3woIOf2/YK5TfEPdaWOWkGROmFeDMxx/eAEoFHKd2HOM1PJM+H9MX1qP/BNo3G3+6cIFmAAAAA==; rtFa=ZRFHgKH1ffwmMES9Vjd7ein7sIVcTByBP6hlk6Fb8DgmRTcwQUE5M0QtRTQ1NS00MUU4LTg5MzEtRkFCOTYwQTlCNkJBptaV0VQGYEWk2f0ThJtHccyMco6F7IoScwB1jD7W8zpkcGPhr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ZUcStydk0zOEVqMVlQMFh5SE1JWmRHWjFrYTVGcWY3MzVCOE03VGhkSGVKcnpqNzlPR01kR1pzVE9JOUo4WDlkRkcrMGJkRnVsY1JBanh5ckd3U2szWlpwY0NiNTFLN3NpQTJHOEE5ODZTa2VqSkJBaVpCWk5HRElNSG5JSTAyRXVZaVN1OCtqbWxFUHU4OVhxTlpXRmZYNHpxdEM1TnNKRURwZ0RsKzFnMUFDOFBsaXBMMjh5YTcyRWY5N1RqTWdOQlIxcCtEeVlLUUdNWVdRUFp6NG5DUU9HRGU2REhpMnRDYWZWU2c5TUM0TGlrcEZTNVl4YWdVUT09PC9TUD4=; CCSInfo=Ny4gMDYuIDIwMjAgMTc6MDc6MDg0fL7YWM9M1GwNXmIVSDq7jc1NY/Qod+/ZRKTvTkTqlaRXX01bAepfiS+zo61xxrv7g20l+dy8VjQVb9Jby19pTGWx+PwCrrCdGVLf8uW+AbVkS8mD8mZPWu8XrP5qHxcs2I5JoTJkUGkO/HNO1DDrXFAYmONZ1PEKbRJE5XijlaaGEM6I+lv1EvNXQxAau/H3BnbqXqHi3sK/PBDS6JGPw/qQVxuE9kr4IdA6XcCbok64aU4sjtKbo0J0csclZIqZkRwO0dCh16oSS4mnsATVqlPtLggROb30dognrv16+XaxSUY6dUAEoL/NpaYdgMmo9pyLsItuu41XKRO0bAklFAAAAA==' \
+ -H 'if-none-match: "{B7F3D3FC-A5A1-4919-9076-2C7804E4A31F},2"' \
+ -H 'if-modified-since: Wed, 11 Dec 2019 10:12:19 GMT' \
+ -o output.pdf \
+ --compressed
+
+# they're fixking with me, right? why would anyone need 1 kilobyte of data in a cookie,,, A SESSION COOKIE!=?!=?