-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Move templates into main repo
- Loading branch information
Showing
18 changed files
with
1,489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### Theme Template | ||
|
||
- Located in the `/theme` directory. | ||
- Serves as a base for creating custom themes. | ||
- Designed to modify the visual appearance of the Steam client. | ||
- Provides essential assets and configurations for a cohesive design. | ||
|
||
### Plugin Template | ||
|
||
- Located in the `/plugin` directory. | ||
- Serves as a framework for developing plugins. | ||
- Designed to change or extend the functionality of the Steam client. | ||
- Offers a structured approach for integrating new features. | ||
|
||
|
||
More documentation can be found here: https://docs.steambrew.app/developers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
> [!CAUTION] | ||
> This plugin example and other related documentation is not yet finished. You will not receive support for development until everything is ready. This plugin template may not be fully functional, and critical portions of it may be outdated. Once this example is ready, this message will be removed | ||
## Plugin Template | ||
A plugin template for Millennium providing a basic boilerplate to help get started. You'll need a decent understanding in python, and typescript (superset of javascript) | ||
<br> | ||
|
||
## Prerequisites | ||
- **[Millennium](https://github.com/SteamClientHomebrew/Millennium)** | ||
|
||
## Setting up | ||
```ps1 | ||
git clone https://github.com/SteamClientHomebrew/PluginTemplate.git | ||
cd PluginTemplate | ||
pnpm install | ||
``` | ||
|
||
## Building | ||
``` | ||
pnpm run dev | ||
``` | ||
|
||
Then ensure your plugin template is in your plugins folder. | ||
`%MILLENNIUM_PATH%/plugins`, and select it from the "Plugins" tab within steam, or run `millennium plugins enable your_plugin_internal_name` | ||
|
||
#### Note: | ||
**MILLENNIUM_PATH** = | ||
* Steam Path (ex: `C:\Program Files (x86)\Steam`) (Windows) | ||
* `~/.millennium` (Unix) | ||
|
||
## Next Steps | ||
|
||
https://docs.steambrew.app/developers/plugins/learn | ||
|
||
<!-- ## Deploying | ||
```ps1 | ||
pnpm run build | ||
``` --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Millennium | ||
|
||
import time | ||
import json | ||
|
||
class Backend: | ||
@staticmethod | ||
def receive_frontend_message(message: str, status: bool, count: int): | ||
print(f"received: {[message, status, count]}") | ||
|
||
# accepted return types [str, int, bool] | ||
if count == 69: | ||
return True | ||
else: | ||
return | ||
|
||
def get_steam_path(): | ||
print("getting steam path") | ||
return Millennium.steam_path() | ||
|
||
class Plugin: | ||
|
||
# if steam reloads, i.e. from a new theme being selected, or for other reasons, this is called. | ||
# with the above said, that means this may be called more than once within your backends lifespan | ||
def _front_end_loaded(self): | ||
# The front end has successfully mounted in the steam app. | ||
# You can now use Millennium.call_frontend_method() | ||
|
||
print("The front end has loaded!") | ||
|
||
start_time = time.time() | ||
value = Millennium.call_frontend_method("classname.method", params=[18, "USA", False]) | ||
end_time = time.time() | ||
|
||
print(f"classname.method says -> {value} [{round((end_time - start_time) * 1000, 3)}ms]") | ||
|
||
|
||
def _load(self): | ||
# This code is executed when your plugin loads. | ||
# notes: thread safe, running for entire lifespan of millennium | ||
|
||
print(f"bootstrapping plugin, millennium v{Millennium.version()}") | ||
print(f"Steam Path -> {Millennium.steam_path()}") | ||
|
||
# print("pinging frontend") | ||
try: | ||
value = Millennium.call_frontend_method("classname.method", params=[18, "USA", False]) | ||
print(f"ponged message -> {value}") | ||
except ConnectionError as error: | ||
print(error) # "frontend is not loaded!" | ||
|
||
|
||
def _unload(self): | ||
print("unloading") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Millennium } from "millennium-lib"; | ||
|
||
class classname { | ||
static method(country: string, age: number) { | ||
console.log(`age: ${age}, country: ${country}`); | ||
return "method called" | ||
} | ||
} | ||
// export classname class to global context | ||
Millennium.exposeObj({ classname }); | ||
|
||
function windowCreated(context: object) | ||
{ | ||
// window create event. | ||
// you can interact directly with the document and monitor it with dom observers | ||
// you can then render components in specific pages. | ||
console.log(context) | ||
} | ||
|
||
// Entry point on the front end of your plugin | ||
export default async function PluginMain() { | ||
|
||
// const startTime = Date.now(); | ||
|
||
// const result = await Millennium.callServerMethod("Backend.receive_frontend_message", { | ||
// message: "Hello World From Frontend!", | ||
// status: true, | ||
// count: 69 | ||
// }) | ||
// console.log(`callServerMethod took: ${Date.now() - startTime} ms`); | ||
|
||
// const steam_path = await Millennium.callServerMethod("get_steam_path") | ||
|
||
// console.log("Result from callServerMethod:", result) | ||
// console.log("Steam Path:", steam_path) | ||
Millennium.AddWindowCreateHook(windowCreated) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"scripts": { | ||
"dev": "millennium-ttc --build dev", | ||
"build": "millennium-ttc --build prod" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "16.14.0", | ||
"@types/react-dom": "^18.3.0", | ||
"@types/webpack": "^5.28.5", | ||
"millennium-lib": "^3.5.6" | ||
}, | ||
"type": "module", | ||
"name": "millennium-plugin", | ||
"version": "1.0.0", | ||
"description": "A template plugin for millennium", | ||
"main": "./frontend/index.jsx", | ||
"author": "Millennium", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/SteamClientHomebrew/Millennium/main/src/sys/plugin-schema.json", | ||
|
||
"name": "__plugin__", | ||
"common_name": "Plugin Example", | ||
"description": "A template plugin for Millennium." | ||
} |
Oops, something went wrong.