Skip to content

Commit

Permalink
Implement Hissboom
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnuiL committed Jun 14, 2024
1 parent c105e7d commit e2f913d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
distribution: 'microsoft'
java-version: 21
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build --rerun-tasks
- name: Detonate JARs
run: python ./ci/hissboom.py "./build/libs/*.jar"
- name: Upload build artifacts (Fabric)
continue-on-error: true
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Copy Maven Upload URL
id: extract_maven_upload_url
run: echo "maven_upload_url=${{ secrets.MAVEN_UPLOAD_URL }}" >> $GITHUB_OUTPUT
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew assemble --rerun-tasks
- name: Detonate JARs
run: python ./ci/hissboom.py "./build/libs/*.jar"
- name: Maven Release
if: steps.extract_maven_upload_url.outputs.maven_upload_url
env:
Expand Down
35 changes: 35 additions & 0 deletions ci/hissboom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright © 2024 Ennui Langeweile, All rights reserved.
#
# ..It ain't rocket science though, expect this to be open-sourced somewhere else

from typing import IO
import argparse
import glob
import tempfile
import zipfile

def hissboomify_zip(origin: IO[bytes], target: IO[bytes], is_jij: bool):
zip = zipfile.ZipFile(file=origin, mode="r")
new_zip = zipfile.ZipFile(file=target, mode="w", compression=zipfile.ZIP_STORED if is_jij else zipfile.ZIP_DEFLATED)
for file in zip.filelist:
if file.is_dir():
new_zip.mkdir(file.filename)
else:
data = zip.open(file.filename)
if file.filename.endswith(".jar"):
hissboomify_zip(data, new_zip.open(file.filename, "w"), True)
else:
new_zip.open(file.filename, "w").write(data.read())
zip.close()

parser = argparse.ArgumentParser()
parser.add_argument("path", help="The path of the files you want to detonate")
args = parser.parse_args()

for path in glob.glob(args.path):
input = open(file=path, mode="r+b").read()
input_temp = tempfile.TemporaryFile()
input_temp.write(input)

output = open(file=path, mode="w+b")
hissboomify_zip(input_temp, output, False)
Empty file modified gradlew.bat
100644 → 100755
Empty file.

0 comments on commit e2f913d

Please sign in to comment.