Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
7c14c24
Main upload with 1000 lines
PythonChicken123 Mar 21, 2026
b212f38
Update and rename portablemc.py to scrtips/portablemc.py
PythonChicken123 Mar 21, 2026
c996394
Remove old portablemc.py
PythonChicken123 Mar 21, 2026
1a9bff7
Remove bare exceptions for ruff linter
PythonChicken123 Mar 21, 2026
7cc2771
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 21, 2026
e4ba405
Only fallback if the individual script fails
PythonChicken123 Mar 21, 2026
83752a1
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 21, 2026
52d93f0
Update .gitignore
PythonChicken123 Mar 21, 2026
9ea3329
Amend ruff linter into commits
PythonChicken123 Mar 21, 2026
03d4778
Actual proper README.md!
PythonChicken123 Mar 21, 2026
be6b4c1
Fix a few typos in README
PythonChicken123 Mar 21, 2026
1142309
Create MIT License
PythonChicken123 Mar 21, 2026
bd57f8b
Add Socket.io and bolding of text into README
PythonChicken123 Mar 21, 2026
f01a0f7
Update the usage of libraries in README.md
PythonChicken123 Mar 21, 2026
7e91a90
Only execute ruff linter if any python file has been edited
PythonChicken123 Mar 21, 2026
e31c04d
Add TD;LR in README
PythonChicken123 Mar 21, 2026
40d5568
Add suggestion/bug section in README
PythonChicken123 Mar 21, 2026
2216dbd
Create general.yml
PythonChicken123 Mar 21, 2026
a36530e
Create custom.yml
PythonChicken123 Mar 21, 2026
5f71102
Create bug_report.yml
PythonChicken123 Mar 21, 2026
db4270d
Move into issue_template
PythonChicken123 Mar 21, 2026
816690f
Move into issue_template
PythonChicken123 Mar 21, 2026
4cdad7a
Create feature_request.yml
PythonChicken123 Mar 21, 2026
92a555c
Update main.py
PythonChicken123 Mar 21, 2026
72f11c7
Apply automatic ruff fixes and formatting [skip ci]
PythonChicken123 Mar 21, 2026
684677c
Merge branch 'main' into scripts
PythonChicken123 Mar 21, 2026
311b51d
Apply automatic ruff fixes and formatting [skip ci]
PythonChicken123 Mar 21, 2026
5378080
Update main.yml
PythonChicken123 Mar 21, 2026
56f0f4a
Apply suggestions from code review
PythonChicken123 Mar 21, 2026
7918d15
Amend Sourcery-AI suggested fixes
PythonChicken123 Mar 21, 2026
6435f1f
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 21, 2026
105a941
Update main.yml
PythonChicken123 Mar 21, 2026
acc9f6f
Add files via upload
PythonChicken123 Mar 21, 2026
ed4799c
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 21, 2026
c1cb18b
Apply suggestions from code review
PythonChicken123 Mar 21, 2026
d2dd591
Delete requirements.txt
PythonChicken123 Mar 21, 2026
7ed2882
Fix sourcery-ai bugs
PythonChicken123 Mar 21, 2026
5455d48
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 21, 2026
ca0a2b6
Apply suggestions from code review
PythonChicken123 Mar 21, 2026
a68c5db
Apply suggestions from code review
PythonChicken123 Mar 21, 2026
843fa54
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 21, 2026
dae6a5b
Sourcery-ai bug patches
PythonChicken123 Mar 22, 2026
b941427
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 22, 2026
cc89acb
Apply suggestions from code review
PythonChicken123 Mar 22, 2026
fc38e9b
Update README.md
PythonChicken123 Mar 22, 2026
a53d161
Fix KeyError
PythonChicken123 Mar 22, 2026
b6c990c
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 22, 2026
96aa912
Remove unused .hta
PythonChicken123 Mar 22, 2026
b929fe2
Rewrite junction logic
PythonChicken123 Mar 22, 2026
75402d7
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 22, 2026
e89ee01
Update portablemc.py
PythonChicken123 Mar 22, 2026
5a13029
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 22, 2026
11e9b9e
Update README.md
PythonChicken123 Mar 22, 2026
11481aa
Attempt to fix SSL errors
PythonChicken123 Mar 22, 2026
57f0ff8
Fix typo
PythonChicken123 Mar 22, 2026
b7af6c8
Remove multiple imports
PythonChicken123 Mar 22, 2026
991e33c
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Mar 22, 2026
ce65977
Updated code with cursor
PythonChicken123 Apr 10, 2026
e990a4e
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Apr 10, 2026
796a175
Enhance Launcher.targets with conditional execution
PythonChicken123 Apr 10, 2026
fefb2dc
Refactor Launcher.ps1 for improved error handling
PythonChicken123 Apr 10, 2026
31e7eb5
Refactor Launcher.vbs for improved functionality
PythonChicken123 Apr 10, 2026
092316d
Refactor PortableMCLoader.cs for improved clarity
PythonChicken123 Apr 10, 2026
068f608
Update portablemc.py with cursor
PythonChicken123 Apr 10, 2026
61e2424
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Apr 10, 2026
1530c5e
Enhance README with Debug Menu and structure updates
PythonChicken123 Apr 10, 2026
39d799c
Update main.py
PythonChicken123 Apr 10, 2026
cdbfff3
Update README.md
PythonChicken123 Apr 16, 2026
54bd090
Update
PythonChicken123 Apr 16, 2026
ac412a1
Fix hardcoded paths and ruff linter
PythonChicken123 Apr 16, 2026
3e5dafb
Apply automatic ruff fixes and formatting [skip ci]
github-actions[bot] Apr 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
ruff:
push-fix:
if: github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '[skip ci]')
runs-on: ubuntu-latest
# Skip if the commit already contains [skip ci]
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -38,9 +38,48 @@ jobs:

- name: Commit and push if changed
if: steps.git-check.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "${{ github.event.head_commit.author.name }}"
git config --global user.email "${{ github.event.head_commit.author.email }}"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
git add .
git commit -m "Apply automatic ruff fixes and formatting [skip ci]"
git push

pr-comment:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Ruff
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
uses: astral-sh/ruff-action@v3
with:
version: "latest"

- name: Fix linting issues and format
run: |
ruff check --fix .
ruff format .

- name: Check for changes
id: git-check
run: |
git diff --quiet || echo "changed=true" >> $GITHUB_OUTPUT

- name: Comment on PR if changed
if: steps.git-check.outputs.changed == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ **Ruff auto-fix applied (changes detected)**\n\nLinting and formatting changes were found. Please run `ruff check --fix . && ruff format .` locally and push the changes, or let the push job handle it on the next commit.'
})
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PortableMCLoader.exe
*.tmp
*.log

# User data and game files
# User data (optional, keep if you want to exclude user‑specific files)
mods/
resourcepacks/
servers.dat
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 PythonChicken123

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
114 changes: 91 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,101 @@
A Python Script that you can use to launch minecraft via a web browser using Flask for a portable installation using PortableMC with an additional web console.
# Minecraft Portable Web Launcher

In early development.

Using:
* C# Code compilation
* EXE Code compilation
* Powershell Script Code as fallback
* VBS Script as fallback
A Python‑based Minecraft launcher that runs in a browser using [Flask](https://github.com/pallets/flask) and [PortableMC](https://github.com/mindstorm38/portablemc). Designed for restricted Windows environments where arbitrary `.exe` files are blocked. It uses multiple fallback mechanisms (C# compilation, PowerShell, VBScript) to bypass Group Policy restrictions.

![Preview](static/preview.jpg)

Execution steps:
1. Clone this repository
```cli
git clone https://github.com/PythonChicken123/Minecraft-Portable-Web/
```
2. Switch the branch from main to scripts
```cli
git switch scripts
> [!WARNING]
> This project is for education, launcher portability, and system compatibility testing.
> Do not use it for bypassing security policy without authorization.

## Features

- **Web interface** with live console (via Flask‑SocketIO)
- **CLI mode** for direct terminal launching
- **MSBuild fallback** – compiles a C# loader on‑the‑fly
- **PowerShell & VBScript fallbacks** for the most restricted environments
- **Junctions** for `mods` and `resourcepacks` (or regular directories if junctions are blocked)
- **All data stored in `%LOCALAPPDATA%\PortableMC`** – no clutter in the project folder
- **Debugging Menu** - hidden option with many debugging options

## Folder Structure & Trusted Dir Strategy
The launcher uses a hybrid strategy to find a writable/executable directory, prioritizing `%LOCALAPPDATA%\PortableMC`, then falling back to `%TEMP%` or `%PUBLIC%` if necessary.

```text
Minecraft-Portable-Web/
├── main.py # Entry point – menu & bootstrapping
├── scripts/ # Launcher helper scripts
│ ├── Launcher.targets # MSBuild task
│ ├── PortableMCLoader.cs # C# loader (compiled if needed)
│ ├── Launcher.vbs # VBScript fallback
│ └── Launcher.ps1 # PowerShell fallback
| └── portablemc.py # Web server (Flask + SocketIO)
├── static/ # Web UI Assets
├── mods/ (optional) your mods
├── resourcepacks/ (optional) your resource packs
├── options.txt (optional) Minecraft settings
└── servers.dat (optional) server list
```
3. Change into the directory
```cli

## Requirements

- Windows 10/11
- Python 3.11+ (or the script will download an embedded Python 3.14).
- (Optional) MSBuild (comes with .NET Framework 4.8) – used for the C# fallback.
- (Optional) PowerShell 3.0+ – used as a fallback.
- (Optional) VBScript support – used as a final fallback.

## TL;DR
* Test on a **Restricted Environment** by **Group Policy**
* Port all code to **Rust**

## Getting Started

```bash
git clone https://github.com/PythonChicken123/Minecraft-Portable-Web/
cd Minecraft-Portable-Web
```
4. Execute the script
```cli
git switch scripts
python main.py
```
Then choose a method:
* `1` – Web launcher (opens `portablemc.py` in your browser)
* `2` – MSBuild launcher (uses `Launcher.targets`, compiles C# loader in memory)
* `3` – CLI launcher (runs `portablemc` directly in the terminal)
* `4` - Debug Menu (shows a hidden debug list)

## How It Works (Bypass Chain)
The launcher tries the most reliable method first, falling back if blocked:

1. **Embedded Python + portablemc** (if the system allows Python execution).
2. **MSBuild + C# compilation** (uses `csc.exe` to compile a tiny loader).
3. **PowerShell** (with `-ExecutionPolicy Bypass`).
4. **VBScript** (via `cscript`).

If a method is blocked, it tries the next. All launchers set __COMPAT_LAYER=RUNASINVOKER to avoid UAC prompts.
If all methods fail, the script will leave a log dump which you can use to [open an issue](https://github.com/PythonChicken123/Minecraft-Portable-Web/issues)

All downloaded files (embedded Python, portablemc binary) are stored in `%LOCALAPPDATA%\PortableMC`. Junctions are created for `mods` and `resourcepacks` so that files placed in the project folder appear inside the game.

## Development
* **Linting:** Ruff is used – run `ruff check .` and `ruff format .` before committing.
* **Workflow:** The GitHub Actions workflow (`.github/workflows/main.yml`) automatically applies Ruff fixes on push/pull requests.

## Troubleshooting
* `OSError: [WinError 1260]` – Group Policy blocks the method you chose. Try another option.
* **PowerShell / VBScript errors** – Ensure the scripts have proper permissions. The launcher sets `__COMPAT_LAYER=RUNASINVOKER` to avoid UAC prompts.
* **SSL errors** – The C# loader and Python scripts force TLS 1.2 and fall back to disabling certificate validation.
* **Junction creation fails** – The launcher falls back to creating regular directories.

## Found a bug? / Have a suggestion?
If you encounter any issues or have an idea to improve the launcher, please [open an issue](https://github.com/PythonChicken123/Minecraft-Portable-Web/issues) and use the appropriate template. We welcome contributions!

*An attempt to bypass group policy with potentional fallbacks*
## License
MIT

`OSError: [WinError 1260] This program is blocked by group policy. For more information, contact your system administrator`
## Libraries Used
* [PortableMC](https://github.com/mindstorm38/portablemc) – The Heart of The Launcher
* [Flask](https://flask.palletsprojects.com/) & [Flask‑SocketIO](https://flask-socketio.readthedocs.io/) – Web Interface
* [ansi2html](https://github.com/ralphbean/ansi2html) & [ansi_up](https://github.com/drudru/ansi_up) – ANSI colour conversion
* [Socket.io](https://socket.io) - Communication between the web and Flask interfaces
* [Ruff Linter](https://github.com/astral-sh/ruff) - An extremely fast Python linter
* [uv](https://github.com/astral-sh/uv) - An extremely fast Python package and project manager, written in Rust.
Loading