Skip to content

Commit

Permalink
added mDNS service discovery API
Browse files Browse the repository at this point in the history
  • Loading branch information
booploops committed Oct 15, 2024
1 parent a9b5296 commit 1f1e4c2
Show file tree
Hide file tree
Showing 17 changed files with 542 additions and 3 deletions.
9 changes: 8 additions & 1 deletion build.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ export default defineBuildConfig({
entries: [
// default
"./src/index",
{
"./src/mDNS",
{
builder: "copy",
input: "./src/api/ciderapi-types/",
outDir: "./build/api/ciderapi-types/",
// loaders: ['vue'],
},
{
builder: "copy",
input: "./src/vue/",
outDir: "./build/vue",
Expand Down
114 changes: 114 additions & 0 deletions build/api/ciderapi-types/CiderApp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* This is the global CiderApp object, for debugging and plugin purposes.
*/
declare namespace CiderApp {
/**
* AppFS file system.
*/
const AppFS: {
/**
* Read a file from the AppFS.
*/
readFile(fileName: string): Promise<string>,
/**
* Write a file to the AppFS.
*/
writeFile(fileName: string, contents: string): Promise<void>,
},
/**
* CiderFirebase class
*/
CiderFirebase: any,
/**
* CiderCompose class
*/
CiderCompose: any,
/**
* CiderPlaylists class
*/
CiderPlaylists: any,
/**
* CiderStripe class
*/
CiderStripe: any,
/**
* ClientDB
*/
DexieDB: any,
/**
* PouchDB object
*/
PouchDb: any,
/**
* Apple Music URL functions
*/
amURL: {
/**
* Open an Apple Music URL in the app.
* @param url
*/
openAppleMusicURL(url: string): void
}
/**
* Quasar
*/
const quasar: typeof import("quasar")
/**
* Vue app instance
*/
const app: import("vue").App
/**
* Pinia App state
*/
const appState: any
/**
* Cider config
*/
const config: any
/**
* Dialogs
*/
const dialogs: {
/**
* Immersive modal
*/
immersive(): void
/**
* Settings Modal
*/
settings(): void
}
/**
* Force the platform to a specific value.
* @param platform
*/
function forcePlatform(platform: undefined | null | "win32" | "linux" | "darwin"): void
/**
* Handle a protocol URL.
* @param url
*/
function handleProtocolURL(url: string): void
/**
* MusicKit Store
*/
const musicKitStore: any
/**
* Vue router instance
*/
const router: import("vue-router").Router
/**
* Pinia store
*/
const store: import("pinia").Pinia
/**
* URI handler
*/
const uriHandler: {
/**
* Call all functions that have been added to the onUri event.
* This is called by the main process when the app receives a URI.
*/
onUri(uri: string): void
}
}

82 changes: 82 additions & 0 deletions build/api/ciderapi-types/CiderPluginSystem.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
interface RenderComponentOptions {
component: import('../ComponentNames').ComponentNames;
props?: Record<string, any>;
// @ts-ignore
element: Element;
}


declare namespace __PLUGINSYS__ {
const Components: {
MainMenu: {
addMenuItem(item: import("../MenuEntry").MenuItem): import("../MenuEntry").MenuItem
removeMenuItem(item: import("../MenuEntry").MenuItem): void
items: import("../MenuEntry").MenuItem[]
},
ImmersiveMenu: {
addMenuItem(item: import("../MenuEntry").MenuItem): import("../MenuEntry").MenuItem
removeMenuItem(item: import("../MenuEntry").MenuItem): void
items: import("../MenuEntry").MenuItem[]
},
ImmersiveLayouts: {
addLayout(layout: import("../ImmersiveLayout.ts").CustomImmersiveLayout): void
removeLayout(layout: import("../ImmersiveLayout.ts").CustomImmersiveLayout): void
layouts: import("../ImmersiveLayout.ts").CustomImmersiveLayout[]
},
MediaItemContextMenu: {
addMenuItem(item: import("../MenuEntry").MenuItem): import("../MenuEntry").MenuItem
removeMenuItem(item: import("../MenuEntry").MenuItem): void
removeLayoutByIdentifier(identifier: string): void
items: import("../MenuEntry").MenuItem[]
},
CustomButtons: {
addCustomButton(opts: import("../CustomButton").CustomButtonOptions): void
removeCustomButton(opts: import("../CustomButton").CustomButtonOptions): void
buttons: import("../CustomButton").CustomButtonOptions[]
}
}

const ExternalMessages: {
addEventListener(event: string, cb: (e: any) => void, opts?: Partial<{ once: boolean, passive: boolean, capture: boolean }>): void
removeEventListener(event: string, cb: (e: any) => void): void
dispatchEvent(event: string, data: any): void
}

const Quasar: {
Dialog: any;
}

const IZAPI: {
mDNS: {
createBrowser(tcp_service: string, timeout: number): {
addresses: string[]
fullname: string
host: string
interfaceIndex: number
port: number
query: string[]
txt: string[]
type: {
name: string
protocol: string
subtypes: string[]
}[]
}[]
}
}

const PAPIInstance: {
addEventListener(event: import('./PAPIEvents').PAPIEvents, cb: (e: any) => void, opts?: Partial<{ once: boolean, passive: boolean, capture: boolean }>): void
removeEventListener(event: import('./PAPIEvents').PAPIEvents, cb: (e: any) => void): void
}

const App: {
Components: import('../ComponentNames').ComponentNames[]
RenderComponent: (opts: RenderComponentOptions) => void
vue: {
// @ts-ignore
render: (component: any, element: Element) => void
h: (component: any, props: Record<string, any>, children: any) => void
}
}
}
111 changes: 111 additions & 0 deletions build/api/ciderapi-types/ICiderApp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import {App} from "vue"
/**
* This is the global CiderApp object, for debugging and plugin purposes.
*/
interface ICiderApp {
/**
* AppFS file system.
*/
AppFS: {
/**
* Read a file from the AppFS.
*/
readFile(fileName: string): Promise<string>,
/**
* Write a file to the AppFS.
*/
writeFile(fileName: string, contents: string): Promise<void>,
},
/**
* CiderFirebase class
*/
CiderFirebase: any,
/**
* CiderCompose class
*/
CiderCompose: any,
/**
* CiderPlaylists class
*/
CiderPlaylists: any,
/**
* CiderStripe class
*/
CiderStripe: any,
/**
* ClientDB
*/
DexieDB: any,
/**
* PouchDB object
*/
PouchDb: any,
/**
* Apple Music URL functions
*/
amURL: {
/**
* Open an Apple Music URL in the app.
* @param url
*/
openAppleMusicURL(url: string): void,
},
/**
* Vue app instance
*/
app: App,
/**
* Pinia App state
*/
appState: any,
/**
* Cider config
*/
config: any,
/**
* Dialogs
*/
dialogs: {
/**
* Immersive modal
*/
immersive(): void,
/**
* Settings Modal
*/
settings(): void,
},
/**
* Force the platform to a specific value.
* @param platform
*/
forcePlatform(platform: undefined | null | "win32" | "linux" | "darwin"): void,
/**
* Handle a protocol URL.
* @param url
*/
handleProtocolURL(url: string): void,
/**
* MusicKit Store
*/
musicKitStore: any,
/**
* Vue router instance
*/
router: any,
/**
* Pinia store
*/
store: any,
/**
* URI handler
*/
uriHandler: {
/**
* Call all functions that have been added to the onUri event.
* This is called by the main process when the app receives a URI.
*/
onUri(uri: string): void,
},
}

8 changes: 8 additions & 0 deletions build/api/ciderapi-types/PAPIEvents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type PAPIEvents =
'app:ready' |
'shell:layout_type_changed' |
'immersive:opened' |
'immersive:closed' |
'miniplayer:opened' |
'miniplayer:closed' |
'browser:page_changed'
14 changes: 14 additions & 0 deletions build/api/ciderapi-types/PAPITypes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare namespace PAPITypes {
declare namespace App {
type Ready = {}
}
declare namespace Shell {
type LayoutTypeChanged = {
type: 'immersive' | 'miniplayer' | 'browser'
}
type ImmersiveOpened = {}
type ImmersiveClosed = {}
type MiniplayerOpened = {}
type MiniplayerClosed = {}
}
}
7 changes: 7 additions & 0 deletions build/api/ciderapi-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Type definitions for musickit-js 1.0
// Project: https://developer.apple.com/documentation/musickitjs
// Definitions by: Devid Farinelli <https://github.com/misterdev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference path="CiderApp.d.ts" />
/// <reference path="CiderPluginSystem.d.ts" />
22 changes: 22 additions & 0 deletions build/api/ciderapi-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
]
}
Loading

0 comments on commit 1f1e4c2

Please sign in to comment.