Compare commits
No commits in common. "master" and "main" have entirely different histories.
8 changed files with 28 additions and 170 deletions
142
.github/workflows/release.yml
vendored
142
.github/workflows/release.yml
vendored
|
@ -1,142 +0,0 @@
|
|||
name: Release package
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
DC_TYPE: plugin
|
||||
DC_MIN: 2.32
|
||||
|
||||
# required to set secrets in
|
||||
# https://github.com/xxx/xxx/settings/secrets/actions
|
||||
# TELEGRAM_ID, TELEGRAM_TOKEN
|
||||
|
||||
jobs:
|
||||
check_release:
|
||||
if: (contains(github.event.head_commit.message, 'release') || (github.event_name != 'push'))
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.dotclear.outputs.version }}
|
||||
dcmin: ${{ steps.dotclear.outputs.dcmin }}
|
||||
exists: ${{ steps.repository.outputs.release-exists }}
|
||||
steps:
|
||||
- name: Checkout repository master branch
|
||||
uses: actions/checkout@master
|
||||
|
||||
# Parser from https://github.com/franck-paul
|
||||
- name: Run PHP code
|
||||
id: dotclear
|
||||
shell: php {0}
|
||||
run: |
|
||||
<?php
|
||||
$version = '';
|
||||
$dcmin = '${{ env.DC_MIN }}';
|
||||
$df = file_get_contents('./_define.php');
|
||||
if (preg_match('/registerModule\((.*?),(.*?)[\'\"],(.*?)[\'\"],(.*?)[\'\"](.*?)[\'\"](.*?)(,.*)\)/s',$df,$matches)) {
|
||||
if (isset($matches[5])) {
|
||||
$version = $matches[5];
|
||||
if (isset($matches[7])) {
|
||||
$str = $matches[7];
|
||||
if (preg_match('/\[(.*?)[\'\"]core[\'\"](.*?),(.*?)[\'\"](.*?)[\'\"](.*?)\]/s',$str,$submatches)) {
|
||||
$dcmin = $submatches[4];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
file_put_contents(getenv('GITHUB_OUTPUT'), "version=$version\n", FILE_APPEND);
|
||||
file_put_contents(getenv('GITHUB_OUTPUT'), "dcmin=$dcmin\n", FILE_APPEND);
|
||||
|
||||
- name: Check repository releases
|
||||
id: repository
|
||||
uses: insightsengineering/release-existence-action@v1.0.0
|
||||
with:
|
||||
release-tag: 'v${{ steps.dotclear.outputs.version }}'
|
||||
|
||||
do_release:
|
||||
needs: check_release
|
||||
if: needs.check_release.outputs.exists == 'false'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository master branch
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Get repository name
|
||||
id: repository
|
||||
uses: MariachiBear/get-repo-name-action@v1.1.0
|
||||
with:
|
||||
with-owner: 'false'
|
||||
|
||||
- name: Get download URL
|
||||
id: download
|
||||
run: |
|
||||
fulltag=${{ github.ref_name }}
|
||||
echo download-url="https://github.com/${{ github.repository }}/releases/download/v${{ needs.check_release.outputs.version }}/${{ env.DC_TYPE }}-${{ steps.repository.outputs.repository-name }}.zip" >> $GITHUB_OUTPUT
|
||||
|
||||
# Parser from https://github.com/franck-paul
|
||||
- name: Read dcstore
|
||||
id: readstore
|
||||
shell: php {0}
|
||||
run: |
|
||||
<?php
|
||||
if (file_exists('dcstore.xml')) {
|
||||
$ds = file_get_contents('dcstore.xml');
|
||||
if ($ds) {
|
||||
$ds = preg_replace('/<version>(.*?)<\/version>/s',"<version>${{ needs.check_release.outputs.version }}</version>",$ds);
|
||||
$ds = preg_replace('/<file>(.*?)<\/file>/s',"<file>${{ steps.download.outputs.download-url }}</file>",$ds);
|
||||
$ds = preg_replace('/<da:dcmin>(.*?)<\/da:dcmin>/s',"<da:dcmin>${{ needs.check_release.outputs.dcmin }}</da:dcmin>",$ds);
|
||||
if ($ds) {
|
||||
file_put_contents('dcstore.xml',$ds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- name: Write dcstore
|
||||
id: writestore
|
||||
shell: bash
|
||||
run: |
|
||||
test=$(git diff --name-only -- dcstore.xml)
|
||||
if [[ "$test" != "" ]]; then
|
||||
echo "dcstore.xml modified, need to be commit"
|
||||
git config user.name "${{ github.actor }}"
|
||||
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
|
||||
git add dcstore.xml
|
||||
git commit -m "Update dcstore.xml"
|
||||
git push
|
||||
else
|
||||
echo "dcstore.xml not modified"
|
||||
fi
|
||||
|
||||
- name: Create archive
|
||||
id: writearchive
|
||||
uses: thedoctor0/zip-release@0.7.6
|
||||
with:
|
||||
type: 'zip'
|
||||
directory: ..
|
||||
path: '${{ steps.repository.outputs.repository-name }}'
|
||||
filename: '${{ env.DC_TYPE }}-${{ steps.repository.outputs.repository-name }}.zip'
|
||||
exclusions: '*.git* /*node_modules/* .editorconfig'
|
||||
|
||||
- name: Create release with archive
|
||||
id: writerelease
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
artifacts: '../${{ env.DC_TYPE }}-${{ steps.repository.outputs.repository-name }}.zip'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit: master
|
||||
draft: false
|
||||
prerelease: false
|
||||
generateReleaseNotes: true
|
||||
name: ${{ steps.repository.outputs.repository-name }} ${{ needs.check_release.outputs.version }}
|
||||
tag: 'v${{ needs.check_release.outputs.version }}'
|
||||
|
||||
- name: Send Telegram Message Ok
|
||||
uses: appleboy/telegram-action@v1.0.0
|
||||
with:
|
||||
to: ${{ secrets.TELEGRAM_ID }}
|
||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
format: markdown
|
||||
message: |
|
||||
__Github workflow run__
|
||||
- Trigger: ${{ github.event_name }}
|
||||
- Release: ${{ steps.repository.outputs.repository-name }} ${{ needs.check_release.outputs.version }}
|
||||
- Download URL: ${{ steps.download.outputs.download-url }}
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,16 +1,3 @@
|
|||
construction 1.9.2 - 2023.10.25
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Code review
|
||||
|
||||
construction 1.9.1 - 2023.10.23
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Fix a typo
|
||||
* Fix repository branch
|
||||
|
||||
construction 1.9 - 2023.10.15
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# README
|
||||
|
||||
[![Release](https://img.shields.io/badge/release-1.9.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/construction/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.10.25-c44d58.svg)
|
||||
[![Release](https://img.shields.io/badge/release-1.9-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/construction/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/construction)
|
||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/construction/src/branch/master/LICENSE)
|
||||
|
|
|
@ -18,7 +18,7 @@ $this->registerModule(
|
|||
'Construction',
|
||||
'Place your blog maintenance',
|
||||
'Osku and contributors',
|
||||
'1.9.2',
|
||||
'1.9',
|
||||
[
|
||||
'requires' => [['core', '2.28']],
|
||||
'permissions' => 'My',
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="construction">
|
||||
<name>Construction</name>
|
||||
<version>1.9.2</version>
|
||||
<version>1.9</version>
|
||||
<author>Osku and contributors</author>
|
||||
<desc>Place your blog maintenance</desc>
|
||||
<file>https://github.com/JcDenis/construction/releases/download/v1.9.2/plugin-construction.zip</file>
|
||||
<file>https://git.dotclear.watch/JcDenis/construction/releases/download/v1.9/plugin-construction.zip</file>
|
||||
<da:dcmin>2.28</da:dcmin>
|
||||
<da:details>https://git.dotclear.watch/JcDenis/construction/src/branch/master/README.md</da:details>
|
||||
<da:support>https://git.dotclear.watch/JcDenis/construction/issues</da:support>
|
||||
|
|
|
@ -29,7 +29,7 @@ class Backend extends Process
|
|||
return false;
|
||||
}
|
||||
|
||||
My::addBackendMenuItem();
|
||||
My::addBackendMenuItem(App::backend()->menus()::MENU_PLUGINS, [], '(&.*)?$', My::settings()->get('flag') ? 'construction-blog' : '');
|
||||
|
||||
App::behavior()->addBehaviors([
|
||||
'adminPageHTMLHead' => function (): void {
|
||||
|
|
|
@ -32,24 +32,27 @@ class Frontend extends Process
|
|||
}
|
||||
|
||||
App::behavior()->addBehavior('publicBeforeDocumentV2', function (): void {
|
||||
// nullsafe PHP < 8.0
|
||||
if (!App::blog()->isDefined()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!My::settings()->get('flag')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tplset = App::themes()->getDefine(App::blog()->settings()->get('system')->get('theme'))->get('tplset');
|
||||
if (empty($tplset) || !is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
|
||||
$tplset = App::config()->defaultTplset();
|
||||
$tplset = App::themes()->moduleInfo(App::blog()->settings()->get('system')->get('theme'), 'tplset');
|
||||
if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
|
||||
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
|
||||
} else {
|
||||
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', App::config()->defaultTplset()]));
|
||||
}
|
||||
App::frontend()->template()->appendPath(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
|
||||
|
||||
$all_allowed_ip = json_decode((string) My::settings()->get('allowed_ip'), true);
|
||||
if (!is_array($all_allowed_ip)) {
|
||||
$all_allowed_ip = [];
|
||||
}
|
||||
$extra_urls = json_decode((string) My::settings()->get('extra_urls'), true);
|
||||
if (!is_array($extra_urls)) {
|
||||
$extra_urls = [];
|
||||
}
|
||||
if (!in_array(Http::realIP(), $all_allowed_ip)) {
|
||||
App::url()->registerDefault(function (?string $args): void {
|
||||
App::url()->type = 'default';
|
||||
|
|
|
@ -48,6 +48,11 @@ class Manage extends Process
|
|||
return false;
|
||||
}
|
||||
|
||||
// nullsafe PHP < 8.0
|
||||
if (!App::blog()->isDefined()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$s = My::settings();
|
||||
|
||||
if (!empty($_POST['saveconfig'])) {
|
||||
|
@ -88,6 +93,11 @@ class Manage extends Process
|
|||
return;
|
||||
}
|
||||
|
||||
// nullsafe PHP < 8.0
|
||||
if (!App::blog()->isDefined()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$s = My::settings();
|
||||
$editor = App::auth()->getOption('editor');
|
||||
$nb_rows = count(json_decode($s->get('allowed_ip'), true));
|
||||
|
@ -126,14 +136,14 @@ class Manage extends Process
|
|||
(new Note())->class('form-note')->text(sprintf(__('Your IP is <strong>%s</strong> - the allowed IP can view the blog normally.'), (string) Http::realIP())),
|
||||
(new Para())->class('area')->items([
|
||||
(new Label(__('Extra allowed URL types:'), Label::OUTSIDE_LABEL_BEFORE))->for('construction_extra_urls'),
|
||||
(new Input('construction_extra_urls'))->size(20)->maxlength(255)->class('maximal')->value(Html::escapeHTML(implode(',', json_decode($s->get('extra_urls'), true)))),
|
||||
(new Input('construction_extra_urls'))->size(20)->maxlenght(255)->class('maximal')->value(Html::escapeHTML(implode(',', json_decode($s->get('extra_urls'), true)))),
|
||||
]),
|
||||
]),
|
||||
(new Div())->class('fieldset')->items([
|
||||
(new Text('h4', __('Presentation'))),
|
||||
(new Para())->class('area')->items([
|
||||
(new Label(__('Title:'), Label::OUTSIDE_LABEL_BEFORE))->for('construction_title'),
|
||||
(new Input('construction_title'))->size(20)->maxlength(255)->class('maximal')->value(Html::escapeHTML($s->get('title'))),
|
||||
(new Input('construction_title'))->size(20)->maxlenght(255)->class('maximal')->value(Html::escapeHTML($s->get('title'))),
|
||||
]),
|
||||
(new Para())->class('area')->items([
|
||||
(new Label(__('Message:'), Label::OUTSIDE_LABEL_BEFORE))->for('construction_message'),
|
||||
|
|
Loading…
Reference in a new issue