Compare commits

..

No commits in common. "eb13ce2e412859fb9601ec19538504495457c4a9" and "a7fa593d15637515aa4e16fc787fefb257ebf9f8" have entirely different histories.

6 changed files with 3741 additions and 41 deletions

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Matyáš Caras
Copyright (c) 2022 Matyáš Caras and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -12,34 +12,7 @@ Experimentální **neoficiální** webscrape knihovna pro komunikaci se systéme
## To do
- Kompatibilita se staršími verzemi iCanteen
Příklad používání [zde](https://git.mnau.xyz/hernik/canteenlib/src/branch/main/example/canteenlib_example.dart)
*\* Knihovna nemusí fungovat na všech instancích systému iCanteen, proto žádám každého, kdo může a je uživatelem iCanteen, aby otestoval funkčnost této knihovny a případné problémy [nahlásil](https://git.mnau.xyz/hernik/canteenlib/issues/new)*
### Otestované instance iCanteen
[zde](https://git.mnau.xyz/hernik/canteenlib/src/branch/main/COMPATIBILITY.md)
## Licence
```
MIT License
Copyright (c) 2022 Matyáš Caras
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

View file

@ -1,15 +1,20 @@
import 'package:canteenlib/canteenlib.dart';
void main(List<String> args) async {
Canteen c = Canteen(
"https://kantyna.neco.cz"); // vytvořit instanci kantýny, všechna komunikace probíhá skrz ni
try {
await c.login("uzivatel", "heslo"); // přihlásit se
var jidelnicek = await c.jidelnicekDen(den: DateTime.parse("2022-04-04"));
print((await c.ziskejUzivatele()).kredit);
var objednano = await c.objednat(jidelnicek.jidla[0]);
print(objednano.objednano);
} catch (e) {
print("Při získávání informací nastala chyba: $e");
}
void main(List<String> args) {
Canteen c = Canteen("https://kantyna.neco.cz");
c.login("uzivatel", "heslo").then((value) {
c.jidelnicekDen(den: DateTime.parse("2022-04-04")).then((t) async {
print((await c.ziskejUzivatele()).kredit);
c.objednat(t.jidla[0]).then(
(value) {
t.jidla[0] = value; // divně udělané ale nic lepšího teď nevymyslím
print(t.jidla[0].objednano);
print(t.jidla[0].orderUrl);
},
);
});
}).catchError((o) {
print(o);
return null;
});
}

View file

@ -303,7 +303,7 @@ class Canteen {
.replaceAll(" <br>", "")
.replaceAll("\n", "");
var alergeny =
RegExp(r"""<span title=".+?" class="textGrey">(.+?)<\/span>""")
RegExp(r"""<span title=".+?" class="textGrey">([a-zA-Z]*)<\/span>""")
.allMatches(jidlaProDen)
.toList();
var vydejna = RegExp(

3712
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

10
package.json Normal file
View file

@ -0,0 +1,10 @@
{
"devDependencies": {
"cz-conventional-changelog": "^3.3.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}