ImportSongs: Add plugin support

- Files with filenames that end with .taikoweb.js can be imported and run to add custom functionality to the game
- The plugin file is a javascript module script that should have a class in the default export
- Currently supported methods in the class: name (string), load, start, stop, unload (functions)
- The class can be extended from the Patch class to add automatic patching of variables and functions
- Here are some of the plugins I made: https://github.com/KatieFrogs/taiko-web-plugins
This commit is contained in:
KatieFrogs
2022-02-11 17:28:22 +03:00
parent fd114d9f69
commit 1db4eb6710
43 changed files with 803 additions and 193 deletions

View File

@@ -20,7 +20,10 @@ function filePermission(file){
})
}
class RemoteFile{
constructor(url){
constructor(...args){
this.init(...args)
}
init(url){
this.url = url
try{
this.path = new URL(url).pathname
@@ -53,7 +56,10 @@ class RemoteFile{
}
}
class LocalFile{
constructor(file, path){
constructor(...args){
this.init(...args)
}
init(file, path){
this.file = file
this.path = path || file.webkitRelativePath
this.url = this.path
@@ -70,7 +76,10 @@ class LocalFile{
}
}
class FilesystemFile{
constructor(file, path){
constructor(...args){
this.init(...args)
}
init(file, path){
this.file = file
this.path = path
this.url = this.path
@@ -87,7 +96,10 @@ class FilesystemFile{
}
}
class GdriveFile{
constructor(fileObj){
constructor(...args){
this.init(...args)
}
init(fileObj){
this.path = fileObj.path
this.name = fileObj.name
this.id = fileObj.id
@@ -108,7 +120,10 @@ class GdriveFile{
}
}
class CachedFile{
constructor(contents, oldFile){
constructor(...args){
this.init(...args)
}
init(contents, oldFile){
this.contents = contents
this.oldFile = oldFile
this.path = oldFile.path