Skip to content

Commit 36706c4

Browse files
Initial commit
0 parents  commit 36706c4

21 files changed

Lines changed: 1071 additions & 0 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Squash History
2+
on:
3+
push:
4+
branches: [main]
5+
permissions:
6+
contents: write
7+
jobs:
8+
squash:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: Check if already single commit
15+
id: check
16+
run: |
17+
COMMIT_COUNT=$(git rev-list --count HEAD)
18+
echo "count=$COMMIT_COUNT" >> "$GITHUB_OUTPUT"
19+
- name: Squash entire history to one commit
20+
if: steps.check.outputs.count != '1'
21+
run: |
22+
git checkout --orphan temp
23+
git add -A
24+
git commit -m "Initial commit"
25+
git branch -M temp main
26+
git push --force origin main
27+
env:
28+
GIT_AUTHOR_NAME: github-actions[bot]
29+
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
30+
GIT_COMMITTER_NAME: github-actions[bot]
31+
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.millennium/
3+
pnpm-lock.yaml

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"useTabs": true,
3+
"tabWidth": 4,
4+
"semi": true,
5+
"singleQuote": true,
6+
"trailingComma": "all",
7+
"jsxSingleQuote": false,
8+
"printWidth": 175
9+
}

.vscode/tasks.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build Plugin (Development)",
6+
"detail": "Build the plugin in development mode",
7+
"type": "shell",
8+
"group": "build",
9+
"command": "pnpm run dev",
10+
"presentation": {
11+
"echo": false,
12+
"clear": true
13+
},
14+
"problemMatcher": []
15+
},
16+
{
17+
"label": "Build Plugin (Production)",
18+
"detail": "Build the plugin in production mode",
19+
"type": "shell",
20+
"group": "build",
21+
"command": "pnpm run build",
22+
"presentation": {
23+
"echo": false,
24+
"clear": true
25+
},
26+
"problemMatcher": []
27+
}
28+
]
29+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Steam Client Homebrew
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Plugin Template
2+
3+
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)
4+
<br>
5+
6+
## Prerequisites
7+
8+
- **[Millennium](https://github.com/SteamClientHomebrew/Millennium)**
9+
10+
## Setting up
11+
12+
```ps1
13+
git clone https://github.com/SteamClientHomebrew/PluginTemplate
14+
cd PluginTemplate
15+
```
16+
17+
## Building
18+
19+
```
20+
pnpm run dev
21+
```
22+
23+
Then ensure your plugin template is in your plugins folder.
24+
`%MILLENNIUM_PATH%/plugins/plugin_template`, and select it from the "Plugins" tab within Steam.
25+
26+
If you wish to develop your plugin outside of `%MILLENNIUM_PATH%/plugins`, you can create a symbolic link from your development path to the plugins path
27+
28+
#### Note:
29+
30+
**MILLENNIUM_PATH** =
31+
32+
- Steam Path (ex: `C:\Program Files (x86)\Steam`) (Windows)
33+
- `~/.local/share/millennium` (Unix)
34+
35+
## Next Steps
36+
37+
https://docs.steambrew.app/developers/plugins/learn

backend/main.lua

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
local logger = require("logger")
2+
local millennium = require("millennium")
3+
4+
function test_frontend_message_callback(message, status, count)
5+
logger:info("test_frontend_message_callback called")
6+
logger:info("Received args: " .. table.concat({message, tostring(status), tostring(count)}, ", "))
7+
8+
return "Response from backend"
9+
end
10+
11+
local function on_load()
12+
print("Example plugin loaded")
13+
logger:info("Comparing millennium version: " .. millennium.cmp_version(millennium.version(), "2.29.3"))
14+
15+
logger:info("Example plugin loaded with Millennium version " .. millennium.version())
16+
millennium.ready()
17+
end
18+
19+
-- Called when your plugin is unloaded. This happens when the plugin is disabled or Steam is shutting down.
20+
-- NOTE: If Steam crashes or is force closed by task manager, this function may not be called -- so don't rely on it for critical cleanup.
21+
local function on_unload()
22+
logger:info("Plugin unloaded")
23+
end
24+
25+
-- Called when the Steam UI has fully loaded.
26+
local function on_frontend_loaded()
27+
logger:info("Frontend loaded")
28+
local result = millennium.call_frontend_method("classname.method", { 18, "USA", false })
29+
logger:info(result)
30+
end
31+
32+
return {
33+
on_frontend_loaded = on_frontend_loaded,
34+
on_load = on_load,
35+
on_unload = on_unload
36+
}

frontend/index.tsx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Millennium, IconsModule, definePlugin, Field, DialogButton, callable } from '@steambrew/client';
2+
3+
class classname {
4+
static method(country: string, age: number) {
5+
console.log(`age: ${age}, country: ${country}`);
6+
return 'method called';
7+
}
8+
}
9+
10+
// export classname class to global context
11+
Millennium.exposeObj({ classname });
12+
13+
function windowCreated(context: any) {
14+
// window create event.
15+
// you can interact directly with the document and monitor it with dom observers
16+
// you can then render components in specific pages.
17+
console.log(context);
18+
}
19+
20+
// Declare a function that exists on the backend
21+
const backendMethod = callable<[{ message: string; status: boolean; count: number }], boolean>('test_frontend_message_callback');
22+
23+
const SettingsContent = () => {
24+
return (
25+
<Field label="Plugin Settings" description="This is a description of the plugin settings." icon={<IconsModule.Settings />} bottomSeparator="standard" focusable>
26+
<DialogButton
27+
onClick={() => {
28+
console.log('Button clicked!');
29+
}}
30+
>
31+
Click Me
32+
</DialogButton>
33+
</Field>
34+
);
35+
};
36+
37+
export default definePlugin(() => {
38+
// Call the backend method
39+
backendMethod({
40+
message: 'Hello World From Frontend!',
41+
status: true,
42+
count: 69,
43+
}).then((message: any) => {
44+
console.log('Result from backendMethod:', message);
45+
});
46+
47+
Millennium.AddWindowCreateHook(windowCreated);
48+
49+
return {
50+
title: 'My Plugin',
51+
icon: <IconsModule.Settings />,
52+
content: <SettingsContent />,
53+
};
54+
});

frontend/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"jsxFactory": "window.SP_REACT.createElement",
5+
"jsxFragmentFactory": "window.SP_REACT.Fragment"
6+
},
7+
"include": ["."],
8+
"exclude": ["node_modules", "../webkit"]
9+
}

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"scripts": {
3+
"dev": "millennium-ttc --build dev",
4+
"build": "millennium-ttc --build prod"
5+
},
6+
"devDependencies": {
7+
"@babel/preset-env": "^7.28.3",
8+
"@babel/preset-react": "^7.27.1",
9+
"@babel/traverse": "^7.28.3",
10+
"@types/react": "^19.1.12",
11+
"@types/react-dom": "^19.1.9",
12+
"@types/webpack": "^5.28.5"
13+
},
14+
"type": "module",
15+
"name": "millennium-plugin",
16+
"version": "1.0.0",
17+
"description": "A template plugin for millennium",
18+
"main": "./frontend/index.jsx",
19+
"author": "Millennium",
20+
"license": "MIT",
21+
"dependencies": {
22+
"@steambrew/api": "^5.5.3",
23+
"@steambrew/client": "^5.5.3",
24+
"@steambrew/ttc": "^2.7.3",
25+
"@steambrew/webkit": "^5.5.3"
26+
}
27+
}

0 commit comments

Comments
 (0)