aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-02-05µCS 0.4.0HEADv0.4.0trunkAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-05Introduce a new feature to list events without locationAlban Gruin
This adds a new page listing events without location. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-05ics: introduce functions to filter courses without locationAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-05server: extract the function reading the module id and groupsAlban Gruin
A new function, listing events with no location, will also need to read the module id and groups from request parameters. Extract the function taking care of that to avoid code duplication. This also adds a button on the link page, to access to the page listing events without location. This feature is not yet implemented. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-05server: reorganise the codeAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-05ics: make Ics.t publicAlban Gruin
To simplify code down the line, this makes Ics.t public so everyone can apply standard list processing functions onto it. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2022-02-02pages: always show the current year in the copyrightAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-10-04µCS 0.3.1v0.3.1Alban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-10-04course, ics: location may be empty, make it an optionAlban Gruin
As there may not be a location, make it an option type so we can easily add a warning in the title of an event. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-10-04course: fix parsing issuesAlban Gruin
The constructors Location and Summary were inverted, causing confusion in the loc_and_sum_to_location and loc_and_sum_to_summary functions. For instance, if no location was found, the summary would be empty (even though it was found), and the location would be the name of the event. This fixes these names and functions to work properly. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-10-04pages: improvements on the module selectionAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-20pages: this is micro celcatsanitizer, not celcatsanitizerAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-20ics, ucs: generate event IDs with a random numberAlban Gruin
Until now, ucs generated unique IDs with the datetime and the number of an event, starting by 0. Unfortunately, if two calendars were generated at the same second, they could have collisions. To avoid that, the ICS generator now uses a base ID generated randomly, which should be enough to avoid collisions. The RNG is self-initialised in the main function. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-20ics: fix issues with EOLsAlban Gruin
End of lines in iCalendar files should be CRLF, but some (most?) lines generated by µCS were LF. This changes that. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19µCS v0.3.0v0.3.0Alban Gruin
Version name : ★ GEMINI II ★, in reference of the Gemini II mission, and NROL-13. This marks the transition to NRO references to crewed space mission references. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19server: add charset to the headers when fetching timetablesAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19server, ics, pages: allow to generate ICS from modulesAlban Gruin
This adds the ability to generate an ICS file from a module ID, and to filter it based on its groups. To do this, you can enter a module ID on the frontpage. Then, µCS will fetch the timetable, then return a page where one can select the group(s) they want to filter (this is enabled by the new Ics.get_all_groups function). Then, µCS is able to generate a link to that calendar, not unlike with a single group ID. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19server, ics: add a facility to filter courses by groupsAlban Gruin
When fetching courses based on their module ID, it is interesting to exclude coruses that do not apply to some groups. This adds the functionnality to apply that filtering, with the Ics.filter_groups function. It also becomes possible to get ICS for modules. URLs and generators are changed accordingly. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19server: allow to fetch module timetables in addition to groupsAlban Gruin
This add a new type, fetch_kind, and a function, kind_to_res_type, to select the type of timetable we want to fetch: Group, or Module. For now, Module is not used, so warning 37 is disabled in fetch_kind. It will be enabled back in the next commit. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19course, ics: read, store, and dump groups in a courseAlban Gruin
In the future, we want to filter courses by its groups. To allow this, we must parse and store the groups from celcat. This adds this feature. We also dump them in the `COMMENT' field of the iCalendar files. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2021-09-19pages: escape parameters in pages, update copyrightAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-12-30server: cleanupv0.2.0Alban Gruin
Remove the wildcard `open Lwt' and replace it with `open Lwt.Infix'. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-12-30ics: print the timezone name in the ICS fileAlban Gruin
Add the correct timezone in generated ICS files. The timezone is fetched from /etc/timezone. Even though this is not standard, if a tool needs it, it should be able to understand it correctly. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-12-30ucs: use the version name from duneAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-12-30ucs: properly remove the unix socket when a signal is receivedAlban Gruin
When using a unix socket to serve µCS, the file would not be removed when the server was shut down. Teach µCS to catch sigints and sigterms, and call unlink on the socket if it exists. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-10-03course: remove reference to unused fields in the original JSON feedAlban Gruin
It's cleaner to merge an actual obj with a unit instead of refering to every field in the JSON feed, and makes the schema more flexible. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-10-03Replace ocplib-json-typed by json-data-encodingAlban Gruin
ocplib-json-typed was superseeded by json-data-encoding. This replaces the former with the latter. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-20µCS v0.1.1v0.1.1Alban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-20ucs: set the time zone to local when starting the serverAlban Gruin
This sets the time zone to local when starting the server to avoid having timestamps in UTC in the logs. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-20course: use a proper type to iterate over a course descriptionAlban Gruin
Currently, to find a course's summary and location, there is a pattern matching over a ad-hoc 3-uple of a boolean and two strings. To make it clear, this badly defined structure is replaced by an actual ADT, `loc_and_sum', containing 4 cases: - `Nothing', when the groups has not been found yet; - `Groups', when the groups has been found by `check_groups'. This means that the next line should be the course's location; - `Location', when the location has been found. If there is no new line to read, the string is the location, otherwise it's the summary, and the next line should be the actual location; - `Summary', when the location and summary has been both found. All subsequent lines will be ignored. A function is also added to convert a `loc_and_sum' to a couple of string containing the location and the summary. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-19course: use a match/with instead of a if-chain in `location_and_summary'Alban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-19course: memoized version of `get_unicode'Alban Gruin
To avoid creating buffers to decode an HTML entity, this create a memoized version of `get_unicode' in hope to operate a bit faster and reduce memory allocations. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-19course: invert the `group_affix' list orderAlban Gruin
Each affix is tested with a `List.fold_left', which means that the list is traversed in order. Hence, the most likely results should be at the beginning of the list, not at the end. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-19course: return the summary if there is no " - " in the event's full nameAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-14ics: timestamps are in local time, not UTCAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13µCS v0.1.0v0.1.0Alban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13ucs: add command line parameters, powered by cmdlinerAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13server: set the range to fetch to a year and a monthAlban Gruin
To fetch all interesting courses, the start date is set to a month before today, and the end date is set to a year after today. This should be enough for our iCalendar files. Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13ucs: move the server to its own moduleAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13ucs: remove use of `ignore' an the main functionAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13ucs: show parameters in the logAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13ucs: add URLs to the HTML pages, read parameters in the URLAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13ucs: add a helper to send quickly a 200 OK responseAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13Add webpages and styleAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13course: remove the part before " - " (module ID) in the course summaryAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-13course: convert html entities to unicode charactersAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-12ucs: log queriesAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-12ucs: fetch group based on URLAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-12ucs: adding a basic webserver, only returning an ICS file on GET queriesAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>
2020-09-12course: use Astring to split strings and to check for prefixesAlban Gruin
Signed-off-by: Alban Gruin <alban@pa1ch.fr>