Commit Graph

145 Commits

Author SHA1 Message Date
Matt Mascarenhas b8f143e350 cinera: Add database structure specification
This commit aims to generalise database structures such that any block
may be traversed without the need for specific functions for each type.
Concretely, it replaces functions like SkipAsset() and SkipProject()
with a generic SkipHeaderedSectionRecursively(). The change also paves
the way for the plethora of new block types due in CINERA_DB_VERSION 6.
2022-09-19 17:22:19 +01:00
Matt Mascarenhas f60cf3087f cinera: Lock database and config files
This commit aims to help Cinera instances coordinate themselves by
throwing an error upon being instructed to use a database or config
file currently in use by another instance.
2022-09-16 16:10:19 +01:00
Matt Mascarenhas 1cf703e346 cinera: Fully handle auto-numbering
•   Renumber affected entries when inserting / deleting an entry of an
    auto-numbered project
•   Prohibit an entry from sharing an "output" with another entry
•   Prohibit an entry's "output" from containing a slash
•   Fix entry HTML deletion to use OutputLocation, not BaseFilename
2022-08-30 19:15:44 +01:00
Matt Mascarenhas 26e304f62c cinera: Add IRC unfurl tags and GitHub sponsors
New config field:
    instance_title
2022-08-23 22:36:20 +01:00
Matt Mascarenhas 8dffa513cc cinera: Add tag __CINERA_PROJECT_LINEAGE _ 2022-08-21 19:15:10 +01:00
Matt Mascarenhas e17c3aa78c cinera.c: Handle overlong "output" attribute 2022-08-03 22:56:24 +01:00
Matt Mascarenhas 84a35b9ece cinera: Add numbering and fix sizes
New config options:
    numbering_filename_prefix (string)
        Defaults to $project
    numbering_method
        auto
        filename_derived (default)
        hmml_specified
    numbering_start (number)
        May be used to 0-index the set
    numbering_unit (renamed from "unit")
    numbering_zero_pad (boolean)

This commit also fixes the size of the "?" help button and category dots
when the wider site uses box-sizing: border-box
2022-08-01 20:58:55 +01:00
Matt Mascarenhas 652d8f186f Revert "Introduce threading and clean some code"
This reverts commit f7a6df994f.
2022-07-21 20:04:50 +01:00
Matt Mascarenhas 91c33c580b cinera.c: Add a break to a switch case 2022-07-21 19:50:18 +01:00
Matt Mascarenhas f7a6df994f Introduce threading and clean some code
This is an unversioned interim commit with unfinalised code.

The threading code establishes job queues.
The code cleanup removes various _TopLevel functions pertaining to
database operations.
2022-05-20 17:32:28 +01:00
Matt Mascarenhas b6fb755d29 cinera.css: Set margin on search page links
This commit enables Google's Mobile Usability checker to proceed beyond
its quick initial validation, after finding the previous fixes failed.
2021-10-08 15:18:23 +01:00
Matt Mascarenhas d036145b7f cinera.css: Let tall menus scroll 2021-10-06 17:38:18 +01:00
Matt Mascarenhas 60615322dd cinera.css: Apply min-height more broadly
This commit enables Google's Mobile Usability checker to proceed beyond
its quick initial validation.
2021-10-06 17:12:26 +01:00
Matt Mascarenhas 2deb244cce cinera.css: Set min-height on search page links
This commit tries to fix a "Clickable elements too close together"
error:
https://support.google.com/webmasters/answer/9063469#touch_elements_too_close
2021-10-06 16:38:21 +01:00
Matt Mascarenhas 4dc034ecc3 cinera.c: Use html_title in Welcome / End markers 2021-10-06 15:45:19 +01:00
Matt Mascarenhas ee788b0c30 cinera_player_pre.js: Fix YouTube initialisation
Initialise the player if the YouTube API loads before us
2021-09-01 16:38:23 +01:00
Matt Mascarenhas c839e2ed85 cinera.c: Add "direct" video support
Fixes:
• Rename Annotation → Timestamp in cinera_player_*.js
• Redo VideoIsPrivate() to only return once, at the end
2021-07-07 16:33:54 +01:00
Matt Mascarenhas 012d1608a0 cinera.c: Mention "vimeo" in the help text
Also remove HMMLIB_MAJOR_VERSION #defined out code
2021-06-28 13:32:15 +01:00
Matt Mascarenhas 97806c2c9c cinera_player_post.js: s/setTime/setTimeThenPlay
Thanks to @nairou on twitter for the report
2021-06-27 19:13:18 +01:00
Matt Mascarenhas dd33bb49b3 cinera_player_pre.js: Add Vimeo support
Fixes

• Fix fullscreen
• Pause whenever / however following a reference or credit URL
2021-06-23 15:13:41 +01:00
Matt Mascarenhas e39a09c0ad cinera: Code clean-up
• Make vod_platform an enum
• Unionise config_int_pair and config_bool_pair in config_pair
2021-06-17 13:32:53 +01:00
Matt Mascarenhas 744515dac4 cinera_clear.js: Fix the placement of the clear 2021-06-11 17:39:48 +01:00
Matt Mascarenhas 209979f63a cinera.js: Add a "Clear" element
To use it, source the cinera_clear.js file at the position in the HTML
file to be obscured while further processing occurs. (Make sure not to
"defer" it.)

After processing is complete, call FlipClear()
2021-06-11 16:38:38 +01:00
Matt Mascarenhas 12b06812bf cinera.js: Improve style
•   Do not modify visibility of list view during resize
•   Stabilise player sizing across fullscreen toggle and resize
2021-06-11 14:03:13 +01:00
Matt Mascarenhas 373195069a cinera.css: Use rem unit for font-size 2021-06-09 16:30:06 +01:00
Matt Mascarenhas 07795b7cbd cinera.c: Fix segfault on partial hmmlib1 credit 2021-06-07 13:19:03 +01:00
Matt Mascarenhas b0501d20ac cinera.c: Fix sizeof() on a string literal 2021-05-31 22:39:25 +01:00
Matt Mascarenhas af1bff4218 cinera: s/StringLength()/sizeof()-1 on string lits 2021-05-31 21:01:34 +01:00
Matt Mascarenhas 63ab9d5bc2 cinera: Remove memory_book_type 2021-05-31 20:48:58 +01:00
Matt Mascarenhas 9cdb3b96d9 Revert cinera.c: Make ResolvePath() use realpath()
This reverts commit 61fa4e4808.
2021-05-31 20:35:18 +01:00
Matt Mascarenhas 61fa4e4808 cinera.c: Make ResolvePath() use realpath() 2021-05-31 20:10:04 +01:00
Matt Mascarenhas cf51ba24e3 cinera.c: Fix role-related bugs
•   Fix segfault due to unconfigured role
•   Add credit scope to the root scope's TypeSpec, permitting
        credit = "$owner" { role = "host"; }
    to be absorbed by all projects
•   Make "unfound role" errors WaitForInput()
2021-05-31 19:20:52 +01:00
Matt Mascarenhas 0d88c24db6 cinera: Upgrade to hmmlib2
Features:
    User-configurable roles and credits
    Handle SIGINT to quit cleanly and avoid database corruption

Fixes:
    Filesystem event monitoring handles directory creation / deletion
    Fixed buffer overflow when trying to curl in a non-existent quote
2021-05-30 19:39:47 +01:00
Matt Mascarenhas 05b7883033 cinera_search_pre.js: Default to the List View
Also fix the 𝑛-ary Grid traversal PrevAscends case when the search page
contains only one project at the top-level.
2021-04-12 18:00:45 +01:00
Matt Mascarenhas 828fff7a7a cinera.web: Prevent auto-scroll to hidden elements
The search page could auto-scroll to the top when the grid is not
displayed. This commit fixes that problem by ensuring that the grid
element has a width and height before seeking to auto-scroll to it.

Thanks to Leonardo Serafim Eid for the report
2021-02-16 02:52:27 +00:00
Matt Mascarenhas 806c9feba8 cinera.web: Fix sizing and CSS rule setting
• Max{Height,Width}OfElement() should now produce saner values
• Video can now resize upon orientation change on mobile
• Search grid now sizes to the correct area
• CSS rule setting only tries to touch local stylesheets
2021-02-12 23:48:02 +00:00
Matt Mascarenhas b6fff3cc24 cinera_search_post.js: Fix auto-scrolling
Pass CineraProps.IsMobile to InitScrollEventListener()
2021-02-10 23:50:43 +00:00
Matt Mascarenhas 20d7e82a66 cinera_pre.js: Harden GetRule() 2021-02-10 23:33:32 +00:00
Matt Mascarenhas 33f6186aa1 cinera.web: Fix player sizing and auto-scrolling
• Video size may be based on the height if the width-based is too tall
• Auto-scrolling improvements:
    • It now cannot oscillate
    • It doesn't happen at all if scrolled to the very top / bottom

Thanks to @Freak_ on freenode for the report
2021-02-10 22:41:46 +00:00
Matt Mascarenhas 4ba03f9338 cinera_pre.js: Add sticky-awareness to auto-scroll
This lets the grid view auto-scroll out from under the control bar.
2021-02-07 01:53:05 +00:00
Matt Mascarenhas 5857a30eaf cinera_search.js: Pin ↑ button to top in landscape 2021-02-05 19:49:00 +00:00
Matt Mascarenhas 0a9d51b0d7 cinera.web: Better fitting and effiency
Better text fitting
Account for the scrollbar width in our max width considerations
Don't bother to compute the grid size merely when toggling the view
2021-02-04 23:19:56 +00:00
Matt Mascarenhas 545938d766 cinera.web: Fix issues (on mobile) with new layout
Both pages:
    Derive reliable window dimensions ourselves
    Set the orientation from the window dimensions
    Use "box-sizing: content-box" on the help keys, to fix sizing

Search page:
    Support irregular (i.e. non-square) grids
    General sizing fixes
    Fix text fitting when toggling back from List to Grid view
    Fix text fitting when textNode would overflow container
    Correctly compute optimal grid size after orientation change
    Rename .text to .cineraText to avoid CSS selector clash
    Only add click events for the main set of buttons (not its clone)

Player page:
    Size the video and timestamps bar more sensibly
2021-02-04 00:13:55 +00:00
Matt Mascarenhas 2cf8739a60 cinera.web: Fix issues on desktop with new layout
Search page:
    Manually size the grid buttons, and head / tail items

Player page:
    Confine long menus to the player height
    Confine the help documentation to the window size
2021-01-27 21:58:56 +00:00
Matt Mascarenhas 3945ac883c cinera v0.8.0: Mobile-friendly layout
Major features:
    Search page: Subdivision grid layout
    Player page: Device orientation-specific layout

Fixes:
    Strip slashes of the URLs: base_url, etc.
    Fix SnipeChecksumAndCloseFile() to not null-terminate the checksum string
    Fix hover background colouration of medium icons of current timestamp
    Fix DeriveLineageWithoutOriginOfProject() to call InitBookOfPointers()
    Fix SortAndAbbreviateSpeakers() to use the person's ID if Name is blank
    More directly display the "unit", if set, in the search results
    Fix VideoIsPrivate() to find the apparently relocated privacyStatus
    Make VideoIsPrivate() default to TRUE for non-youtube
    Output as keywords all topics that do not match "nullTopic"

Deleted asset:
    cinera_search.js

New assets:
    cinera_search_pre.js
    cinera_search_post.js
2021-01-25 18:09:30 +00:00
Matt Mascarenhas 6eeb588adf cinera.c: Gracefully handle database non-creation 2020-06-24 17:34:41 +01:00
Matt Mascarenhas b3470e0f48 cinera.c: Gracefully handle unset env variables 2020-06-24 16:22:50 +01:00
Matt Mascarenhas 2748687839 cinera.c: Sanitise Memory
Fixes / Improvements:

•   Switch all growable arrays to use memory_book, rather than realloc()
•   Lift a bunch of hardcoded string lengths and item counts
•   malloc() the MemoryArena rather than calloc(), thus saving 3 MiB
•   Reorganise HMMLToBuffers() to return from one place, the end
•   Print indexing errors in the same style as config errors / warnings

Diagnoses:

•   Identified sources of "non-freed" memory usage and marked them +MEM.
    This may aid future work on further reducing memory / cycle usage.

New config settings:

•   suppress_prompts boolean
2020-06-24 13:29:18 +01:00
Matt Mascarenhas 6da970d48c cinera.c: Fix leak in GenerateTopicColours() 2020-06-03 18:04:39 +01:00
Matt Mascarenhas 0959fa2774 cinera.c: Fix segfault and event handling
• Segfault was due to a read access violation on an unset entry pointer,
  which in turn was due to stale neighbourhood data. To fix it we simply
  reset the neighbourhood when starting to delete an entry. Additionally
  we now check that those entry pointers are set before accessing them.

• Event handling of the trio of events triggered when vim saves a file.
  We now read in a second set of events while processing the first if we
  were on the verge of processing a deletion. If we get any more events,
  we continue to squash those ones if possible, to always end up having
  seen the entire trio of events associated with a file save, and then
  process it as an insertion / reinsertion, not a deletion.

• Sort the asset landmarks by their offset.

• Change GenerateTopicColours() to initially open cinera_topics.css as
  "r" to search it for the incoming topic, and only if that topic is
  absent reopen it as "a+", thus triggering an IN_CLOSE_WRITE event.
2020-05-30 18:12:54 +01:00