Skip to content

Commit

Permalink
Add a README.txt to each project bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
invpt committed Mar 17, 2024
1 parent 9ec9fe7 commit 394229f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/bundle/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
This zip file contains the data for a tour made with TourForge. In order for a
mobile tour guide app to use the data, it has to be uploaded to a web server.

Simply upload all the files in this zip to a server, such that they are all
available for download. This includes the index.html and index.js files, which
are there so that users of TourForge can visit the URL where the tour data is
stored and have the tour data be automatically downloaded by TourForge.

For example, the list of files in this archive look something like this:
- tourforge.json
- index.html
- index.js
- dbd57c2b1d5aa3d84bdc7eaa7cd57dd7c66bd6cccd851394b2c4cf96570239ff
- ... more long strings of random numbers and letters ...

The files with long strings of random numbers and letters are assets for the
tour: mostly images and audio. The random numbers and letters of each file
name correspond to the SHA-256 hash of the file.

The web server needs to serve the data in this zip from some common base URL.
Continuing with the previous example, your configuration could serve the files
in a pattern like this:
- https://your.site.example.org/some/path/to/the/files/tourforge.json
- https://your.site.example.org/some/path/to/the/files/index.html
- https://your.site.example.org/some/path/to/the/files/index.js
- https://your.site.example.org/some/path/to/the/files/dbd57c2b1d5aa3d84bdc7eaa7cd57dd7c66bd6cccd851394b2c4cf96570239ff
- ... make sure each asset is included ...

It is important that the files are all served from the same base URL. This URL
is what is used by the tour guide mobile app to know where to download the tour
files.
2 changes: 2 additions & 0 deletions src/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import JSZip from "jszip";

import bundleIndexJsContent from "../gen/bundle/index.js?raw";

import readmeTxtContent from "./bundle/README.txt?raw";
import bundleIndexHtmlContent from "./bundle/index.html?raw";
import { type ProjectModel } from "./data";
import { type DB } from "./db";
Expand Down Expand Up @@ -50,6 +51,7 @@ const exportProjectBundleRaw = async (project: ProjectModel, loadAsset: (hash: s
let zipBlob: Blob;
try {
const zip = new JSZip();
zip.file("README.txt", readmeTxtContent);
zip.file("index.html", bundleIndexHtmlContent.replaceAll("%PROJECT_TITLE%", project.title).replaceAll("%INDEX_JS%", "index.js"));
zip.file("index.js", bundleIndexJsContent);
zip.file("tourforge.json", projectContentString);
Expand Down

0 comments on commit 394229f

Please sign in to comment.