From e15fb57abda442a97139e15677698dbe29ed3afb Mon Sep 17 00:00:00 2001 From: DhaniAM Date: Tue, 28 Oct 2025 11:17:29 +0800 Subject: [PATCH 1/5] Updated API to SP --- OjtControlPanelPlugin.php | 2 +- OjtPageHandler.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OjtControlPanelPlugin.php b/OjtControlPanelPlugin.php index 9ff7b6f..68620a7 100644 --- a/OjtControlPanelPlugin.php +++ b/OjtControlPanelPlugin.php @@ -42,7 +42,7 @@ class OjtControlPanelPlugin extends GenericPlugin { public $registeredModule; - const API = "https://openjournaltheme.com/index.php/wp-json/openjournalvalidation/v3"; + const API = "https://sp.openjournaltheme.com/api/v1"; const SERVICE_API = "https://sp.openjournaltheme.com/"; public function register($category, $path, $mainContextId = null) diff --git a/OjtPageHandler.php b/OjtPageHandler.php index 1273130..2de5c14 100644 --- a/OjtPageHandler.php +++ b/OjtPageHandler.php @@ -151,7 +151,7 @@ public function saveSettings($args, $request) { $this->ojtPlugin->updateSetting(Application::CONTEXT_SITE, 'enable_diagnostic', filter_var($request->getUserVar('enable_diagnostic'), FILTER_VALIDATE_BOOLEAN)); $this->ojtPlugin->updateSetting($this->contextId, 'show_support_link_ojs', filter_var($request->getUserVar('show_support_link_ojs'), FILTER_VALIDATE_BOOLEAN)); - + $json['error'] = 0; $json['msg'] = 'Save Success'; return showJson($json); @@ -268,7 +268,7 @@ public function submitBug($args, $request) public function checkUpdate($args, $request) { - $url = 'https://openjournaltheme.com/index.php/wp-json/openjournalvalidation/v1/ojtplugin/check_update'; + $url = 'https://sp.openjournaltheme.com/api/v1/product/control-panel'; try { $response = $this->ojtPlugin->getHttpClient()->get($url); $json = json_decode((string) $response->getBody(), true); @@ -449,6 +449,10 @@ public function installPlugin($args, $request) if ($pluginInstance instanceof Plugin) { if ($license && !$update) { $pluginInstance->updateSetting($this->contextId, 'license', $license); + + if (method_exists($pluginInstance, 'updateStatusValidation')) { + $pluginInstance->updateStatusValidation($downloadLink['status_validation']); + } } Hook::call('OJT::pluginInstalled', array($pluginInstance)); } From 9799243ed39f7ee6d27d0ef88b12ff5cf9c834e1 Mon Sep 17 00:00:00 2001 From: DhaniAM Date: Tue, 28 Oct 2025 11:31:49 +0800 Subject: [PATCH 2/5] Added spSync.yml --- .github/workflows/spSync.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/spSync.yml diff --git a/.github/workflows/spSync.yml b/.github/workflows/spSync.yml new file mode 100644 index 0000000..15ab027 --- /dev/null +++ b/.github/workflows/spSync.yml @@ -0,0 +1,67 @@ +name: SyncToSp +# Controls when the action will run. +on: + push: + branches: + - "34" + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@master + + - name: Get branch name + id: branch-name + uses: tj-actions/branch-name@v6 + + - name: Install xmllint to read version.xml + run: sudo apt-get update -y && sudo apt-get install -y libxml2-utils + + - name: Extract data from the version.xml + id: extract_xml + run: | + name=$(xmllint --xpath "string(/version/application)" version.xml) + version=$(xmllint --xpath "string(/version/release)" version.xml) + class=$(xmllint --xpath "string(/version/class)" version.xml) + echo "name=$name" >> $GITHUB_OUTPUT + echo "version=$version" >> $GITHUB_OUTPUT + echo "class=$class" >> $GITHUB_OUTPUT + + - name: Create folder and removing .gitignore, .git & .github dir, + run: | + mkdir -p ./sp_upload + rsync -a ./ ./sp_upload/${{steps.extract_xml.outputs.class}} + rm -rf ./sp_upload/${{steps.extract_xml.outputs.class}}/.git* + rm -rf ./sp_upload/${{steps.extract_xml.outputs.class}}/sp_upload + + - name: Zip the repo and Pack to zipped folder before uploading + uses: vimtor/action-zip@v1 + with: + files: ./sp_upload + dest: ./zipped/${{steps.extract_xml.outputs.class}}.zip + + - name: Construct URL + id: construct_url + run: | + url="https://sp.openjournaltheme.com/api/v1/product/update-version" + echo "url=$url" >> $GITHUB_OUTPUT + + - name: Upload to SP with zip file + run: | + curl -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" \ + -X POST \ + -F "file=@./zipped/${{steps.extract_xml.outputs.class}}.zip" \ + -F "key=g4Tj9qL2xWz8RkD1s" \ + -F "class=${{ steps.extract_xml.outputs.class }}" \ + -F "version=${{ steps.extract_xml.outputs.version }}" \ + -F "platform_version=${{ steps.branch-name.outputs.current_branch }}" \ + "${{ steps.construct_url.outputs.url }}" + + - name: Echo URL + run: | + echo "The URL is: ${{ steps.construct_url.outputs.url }}" \ No newline at end of file From c6e8a901b8f2e0cc137d0a999544931ce4f712e7 Mon Sep 17 00:00:00 2001 From: DhaniAM <72007649+DhaniAM@users.noreply.github.com> Date: Mon, 5 Jan 2026 16:43:35 +0800 Subject: [PATCH 3/5] Update spSync to use 'name' instead of 'class' for folder name --- .github/workflows/spSync.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/spSync.yml b/.github/workflows/spSync.yml index 15ab027..be4552c 100644 --- a/.github/workflows/spSync.yml +++ b/.github/workflows/spSync.yml @@ -35,15 +35,15 @@ jobs: - name: Create folder and removing .gitignore, .git & .github dir, run: | mkdir -p ./sp_upload - rsync -a ./ ./sp_upload/${{steps.extract_xml.outputs.class}} - rm -rf ./sp_upload/${{steps.extract_xml.outputs.class}}/.git* - rm -rf ./sp_upload/${{steps.extract_xml.outputs.class}}/sp_upload + rsync -a ./ ./sp_upload/${{steps.extract_xml.outputs.name}} + rm -rf ./sp_upload/${{steps.extract_xml.outputs.name}}/.git* + rm -rf ./sp_upload/${{steps.extract_xml.outputs.name}}/sp_upload - name: Zip the repo and Pack to zipped folder before uploading uses: vimtor/action-zip@v1 with: files: ./sp_upload - dest: ./zipped/${{steps.extract_xml.outputs.class}}.zip + dest: ./zipped/${{steps.extract_xml.outputs.name}}.zip - name: Construct URL id: construct_url @@ -55,7 +55,7 @@ jobs: run: | curl -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" \ -X POST \ - -F "file=@./zipped/${{steps.extract_xml.outputs.class}}.zip" \ + -F "file=@./zipped/${{steps.extract_xml.outputs.name}}.zip" \ -F "key=g4Tj9qL2xWz8RkD1s" \ -F "class=${{ steps.extract_xml.outputs.class }}" \ -F "version=${{ steps.extract_xml.outputs.version }}" \ @@ -64,4 +64,4 @@ jobs: - name: Echo URL run: | - echo "The URL is: ${{ steps.construct_url.outputs.url }}" \ No newline at end of file + echo "The URL is: ${{ steps.construct_url.outputs.url }}" From 59502650f4f3a20135a098200b74b2ac1b257832 Mon Sep 17 00:00:00 2001 From: DhaniAM Date: Wed, 14 Jan 2026 16:44:15 +0800 Subject: [PATCH 4/5] Activate product validation during installatioin --- OjtControlPanelPlugin.php | 3 ++- OjtPageHandler.php | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/OjtControlPanelPlugin.php b/OjtControlPanelPlugin.php index 70e49e1..cb2d76a 100644 --- a/OjtControlPanelPlugin.php +++ b/OjtControlPanelPlugin.php @@ -815,7 +815,8 @@ public function getPluginDownloadLink($pluginToken, $license = false): array if (isset($response['error']) && $response['error']) throw new Exception($response['msg']); - $result['product'] = $response['data']['download_link']; + $result['product'] = $response['data']['download_link']; + $result['status_validation'] = $response['data']['status_validation'] ?? 0; $dependencies = []; foreach ($response['data']['dependencies'] as $dependency) { diff --git a/OjtPageHandler.php b/OjtPageHandler.php index 23dec77..0b38c59 100644 --- a/OjtPageHandler.php +++ b/OjtPageHandler.php @@ -537,10 +537,7 @@ public function installPlugin($args, $request) if ($pluginInstance instanceof Plugin) { if ($license && !$update) { $pluginInstance->updateSetting($this->contextId, 'license', $license); - - if (method_exists($pluginInstance, 'updateStatusValidation')) { - $pluginInstance->updateStatusValidation($downloadLink['status_validation']); - } + $pluginInstance->updateSetting($this->contextId, 'status_validated', $downloadLink['status_validation']); } Hook::call('OJT::pluginInstalled', array($pluginInstance)); } From 91432ded27586381cee7ad17d5c5a6723c814927 Mon Sep 17 00:00:00 2001 From: DhaniAM <72007649+DhaniAM@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:39:06 +0800 Subject: [PATCH 5/5] Updated SpSync to support both OJS 34 & 35 --- .github/workflows/spSync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spSync.yml b/.github/workflows/spSync.yml index be4552c..49501ba 100644 --- a/.github/workflows/spSync.yml +++ b/.github/workflows/spSync.yml @@ -59,7 +59,7 @@ jobs: -F "key=g4Tj9qL2xWz8RkD1s" \ -F "class=${{ steps.extract_xml.outputs.class }}" \ -F "version=${{ steps.extract_xml.outputs.version }}" \ - -F "platform_version=${{ steps.branch-name.outputs.current_branch }}" \ + -F "platform_version=34,35" \ "${{ steps.construct_url.outputs.url }}" - name: Echo URL