Commit Graph

111 Commits

Author SHA1 Message Date
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
Matt Mascarenhas 7edcecfd40 cinera.c: InitScopeBooks() in PrintHelpConfig() 2020-05-25 01:29:14 +01:00
Matt Mascarenhas bc6f21f71d Make project navigation menus use the right theme
It was just a typo. HMMLToBuffers() passed the global config pointer,
rather than the passed in one, to GenerateNavigation().

Also switch the entire config over to use memory_book style allocation.
This saves us from having to offset pointers when memory gets realloc'd.
2020-05-25 00:26:13 +01:00
Matt Mascarenhas 8aa67a386a Fix the 3-way filter associating
Add the data-searchLocation attribute to the search results
2020-05-17 23:00:12 +01:00
Matt Mascarenhas ce9a0e7635 Prevent file clashes
Config parsing now errors-out when it detects clashes between:
    base_dir and search_location, and global_search_dir
    base_dir and player_location

This prevents us from generating search / project pages of multiple
projects (incl. global_search_dir) at the same location, which would
screw up the asset landmarks.
2020-05-17 22:50:28 +01:00
Matt Mascarenhas 877dbab5bd Fix global search page generation and filter
This change makes GenerateGlobalSearchPage() pass the Config to
BuffersToHTML(), which in turn passes it on to GenerateNavigation(),
thus preventing a null-pointer deference when setting the Theme.

It also fixes the filter by using all three of baseURL, searchLocation
and playerLocation to associate the filter and index elements.
2020-05-17 20:35:04 +01:00
Matt Mascarenhas 9dfdc117be Fix search_ and player_location related bugs
On the search pages use the search_location and player_location, in
addition to the base_url, to associate filter and index entries, such
that the filter actually works.

Fix the .index file location for projects with a search_location. As
this is now consistent, we happen to fix a crash that happened when
changing the search_location.

New config option:

    deny_bespoke_templates
         Indexers may use the "template" attribute in the video node of
         an .hmml file to set a bespoke template for that entry,
         superseding any configured player_template. Setting
         "deny_bespoke_templates" to true prevents this.
2020-05-17 02:04:26 +01:00
Matt Mascarenhas e2ea8fdaf3 cinera.c: Memorable Templates
• Pack all templates before sync'ing the projects
• Delay generation of navigation bars until BuffersToHTML(), and free them
  when switching projects
• Change many variably-lengthed items to use memory_book
• Do not push on multiple support scopes with the same ID
• Prevent crash when trying to snipe an asset checksum into an HTML file
  we were never permitted to create
• Reorganise ReadFileIntoBuffer() and related functions into cinera.c

New Template Tags:

    __CINERA_GLOBAL_NAV__
2020-05-15 02:35:55 +01:00
Matt Mascarenhas 33e590c6da cinera_config.c: Prevent read access crash
Passing an empty string to StripSlashes() would crash.

Also add a conditional around the ctime calls in the Won Build System,
to only run it if it exists.
2020-05-10 21:25:05 +01:00
Matt Mascarenhas 3e0ba0b77b cinera.c: Add <div> to match closing </div> 2020-05-10 18:43:40 +01:00
Matt Mascarenhas 18b39b9f72 cinera.c: Always print entry deletion from DB
Previously we only printed deletion in DeletePlayerPageFromFilesystem().
If, however, the output parameter is set in a .hmml file, we needn't
delete that page from filesystem. What would happen is, we move the
file from one location (delete) to another (insert / append), and only
printed out the insertion / append. This gave the impression that the
old database entry remained, when it had correctly been deleted.
2020-05-10 17:32:44 +01:00
Matt Mascarenhas f20a35e0de cinera.c: Fix buffer sizing crash bug 2020-05-10 17:05:12 +01:00
Matt Mascarenhas 3728c8aaee cinera.c: Mention the default config path in -h 2020-05-09 22:27:40 +01:00
Matt Mascarenhas bd8c6b805d cinera.c: Bump the patch version 2020-05-09 19:18:17 +01:00
Matt Mascarenhas 05518781c4 cinera.c: Config
Database version 5

Major features:
    Config file parsing
    Multiple projects per instance
    Searching across multiple projects
    Art sprites, usable by project, medium and support

Minor features:
    The search results are now sortable
    Optimised the search page sorting

Fixes:
    More reliable file system monitoring
    Well-formed templates are now valid, even with the absence of assets
    Correctly resove ~ in paths
    Gracefully handle the lack of an internet connection
    Renamed "annotator" to "indexer"
    Removed PlayerURLPrefix, in favour of .hmml "output" parameter

Replaced the flags collection with:
    -0 Dry-run mode
    -c Set the config file path
    -e Examine the database
    -v Print version
    -h Print help

New template tags:
    __CINERA_NAV__ dropdown
    __CINERA_NAV__ horizontal
    __CINERA_NAV__ plain
    __CINERA_PROJECT_PLAIN__

Deleted template tags:
    __CINERA_MENUS__
    __CINERA_SCRIPT__
2020-05-09 18:33:25 +01:00
Matt Mascarenhas 9051caa94e cinera: Player page mobile style 2019-03-07 20:16:27 +00:00
Matt Mascarenhas 9278390a38 cinera.c: Put sort button on query box's line 2019-03-03 23:32:58 +00:00
Matt Mascarenhas d6e633cf3e cinera.css: Search page mobile style
cinera_search.js: Conditionally display the results summary
2019-03-03 00:44:05 +00:00
Matt Mascarenhas 9b26d109be cinera.c: Increase AnnotationHeader buffer size 2018-10-26 20:31:37 +01:00
Matt Mascarenhas d37a39af32 cinera.c: Let inotify monitor IN_MOVED_TO events
It seems that rsync triggers these events, so we must handle these in
addition to the IN_CLOSE_WRITE ones triggered by re-saves.

Also fix MakeDir() to correctly make parent directories (i.e. mkdir -p).
2018-10-05 20:57:09 +01:00
Matt Mascarenhas c4ef54c742 cinera.c: Fix template validity checking 2018-09-20 01:13:41 +01:00
Matt Mascarenhas 9d0cdfb488 cinera.c: Add "Packing template" back 2018-09-20 00:43:47 +01:00
Matt Mascarenhas 2eddd7a7c2 cinera.c: Support limitless templates
Previously we had a template tag limit of 16. This commit lifts that
limit to support "unlimited" tags per template.

Skip already offset landmarks most efficiently when adding a new asset.

New template tags:
    __CINERA_SEARCH_URL__
    __CINERA_VOD_PLATFORM__
2018-09-19 20:50:21 +01:00
Matt Mascarenhas 3da53413ce cinera.c: Revved resources
Database version 4

Revving resources involves hashing asset files and appending a query
string to their URLs. Additionally we monitor asset files for changes
and edit their new checksum hash into all HTML files citing them.

This commit also introduces new template tags for assets (listed below)
with which you may instruct Cinera to rev assets of your choice. There
is further information about this in the help (-h) and the README.md

Amongst other minor changes, we now support unset $XDG_CACHE_HOME and
$HOME
    - Thanks to insofaras for wordexp()

New flags:
    -Q Set query string

New template tags:
    __CINERA_ASSET__
    __CINERA_CSS__
    __CINERA_IMAGE__
    __CINERA_JS__

Renamed template tag:
    __CINERA_SEARCH__ (was __CINERA_INDEX__)
2018-09-17 19:06:31 +01:00
Matt Mascarenhas f3b728ee6f cinera_search.js: Mitigate flickering 2018-07-15 23:52:52 +01:00
Matt Mascarenhas 8607ca87ea cinera: Finer-grained search input autofocus 2018-07-05 20:13:25 +01:00
Matt Mascarenhas aa0a8ba327 cinera: Single browser tab and no autofocus mode
This allows search result links to open in the same tab, and prevents
automatic scrolling to the search input box on page load
2018-07-03 15:26:17 +01:00
Matt Mascarenhas 92909a9ee9 cinera.c: Update Casey's support URL 2018-07-02 19:18:18 +01:00
Matt Mascarenhas 8a4a383705 cinera.c: Version bump for faster search 2018-06-23 16:10:55 +01:00
Matt Mascarenhas 8c17194180 cinera.c: Correctly set theme 2018-06-13 16:05:21 +01:00
Matt Mascarenhas a1e8efe431 cinera.c: Fix CollationBuffers->ProjectID test 2018-06-12 20:32:56 +01:00
Matt Mascarenhas 966d616b48 cinera.c: Set CollationBuffers.Theme 2018-06-12 20:21:58 +01:00
Matt Mascarenhas 0eeadd560b cinera.c: Add PROJECT_ID and THEME template tags 2018-06-12 20:03:12 +01:00
Matt Mascarenhas 4d495543f5 cinera.c: Add coad and reader ProjectInfo 2018-06-07 18:55:40 +01:00
Matt Mascarenhas 45cf7772d9 cinera.c: Replace pcalc with risc ProjectInfo 2018-06-07 18:38:52 +01:00