Skip to content

WillowsDocs

Willow Carlson-Huber edited this page Sep 30, 2021 · 3 revisions

Willow's docs

This documentation may not be adequately maintained in the future since I no longer work for ETHS, but others should feel free to take up the torch.

If you have questions about the backend, I can be reached at [email protected] or wooloo#7350 on Discord.

Prevent redirection to the user's default page

When linking to ETHSBell, you can pass the query string ?no_default=true to prevent automatic redirection from occurring.

Building your own schedule file

Custom-built schedule files should look like this.

{
	"schedule": {
		"Block1": {
			"name": "Your First Period Class",
			"url": "https://meet.google.com/whatever"
		},
		"Block2": {
			"name": "Second Period Class",
			"url": "https://classroom.google.com/whatever"
		},
		"Block3": {
			"name": "Class With No Teleconferencing or Classroom Link"
		}
		...
		// You can also define classes that aren't present in the above menu,
		// if a special schedule is added in the future that uses them.
	},
	"foreground_color": "#1a2741",
	"background_color": "#c34614",
	"foreground_text_color": "#ffffff",
	"background_text_color": "#ffffff",
	// This can be set to any URL, but ideally it should point to a path under our domain.
	"default_page": "/timeline",
	"include_period_name": false,
}

Beware that using the schedule editor after uploading a custom schedule file may clobber your customizations.

API docs

Automatically-generated API documentation should be present at /docs/v1 or the corresponding URL for other versions, like /docs/legacy. This documentation is not exhaustive due to issues with its generation, so if you need even more endpoints you can look at the source code under /src/api/v1.rs or similar. You can use this to build your own client software.

Local execution

The software is at least possible to port to WebAssembly, so with a little bit of effort you could in theory run a local copy of ETHSBell in the browser to allow clients to continue to function even if the public instance goes down. This functionality is not present in the official frontend.

Version information

Information about the software's build environment can be found at /api/v1/check-version. If the software was built in Github Actions or had the appropriate environment variables set, it will also include commit hash and the repository from which it was built.

Legacy admin editor

A now-defunct admin editor can be found at /editor. It does not work, and there are no plans to fix it in the near future.

Embeddable widget

A templated widget can be found at /api/v1/widget. It does not refresh automatically, but it can be embedded in a CMS (like Google Sites) for quick and dirty ETHSBell integration.

Schema generator

For local development using the API, it is possible to write the automatically generated JSON schemas to disk by running cargo run --bin bell_mkschema in the root of the repository. The schemas will be deposited in /schema.

Use as a library

ETHSBell can be referenced as you would a Rust crate, or with a sprinkling of #[repr(C)] it can (probably?) produce a C-compatible dynamic library.

Sub-server

If you need to run your own copy of ETHSBell, you can set it up to always mirror the public instance by configuring a periodic job like curl https://ethsbell.app/api/v1/spec > def.json.

In theory, you could write an even lighter sub-server for ETHSBell that pulls all of its information straight from https://ethsbell.app/api/v1/schedule, but this does not yet exist.

Testing & Linting

If you want to make sure there aren't any obvious bugs in your code before submitting it for inclusion, you can run unit tests with cargo test and you can check for basic compliance with our code guidelines by running npm i && npm run lint && cargo clippy.

Legacy endpoints

For a quick-and-dirty port of software built around the original ETHSBell, change its API endpoint from https://api.ethsbell.xyz/data to https://ethsbell.app/api/legacy/data. This endpoint won't return perfectly compatible output since Oliver wouldn't tell us what anything actually meant, but hopefully it will work long enough for you to migrate to v1.

Platform support

Running this software on Windows isn't likely to work unless you wrap it in WSL. Blame MS for using backslashes instead of slashes as a path separator, contrary to every other operating system. None of the developers working on this software at the time of writing actually run Windows, so other bugs might even affect WSL.

ICal output

ETHSBell can output an ICalendar file containing recurring events for every period of every day. This was a poorly planned feature, and can crash some client programs, but it was left in there for historical reasons. You probably shouldn't use it, but if you're interested you can query /api/v1/ical?backward=10&forward=10.

Bring-your-own-dark-mode

Out-of-the-box, we don't provide a dark mode, but the theming configuration can be used to build your own, or you can use Dark Reader in Static mode.

The "schedule" page is a bit broken even in light mode, but it's quite hard on the eyes when attempting to force it to use dark mode. If you're using Dark Reader, you should disable it for that page.