Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Resource Files

Unique to Aidoku source projects is the res directory, which contains additional files that are packaged with the source when compiled. There are three different JSON files that are used for configuration, each of which has a corresponding JSON schema that can be used for type hints and autocompletion in IDEs.

To configure this for Visual Studio Code, you can set the json.schemas key in settings.json:

"json.schemas": [
	{
		"fileMatch": ["*/res/source.json"],
		"url": "https://raw.githubusercontent.com/Aidoku/aidoku-rs/refs/heads/main/crates/cli/src/supporting/schema/source.schema.json"
	},
	{
		"fileMatch": ["*/res/filters.json"],
		"url": "https://raw.githubusercontent.com/Aidoku/aidoku-rs/refs/heads/main/crates/cli/src/supporting/schema/filters.schema.json"
	},
	{
		"fileMatch": ["*/res/settings.json"],
		"url": "https://raw.githubusercontent.com/Aidoku/aidoku-rs/refs/heads/main/crates/cli/src/supporting/schema/settings.schema.json"
	}
]

Similarly for Zed (recommended for Rust development), you can configure the json-language-server parameters with the same array of schemas:

"lsp": {
	"json-language-server": {
		"settings": {
			"json": {
				"schemas": [
					...
				]
			}
		}
	}
}

Note that these schemas can also be checked against packaged sources by using aidoku:

aidoku verify package.aix

source.json

The source.json file is the only required configuration file, which has three components: “info” (required), “listings” (optional), and “config” (optional). Here is an example of how the file should be structured:

{
	"info": {
		"id": "en.example-source",
		"name": "Example Source",
		"version": 1,
		"url": "https://aidoku.app",
		"contentRating": 0,
		"languages": ["en"]
	},
	"listings": [
		{
			"id": "test",
			"name": "Test"
		}
	],
	"config": {
		"supportsTagSearch": true
	}
}
FieldDescription
info.idA unique identifier for the source. Conventionally, this should be the language and source name, concatenated with a period.
info.nameThe displayed name of the source.
info.altNamesAn array of additional names that the source should be searchable by.
info.versionThe source’s version number. It must be a positive integer and incremented with any notable changes.
info.urlThe source’s main URL, which can be used for deep linking.
info.urlsAn array of the source’s URLs, If the source has multiple domains, this should be used instead of info.url.
info.contentRatingThe NSFW level of the source. 0 for sources with no NSFW content at all, 1 for some NSFW, and 2 for majority NSFW sources.
info.languagesAn array of ISO 639 language codes that the source supports.
info.minAppVersionOptional minimum Aidoku app version supported by the source.
info.maxAppVersionOptional maximum Aidoku app version supported by the source.
listingsAn array of listings that the source supports. Listings can have an id, name, and kind being a grid (0) or list (1).
config.languageSelectTypeEither “single” or “multi”, defaulting to “single”. If the app should allow selecting multiple enabled languages.
config.supportsArtistSearchIf the source should allow filtering by series artists without having provided an “artist” text filter.
config.supportsAuthorSearchconfig.supportsArtistSearch but for authors.
config.supportsTagSearchIf the source should allow filtering by pressing on a tag, even if it doesn’t exist in the source filters.
config.allowsBaseUrlSelectIf selecting a URL from info.urls should be enabled in the source settings.
config.breakingChangeVersionThe source version at which a breaking change that requires migration was made.
config.hidesFiltersWhileSearchingIf filters should be disabled with an active search query.

filters.json (optional)

The filters.json file allows you to configure static filters for Aidoku to display in the UI. In addition to providing static filters, you can also programatically define “dynamic” filters using the DynamicFilters trait in your source code, which will be appended to whatever static filters you have defined. However, static filters are preferred whenever possible due to quicker loading and better inference for various features.

Filters are defined as JSON objects with varying attributes depending on the “type”:

Filter TypeDescription
textAn input field for text content (e.g. author or artist searching).
sortA sort filter, optionally supporting both ascending and descending directions.
checkA single toggle option.
selectA list allowing selection of a single value.
multi-selectA list allowing selection of multiple values, optionally supporting exclusion as well as inclusion.
noteNon-editable text for information or explanation.
rangeAn editable “from” and “to” range of numeric values.

settings.json (optional)

Similar to the filters.json file, the settings.json file allows you to define static settings for your source, with dynamic ones able to be provided through the DynamicSettings trait.

Like filters, settings are JSON objects with varying attributes depending on the “type”:

Setting TypeDescription
groupUsed to group other settings into sections with optional header and footer text.
selectA list allowing selection of a single value.
multi-selectA list allowing selection of multiple values.
switchA toggle with an on and off state.
stepperA number stepper
segmentA segmented control for selecting a single value from a few options.
textAn input field for text content.
buttonA button that can trigger an action for the source to execute programmatically.
linkA button that links to a web page.
loginA login setting, allowing for simple username/password entry or oauth flow handling.
pageUsed to group settings into a nested page.
editable-listAn editable list of items, allowing the user to add and remove arbitrary text entries.

Settings values can be fetched and set programmatically using the defaults functions provided by aidoku-rs.

icon.png

Aidoku expects a PNG image file to display as the source icon. The image should be square, and ideally 128x128 with no transparency.