w3c / publishingcg

Repository of the Publishing Community Group
https://www.w3.org/community/publishingcg/
Other
18 stars 8 forks source link

Digital Textbooks, Digital Gamebooks, and EPUB, Web, and JavaScript Security #26

Open AdamSobieski opened 2 years ago

AdamSobieski commented 2 years ago

Types of Digital Books

Perhaps, utilizing EPUB package metadata, developers could declare which type of digital book that a particular EPUB resource was, for example a “digital textbook” or “digital gamebook”. This information, utilizing a book type vocabulary, could be useful for reading systems, for instance to provide book-type-specific user-interface layouts, menus, and features.

Reading System Requirements and Capabilities

Perhaps, utilizing EPUB package metadata, developers could describe granular requirements for reading systems, including requirements pertaining to JavaScript scripting environments: specific API’s, features, and functionalities. As envisioned, this would involve a requirements and capabilities vocabulary.

For example, an EPUB resource, e.g., a mathematics digital textbook, could utilize package metadata to indicate that it requires the WebGPU API for 3D graphics.

Reading System Permissions

Perhaps an EPUB permissions system could be devised (see: w3c/epub-specs#1958) expanding upon the Permissions API and permission names vocabulary. Certain API's, features, and functionalities could, then, ask users for permissions, e.g., to access the browsable Web (see: w3c/epub-specs#1871).

EPUB, Web, and JavaScript Security

With a broad and granular requirements and capabilities vocabulary, EPUB resources and, perhaps, eventually websites could use metadata to declare their JavaScript-related requirements, and these – and, perhaps, only these – scripting API's, features, and functionalities could be made available, when supported by the reading system or browser, and when in accordance with users' configurations, settings, and permissions.

Saving and Loading Session States

I wonder how the Web Storage API applies to EPUB resources and their individual HTML pages?

Also, towards a multi-slot storage solution for EPUB resources – which would be useful for both digital textbooks and digital gamebooks – sketched, below, is a multi-slot storage solution which can allow EPUB resources to save and load session state without requiring direct access to a local filesystem. That is, an EPUB resource could utilize package metadata and a requirements and capabilities vocabulary to indicate that it requires access to this or a similar API without requiring access to other API's, features, or functionalities.

This sketch utilizes the Storage interface from the Web Storage API. In the sketch, the contents of data are saved to and loaded from storage slots.

interface StorageManager : EventTarget
{
  readonly attribute Storage data;

  iterable<Slot> getSlots();
  Promise<Slot> createSlot(object? args);
  Promise<Slot> copySlot(Slot slot, object? args);
  undefined loadSlot(Slot slot);
  Promise<Slot> saveSlot(Slot slot, object? args);
  Promise<boolean> deleteSlot(Slot slot);
  Promise<boolean> clearSlots();
}

interface Slot
{
  readonly attribute DOMString name;
  readonly attribute DOMString description;

  readonly attribute unsigned long long size;
  readonly attribute DOMString creationTime;
  readonly attribute DOMString lastModified;
}

The sketch intends to describe a sort of multi-slot digital bookmark and videogame state storage solution. With a bit more work, perhaps expanding on the sketch, developers could enable users to be able to simply close and reopen their digital books, resuming from saved states, and to be able to utilize multiple digital bookmarks, or storage slots.

Conclusion

Thank you. Any thoughts on these ideas?

wareid commented 2 years ago

Hi @AdamSobieski! Thanks for the excellent walk through of this idea. It looks interesting, but at this time it's not something the WG can take on, as we get ready for testing before publication.

I would recommend you post this issue in the Publishing CG repository, where it can be taken up and discussed. We are moving all of our incubation work there at this time.

I'm going to mark this as propose closing for now, just for housekeeping purposes.

AdamSobieski commented 2 years ago

@wareid, thanks for looking at the ideas. @iherman, thanks for transferring the issue to the Publishing Community Group.

Now that the issue is in the right repository, I look forward to any discussion.

Jeffxz commented 2 years ago

@AdamSobieski I really like your idea about game epub. I actually created a few and here are some of them https://wysebee.com/run?epub="https://content.wysebee.io/minesweeper.epub" https://wysebee.com/run?epub="https://content.wysebee.io/flappy-bird.epub"

I also have been thinking about how to let each epub have some flexibility of using file storage and so on but not access to the reading system file storage.

AdamSobieski commented 2 years ago

Thank you, @Jeffxz. Those are enjoyable games.

In addition to videogame EPUBs, there are other forms of book/games, such as gamebooks and interactive fiction. In these regards, I was looking at the Twine Cookbook and there other interactive fiction engines to consider as well.

From videogames, there are to consider the concepts of multiple save slots and autosaving. From digital books, there are to consider the concepts of digital bookmarks. Considering both, simultaneously, could be useful to deliver for end-users the capability to simply close and reopen their digital books, with multiple bookmarks and autosaving, and to do so with increasingly sophisticated books.

mickael-menu commented 2 years ago

This issue might be of interest regarding interactive fictions: https://github.com/w3c/publishingcg/issues/4