0.1.0 ⢠Published 3 years ago
altsource v0.1.0
altsource.js š§
Manipulate and Create AltStore Sources in NodeJS
š§ a WIP Dependency š§
Install
npm install altsourceExample
const AltSource = require('altsource')
const source = new AltSource({
name: "AltSource.js Test",
identifier: "space.charliecat.altsource.test",
website: "https://github.com/0Charliecat/altsource.js#readme",
subtitle: "Altsource.js Test Source",
description: "beeb boop",
publisher: "0CharlieCat",
})
source.addApp({
name: "test App",
bundle: "space.charliecat.test.altsource.app",
version: "0",
versionDate: new Date(),
versionDescription: "Test app version 1.0",
downloadURL: "https://example.com/myapp_v1.1.ipa",
size: "100"
})
console.log(JSON.stringify(source, null, 4))Example in Express.js
const express = require('express')
const app = express()
const AltSource = require('altsource')
app.use(AltSource.middleware({
name: "AltSource.js Test",
identifier: "space.charliecat.altsource.test",
website: "https://github.com/0Charliecat/altsource.js#readme",
subtitle: "Altsource.js Test Source",
description: "beeb boop",
publisher: "0CharlieCat",
}))
app.get('/addApp', (req, res) => {
req.AltSource.addApp({
name: "test App",
bundle: "space.charliecat.test.altsource.app",
version: "0",
versionDate: new Date(),
versionDescription: "Test app version 1.0",
downloadURL: "https://example.com/myapp_v1.1.ipa",
size: "100"
})
res.json(req.AltSource.toJSON())
})
app.listen(3000)Documentation
class
AltSource- constructor(config)
new AltSource(config)- param
configObjectname:StringThe name of your source as it will appear in AltStore.identifier:Stringunique and reverse-DNS formatsubtitle:String(optional) A short, one-sentence description of your source. This will appear underneath the source's name on its About page.description:String(optional) A full-length description of your source. This can include any information you believe is relevant for your source, such as information about your apps or additional links.iconURL:String|| Class that has .toString() (optional) A link to an image that will be used to visually identify your source. It will appear as a circle.headerURL:String|| Class that has .toString() (optional) A link to an image that will be displayed as the header of your source's About page. The image will be blurred by default, but can be viewed by swiping the source's info banner.website:String|| Class that has .toString() (optional) A link to the primary website for your source. It will be displayed underneath your source's name on its About page.tintColor:String|| Class that has .toString() (optional) tint color of the sourcefeaturedApps:App[]||String[](optional) if Array element isAppthen it's automaticly added to theappspropertyapps:App[]optional, Apps can be added later on via<Altsource>.addApp(App)news: NewsItem[]optional, News Items can be added later on via<Altsource>.addNewsItem(News)producer:String(optional) default<App>.developerName
- returns
AltSource
- param
.toJSON()- JSONifies Source and Returns is- returns
Any
- returns
.addNewsItem(newsItem- param
newsItemNewsItem||ObjecttitleStringThe title of your News item.identifierString(optional) if isn't provided it's automaticly generatedcaptionStringA short, one-sentence description of your News item.dateDate||String(optional) Any Date string supported by JS Date Class, automatically parsed to ISO 8601 format. If isn't provided it's set toDate.now()tintColor:String|| Class that has .toString() (optional) tint color of the news itemimageURL:String||URL|| Class that has .toString() (optional) A link to the image you want featured with your News item.notify:Boolean(optional) Whentrue, AltStore will send a push notification about this News item when it next checks for updates in the background.url:String||URL|| Class that has .toString() (optional) A link that AltStore should open when the News item is tapped. Links will be opened in an in-app web browser.appID:String||AppThe bundle identifier of an associated app. This will make the app's info banner appear below the News item, which will open the app's Store page when tapped.
- returns
void
- param
.addApp(app)- param
appObject||Appname:StringThe name of your app as it will appear on its store page.bundleIdentifier:StringYour app's bundle identifier (CFBundleIdentifier). It is case sensitive and should match exactly what is in yourInfo.plist.developerName:String(optional) The name of the developer or developers as it will appear on the store page. If isn't provided<AltSource>.produceris usedsubtitle:String(optional) A short, one-sentence description of your app that will appear in the Browse tab of AltStore.localizedDescription:StringA full-length description of your app.iconURL:String|| Class that has .toString() (optional) A link to you app's icon imagetintColor:String|| Class that has .toString() (optional) tint color of the appscreenshotURLs:String[]||URL[]Links to screenshots/images of your app.versions:AppVersion[]A list of all the published versions of your app. Newest to the frontpermisions:AppPermisions[](optional) Property found inapps.altstore.iosource, use at your own risk, might break your source or behave in an unexpected way
- returns
void
- param
.setSourceURL(url)- param
urlString||Class with .toString() - Property found in many other Sources
- param
.listApps()- lists all the apps in the source- returns
App[]
- returns
.getApp(query)- param
query:String- App Name or Bundle ID - returns
App||null
- param
- constructor(config)
class
App- constructor(config)
new App(e) || <AltSource>.addApp(e, altsource)- param
appObject||Appname:StringThe name of your app as it will appear on its store page.bundleIdentifier:StringYour app's bundle identifier (CFBundleIdentifier). It is case sensitive and should match exactly what is in yourInfo.plist.developerName:String(optional) The name of the developer or developers as it will appear on the store page. If isn't provided<AltSource>.produceris usedsubtitle:String(optional) A short, one-sentence description of your app that will appear in the Browse tab of AltStore.localizedDescription:StringA full-length description of your app.iconURL:String|| Class that has .toString() (optional) A link to you app's icon imagetintColor:String|| Class that has .toString() (optional) tint color of the appscreenshotURLs:String[]||URL[]Links to screenshots/images of your app.versions:AppVersion[]A list of all the published versions of your app. Newest to the frontpermisions:AppPermisions[](optional) Property found inapps.altstore.iosource, use at your own risk, might break your source or behave in an unexpected waybeta:Boolean(optional) Property found inapps.altstore.iosource, use at your own risk, might break your source or behave in an unexpected way
- param
altsourceAltSource(optional) - parent AltSource
- param
.newVersion( version )- Adds new version to the app and updates version related properties- param
version:Object||AppVersionversion:StringYour app's version number (CFBundleShortVersionString). It is case sensitive and should match exactly what is in yourInfo.plist.date:String||Date(optional) Any Date string supported by JS Date Class, automatically parsed to ISO 8601 format. If isn't provided it's set toDate.now()localizedDescription:String(optional) A description of what's new in this version. You can use this to tell users about new features, bugs fixes, etc.downloadURL:String||URLThe URL where your.ipais hosted.
- returns
void
- param
.newPermission(permission)permission:String||AppPermission- returns
void
.getLatestVersion()- returns
Stringlatest version
- returns
.getAppPermissions()- returns
String[]||null
- returns
.isBeta()- returns
Boolean
- returns
.toJSON()- JSONifies App and Returns it- returns
Any
- returns
.toString()- returns
String"App Name (Bundle ID i.e. com.example.app)"
- returns
.toggleBeta()- returns
Booleanthe current value of<App>.beta
- returns
- constructor(config)
class
AppVersion- constructor(version)
new AppVersion(version) || <App>.newVersion(version)- param
version:Object||AppVersionversion:StringYour app's version number (CFBundleShortVersionString). It is case sensitive and should match exactly what is in yourInfo.plist.date:String||Date(optional) Any Date string supported by JS Date Class, automatically parsed to ISO 8601 format. If isn't provided it's set toDate.now()localizedDescription:String(optional) A description of what's new in this version. You can use this to tell users about new features, bugs fixes, etc.downloadURL:String||URLThe URL where your.ipais hosted.
- returns
AppVersion
- param
.toJSON()- JSONifies AppVersion and Returns it- returns
Any
- returns
.toString()- returns
Stringversion name
- returns
- constructor(version)
class
AppPermissioncurrent known App Permisssions are:
background-audiobackground-fetchif you find new ones please create an issue
this is a feature that isn't officially documented, please procced with caution
- constructor(permission)
new AppPermission(permission || <App>.newPermission(permission)- param
permission:String - returns
AppPermission||nullif the Permission isn't valid then it returnsnull
- param
.toJSON()- JSONifies AppPermission and Returns it- returns
Any
- returns
.toString()- returns
Stringpermission name
- returns
class
NewsItem- constructor(newsItem)
new NewsItem(newsItem) || <AltSource>.addNewsItem(newsItem)- param
newsItemNewsItem||ObjecttitleStringThe title of your News item.identifierString(optional) if isn't provided it's automaticly generatedcaptionStringA short, one-sentence description of your News item.dateDate||String(optional) Any Date string supported by JS Date Class, automatically parsed to ISO 8601 format. If isn't provided it's set toDate.now()tintColor:String|| Class that has .toString() (optional) tint color of the news itemimageURL:String||URL|| Class that has .toString() (optional) A link to the image you want featured with your News item.notify:Boolean(optional) Whentrue, AltStore will send a push notification about this News item when it next checks for updates in the background.url:String||URL|| Class that has .toString() (optional) A link that AltStore should open when the News item is tapped. Links will be opened in an in-app web browser.appID:String||AppThe bundle identifier of an associated app. This will make the app's info banner appear below the News item, which will open the app's Store page when tapped.
- returns
NewsItem
- param
.toJSON()- JSONifies NewsItem and Returns is- returns
Any
- returns
- constructor(newsItem)
Express Middleware
require('altsource').middleware(Configuration, ExtendedConfig)Automatically adds AltSource to Express and publishes it on
ExtendedConfig.pathor/altstore.json- param
ConfigurationObject||AltSource- same as
AltSource
- same as
- param
ExtendedConfigObject(optional)path:String(optional) defaults to/altstore.json
returns
MiddlewareFunctionMiddlewareFunction(Request, Response, Next)
When called checks if the path is
ExtendedConfig.pathor/altstore.jsonif not then drops AltSource to `Request.AltSource` if it is then responds with the AltSource
- param
0.1.0
3 years ago