Fix License Patch
This commit is contained in:
parent
e117fb53fc
commit
62e35e50a9
2 changed files with 51 additions and 193 deletions
216
patches/01.patch
216
patches/01.patch
|
|
@ -1,198 +1,28 @@
|
||||||
diff --git a/.forgejo/workflows/package.yaml b/.forgejo/workflows/package.yaml
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000..46a3954c
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/.forgejo/workflows/package.yaml
|
|
||||||
@@ -0,0 +1,69 @@
|
|
||||||
+name: Build Patched Release
|
|
||||||
+
|
|
||||||
+on:
|
|
||||||
+ push:
|
|
||||||
+ branches:
|
|
||||||
+ - 'patches/*'
|
|
||||||
+
|
|
||||||
+jobs:
|
|
||||||
+ build:
|
|
||||||
+ runs-on: docker
|
|
||||||
+ container:
|
|
||||||
+ image: ghcr.io/catthehacker/ubuntu:act-22.04
|
|
||||||
+
|
|
||||||
+ steps:
|
|
||||||
+ - name: Checkout
|
|
||||||
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
+
|
|
||||||
+ - name: Set up JDK 17
|
|
||||||
+ uses: https://github.com/actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
|
|
||||||
+ with:
|
|
||||||
+ java-version: "17"
|
|
||||||
+ distribution: "temurin"
|
|
||||||
+
|
|
||||||
+ - uses: https://github.com/gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
|
|
||||||
+ with:
|
|
||||||
+ gradle-version: 8.12
|
|
||||||
+
|
|
||||||
+ - name: Run Gradle Command
|
|
||||||
+ run: ./gradlew clean build
|
|
||||||
+ env:
|
|
||||||
+ DOCKER_ENABLE_SECURITY: false
|
|
||||||
+
|
|
||||||
+ - name: Get version number
|
|
||||||
+ id: versionNumber
|
|
||||||
+ run: echo "versionNumber=$(./gradlew printVersion --quiet | tail -1)" >> $GITHUB_OUTPUT
|
|
||||||
+
|
|
||||||
+ - name: Login to Container Registry
|
|
||||||
+ uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
|
||||||
+ with:
|
|
||||||
+ registry: git.spgrn.com
|
|
||||||
+ username: seang96
|
|
||||||
+ password: ${{ secrets.TOKEN }}
|
|
||||||
+
|
|
||||||
+ - name: Convert repository owner to lowercase
|
|
||||||
+ id: repoowner
|
|
||||||
+ run: echo "lowercase=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT
|
|
||||||
+
|
|
||||||
+ - name: Generate tags fat
|
|
||||||
+ id: meta3
|
|
||||||
+ uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
|
|
||||||
+ with:
|
|
||||||
+ images: |
|
|
||||||
+ git.spgrn.com/${{ steps.repoowner.outputs.lowercase }}/s-pdf
|
|
||||||
+ git.spgrn.com/${{ steps.repoowner.outputs.lowercase }}/stirling-pdf
|
|
||||||
+ tags: |
|
|
||||||
+ type=raw,value=${{ steps.versionNumber.outputs.versionNumber }}-fat
|
|
||||||
+ type=raw,value=latest-fat
|
|
||||||
+
|
|
||||||
+ - name: Build and push main Dockerfile fat
|
|
||||||
+ id: build-push-fat
|
|
||||||
+ uses: docker/build-push-action@v5
|
|
||||||
+ with:
|
|
||||||
+ context: .
|
|
||||||
+ file: ./Dockerfile.fat
|
|
||||||
+ push: true
|
|
||||||
+ tags: ${{ steps.meta3.outputs.tags }}
|
|
||||||
+ labels: ${{ steps.meta3.outputs.labels }}
|
|
||||||
+ build-args: VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }}
|
|
||||||
+ platforms: linux/amd64
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/.forgejo/workflows/patch-latest-release.yaml b/.forgejo/workflows/patch-latest-release.yaml
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000..f36dcf98
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/.forgejo/workflows/patch-latest-release.yaml
|
|
||||||
@@ -0,0 +1,100 @@
|
|
||||||
+name: Patch Latest Release
|
|
||||||
+
|
|
||||||
+on:
|
|
||||||
+ schedule:
|
|
||||||
+ - cron: '0 0 * * *'
|
|
||||||
+ push:
|
|
||||||
+ branches:
|
|
||||||
+ - patch
|
|
||||||
+ workflow_dispatch:
|
|
||||||
+
|
|
||||||
+jobs:
|
|
||||||
+ patch-latest-tag:
|
|
||||||
+ runs-on: docker
|
|
||||||
+ container:
|
|
||||||
+ image: ghcr.io/catthehacker/ubuntu:act-22.04
|
|
||||||
+
|
|
||||||
+ steps:
|
|
||||||
+ - name: Checkout main repository
|
|
||||||
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
+
|
|
||||||
+ - name: Set Git identity
|
|
||||||
+ run: |
|
|
||||||
+ git config --global user.name "Workflow"
|
|
||||||
+ git config --global user.email "noreply@spgrn.com"
|
|
||||||
+
|
|
||||||
+ - name: Fetch upstream tags
|
|
||||||
+ run: |
|
|
||||||
+ git remote add upstream https://github.com/Stirling-Tools/Stirling-PDF.git
|
|
||||||
+ git fetch upstream --tags
|
|
||||||
+
|
|
||||||
+ - name: Get latest tag
|
|
||||||
+ id: latest_tag
|
|
||||||
+ run: |
|
|
||||||
+ latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` || echo "")
|
|
||||||
+ if [ -z "$latest_tag" ]; then
|
|
||||||
+ echo "No tags found in the upstream repository."
|
|
||||||
+ exit 1
|
|
||||||
+ fi
|
|
||||||
+ echo "Latest upstream tag: $latest_tag"
|
|
||||||
+ echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
|
|
||||||
+
|
|
||||||
+ - name: Checkout latest upstream tag
|
|
||||||
+ run: |
|
|
||||||
+ git checkout -b upstream-tag refs/tags/${{ steps.latest_tag.outputs.latest_tag }}
|
|
||||||
+
|
|
||||||
+ - name: Checkout patch repository
|
|
||||||
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
+ with:
|
|
||||||
+ repository: seang96/stirling-pdf-patches
|
|
||||||
+ ref: main
|
|
||||||
+ path: patch-repo
|
|
||||||
+ github-server-url: 'https://git.spgrn.com'
|
|
||||||
+ fetch-depth: 0
|
|
||||||
+
|
|
||||||
+ - name: Verify patch files
|
|
||||||
+ run: |
|
|
||||||
+ ls -l patch-repo/patches
|
|
||||||
+ for patch in patch-repo/patches/*.patch; do
|
|
||||||
+ echo "Found patch: $patch"
|
|
||||||
+ cat "$patch"
|
|
||||||
+ done
|
|
||||||
+
|
|
||||||
+ - name: Apply patches from repository
|
|
||||||
+ run: |
|
|
||||||
+ # Apply all patches in the "patches" folder
|
|
||||||
+ for patch in patch-repo/patches/*.patch; do
|
|
||||||
+ echo "Applying patch: $patch"
|
|
||||||
+ git apply --reject --whitespace=fix "$patch"
|
|
||||||
+ done
|
|
||||||
+
|
|
||||||
+ - name: Cleanup patch repository
|
|
||||||
+ run: |
|
|
||||||
+ echo "Cleaning up patch-repo folder"
|
|
||||||
+ rm -rf patch-repo
|
|
||||||
+
|
|
||||||
+ - name: Commit applied patches
|
|
||||||
+ run: |
|
|
||||||
+ git add .
|
|
||||||
+ git commit -m "Applied patches from patches folder"
|
|
||||||
+
|
|
||||||
+ - name: Push to remote branch
|
|
||||||
+ id: push_branch
|
|
||||||
+ run: |
|
|
||||||
+ patched_branch="patches/${{ steps.latest_tag.outputs.latest_tag }}"
|
|
||||||
+ git checkout -b $patched_branch
|
|
||||||
+ git push origin $patched_branch --force
|
|
||||||
+ echo "patched_branch=$patched_branch" >> $GITHUB_OUTPUT
|
|
||||||
+
|
|
||||||
+ - name: Trigger Package Workflow
|
|
||||||
+ run: |
|
|
||||||
+ patched_branch="${{ steps.push_branch.outputs.patched_branch }}"
|
|
||||||
+ echo "Triggering with ref: $patched_branch"
|
|
||||||
+ payload=$(jq -n --arg ref "$patched_branch" '{"ref":$ref}')
|
|
||||||
+ echo "Payload: $payload"
|
|
||||||
+ curl -X POST \
|
|
||||||
+ "${{ env.GITHUB_API_URL }}/repos/${{ env.GITHUB_REPOSITORY }}/actions/workflows/package.yaml/dispatches" \
|
|
||||||
+ -H "accept: application/json" \
|
|
||||||
+ -H "Authorization: token ${{ secrets.PATCH_TOKEN }}" \
|
|
||||||
+ -H "Content-Type: application/json" \
|
|
||||||
+ -d "$payload"
|
|
||||||
diff --git a/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java b/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
diff --git a/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java b/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
||||||
index 4636c892..f229c7a8 100644
|
index d788504c..df83518d 100644
|
||||||
--- a/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
--- a/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
||||||
+++ b/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
+++ b/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
||||||
@@ -37,9 +37,8 @@ public class LicenseKeyChecker {
|
@@ -44,20 +44,9 @@ public class LicenseKeyChecker {
|
||||||
if (!applicationProperties.getEnterpriseEdition().isEnabled()) {
|
if (!applicationProperties.getPremium().isEnabled()) {
|
||||||
enterpriseEnabledResult = false;
|
premiumEnabledResult = License.NORMAL;
|
||||||
} else {
|
} else {
|
||||||
- enterpriseEnabledResult =
|
- String licenseKey = getLicenseKeyContent(applicationProperties.getPremium().getKey());
|
||||||
- licenseService.verifyLicense(
|
- if (licenseKey != null) {
|
||||||
- applicationProperties.getEnterpriseEdition().getKey());
|
- premiumEnabledResult = licenseService.verifyLicense(licenseKey);
|
||||||
+ enterpriseEnabledResult = true;
|
- if (License.ENTERPRISE == premiumEnabledResult) {
|
||||||
|
- log.info("License key is Enterprise.");
|
||||||
|
- } else if (License.PRO == premiumEnabledResult) {
|
||||||
|
- log.info("License key is Pro.");
|
||||||
|
- } else {
|
||||||
|
- log.info("License key is invalid, defaulting to non pro license.");
|
||||||
|
- }
|
||||||
|
- } else {
|
||||||
|
- log.error("Failed to obtain license key content.");
|
||||||
|
- premiumEnabledResult = License.NORMAL;
|
||||||
|
- }
|
||||||
|
+ premiousEnabledResult = License.ENTERPRISE;
|
||||||
+ applicationProperties.getEnterpriseEdition().setMaxUsers(Integer.MAX_VALUE);
|
+ applicationProperties.getEnterpriseEdition().setMaxUsers(Integer.MAX_VALUE);
|
||||||
if (enterpriseEnabledResult) {
|
+ log.info("License key is Enterprise.");
|
||||||
log.info("License key is valid.");
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
|
|
||||||
28
patches/enterprise-license.patch
Normal file
28
patches/enterprise-license.patch
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
diff --git a/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java b/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
||||||
|
index d788504c..df83518d 100644
|
||||||
|
--- a/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
||||||
|
+++ b/src/main/java/stirling/software/SPDF/EE/LicenseKeyChecker.java
|
||||||
|
@@ -44,20 +44,9 @@ public class LicenseKeyChecker {
|
||||||
|
if (!applicationProperties.getPremium().isEnabled()) {
|
||||||
|
premiumEnabledResult = License.NORMAL;
|
||||||
|
} else {
|
||||||
|
- String licenseKey = getLicenseKeyContent(applicationProperties.getPremium().getKey());
|
||||||
|
- if (licenseKey != null) {
|
||||||
|
- premiumEnabledResult = licenseService.verifyLicense(licenseKey);
|
||||||
|
- if (License.ENTERPRISE == premiumEnabledResult) {
|
||||||
|
- log.info("License key is Enterprise.");
|
||||||
|
- } else if (License.PRO == premiumEnabledResult) {
|
||||||
|
- log.info("License key is Pro.");
|
||||||
|
- } else {
|
||||||
|
- log.info("License key is invalid, defaulting to non pro license.");
|
||||||
|
- }
|
||||||
|
- } else {
|
||||||
|
- log.error("Failed to obtain license key content.");
|
||||||
|
- premiumEnabledResult = License.NORMAL;
|
||||||
|
- }
|
||||||
|
+ premiousEnabledResult = License.ENTERPRISE;
|
||||||
|
+ applicationProperties.getEnterpriseEdition().setMaxUsers(Integer.MAX_VALUE);
|
||||||
|
+ log.info("License key is Enterprise.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue