@casual-simulation/aux-vm-client
Advanced tools
Changelog
V3.7.0
?staticInst
in the URL query) to no longer require separate permission for performing records actions.
os.grantInstAdminPermission()
, which was a workaround to allow people to grant an inst permissions.os.grantInstAdminPermission()
in development.pack-aux
and unpack-aux
commands in the CLI to replace bot IDs with a placeholder by default.
@onClick
and @onAnyBotClicked
for code tool bots:
codeBot
- The bot that is currently being displayed in the code editor.codeTag
- The tag that is currently being displayed in the code editor.codeTagSpace
- The space of the tag that is currently being displayed in the code editor.os.recordSearchCollection(request)
- Creates or updates a Search collection. Each collection exists at an address and is assigned its own unique collection name.os.getSearchCollection(recordName, address)
- Gets information about a search collection.os.eraseSearchCollection(recordName, address)
- Deletes a search collection.os.listSearchCollections(recordName, startingAddress?)
- Lists search collections in a record.os.listSearchCollectionsByMarker(recordName, marker, startingAddress?)
- Lists search collections by marker.os.recordSearchDocument(request)
- Creates a document inside a search collection.os.eraseSearchDocument(recordName, address, documentId)
- Deletes a document from a search collection.typesense
object in the server config.const casualOsImportMap =
document.getElementById('default-import-map');
if (!casualOsImportMap) {
console.error('CasualOS import map not found!');
return;
}
const defaultImportMap = JSON.parse(casualOsImportMap.textContent);
const mapScript = document.createElement('script');
mapScript.id = 'react-import-map';
mapScript.type = 'importmap';
mapScript.textContent = JSON.stringify({
imports: {
react: defaultImportMap.imports['preact/compat'],
'react-dom': defaultImportMap.imports['preact/compat'],
'react/jsx-runtime':
defaultImportMap.imports['preact/jsx-runtime'],
},
});
document.head.append(mapScript);
unpack-aux
CLI command where tags that failed to be written would be omitted from the bot AUX file.e123
would be recognized as numbers.os.installPackage()
and os.listInstalledPackages()
would require the user to login first.os.getSharedDocument()
with a record key would sometimes fail.Changelog
V3.6.0
gridPortal
sheetPortal
systemPortal
miniGridPortal
mapPortal
miniMapPortal
meetPortal
tagPortal
os.hideLoadingScreen()
is called.logoUrl
will now display the logo in fullscreen like a "splash screen".
gridPortal
from loading automatically by setting the noGridPortal
query parameter.LOGO_URL
- The URL to the logo that should be displayed. If set, then the logo will be displayed full screen.LOGO_TITLE
- The descriptive title for the logo. Used as alt text for the logo. Additionally can be specified on its own to display a title in the regular loading dialog.LOGO_BACKGROUND_COLOR
- The color that should be displayed for the splash screen background.os.hideLoadingScreen()
function.
pack-aux
would not read files with non-standard extensions.Changelog
V3.5.4
delete
keyword.Changelog
V3.5.3
dark-gray-vector
from dark-gray
Added the Sec-Websocket-Protocol=casualos.records
header for websocket requests made to the records system.
Added a better date of birth input to the "Sign Up" page.
Added the os.calculateScreenCoordinatesFromPosition()
function.
Added batching for events sent from the main thread to the worker thread.
Added the mapPortalKind
and mapPortalGridKind
tags for the mapPortalBot
and miniMapPortalBot
.
mapPortalKind
can be used to cause the mapPortal or miniMapPortal to display the map as a flat plane instead of a sphere.
globe
- The Earth is displayed as a globe. (Default)plane
- The Earth is displayed as a flat plane by using the Mercator projection.mapPortalGridKind
can be used to cause the mapPortal or miniMapPortal use a grid that matches the globe or plane settings from mapPortalKind
.
null
- The grid matches the mapPortalKind
. (Default)globe
- The grid aligns best with the globe
mapPortalKind
.plane
- The grid aligns best with the plane
mapPortalKind
.Improved mapPortalBasemap
to support web tile URLs.
https://some.domain.com/{level}/{col}/{row}.png
https://some.domain.com/{z}/{x}/{y}.png
{}
represents a template parameter that the mapPortal/miniMapPortal will fill with the corresponding coordinate information for the requested tile.Added the os.addMapLayer(portal, layer)
and os.removeMapLayer(layerId)
functions.
os.addMapLayer(portal, layer)
- Adds a map layer to the given portal. Returns a promise that resolves with string with the ID of the layer that was added. It accepts the following arguments:
portal
- The portal that the layer should be rendered in. Can either be map
or miniMap
.layer
- The layer that should be displayed. Should be an object with the following structure:
type
- The type of the layer. Currently only geojson
is supported.url
- (Optional) The URL that the GeoJSON data can be downloaded from.data
- (Optional) The GeoJSON data that is contained in the layer. Required if url
is not specified.os.removeMapLayer(layerId)
- Removes a map layer from the portal it is in. Returns a promise that resolves once the layer has been removed.
layerId
- The ID of the layer that should be removed. You can get this from the resolved value from os.addMapLayer()
.Added the os.addBotListener(bot, tag, listener)
and os.removeBotListener(bot, tag, listener)
functions.
os.addBotListener(bot, tag, listener)
Adds the given listener to the given bot for the given tag.
bot
is the bot that the lister should be added to.tag
is the listen tag.listener
is the function that should be called when the listen tag is triggered. It should be a function that accepts the following arguments:
that
- the that
argument of the listener.bot
- The bot that the listener was triggered on. (Same as bot
above)tag
- The name of the tag. (Same as tag
above)os.removeBotListener(bot, tag, listener)
Removes the given listener from the given bot and tag.
os.addBotListener()
.bot
is the bot that the listener should be removed from.tag
is the listen tag.listener
is the function that should be removed.Added the ability to add/override bot listen tags by setting bot.listeners.tag
.
For example, the following code will override the onClick
listen tag to toast "overridden" when the bot is clicked:
bot.tags.onClick = `@os.toast("default")`;
bot.listeners.onClick = () => os.toast('overridden');
// when bot is clicked, "overridden" will be toasted instead of "default".
Just like the masks
property, the listeners
property allows you to override the default tags.
The difference is that listeners
is all about listen tags and functions. You can only set functions, and listeners
are always tempLocal
.
Functions set on the listeners
property will override listen tags set by tags and tag masks.
bot.tags.onClick
will continue to return @os.toast("default")
.Improved the CLI to support packing and unpacking AUX files into a file and folder structure.
pack-aux
- Takes a folder and builds an .aux
file from it.unpack-aux
- Takes a .aux
file and builds a folder from it.ai.stream.chat()
and ai.generateImage()
.crypto.decrypt()
.