Skip to content

Commit c7cb526

Browse files
committed
Initial commit. Boilerplate
1 parent 647464d commit c7cb526

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+26894
-0
lines changed

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
globals: {
3+
appVersion: true
4+
},
5+
parserOptions: {
6+
requireConfigFile: false
7+
},
8+
extends: [
9+
'@nextcloud'
10+
],
11+
rules: {
12+
'jsdoc/require-jsdoc': 'off',
13+
'jsdoc/tag-lines': 'off',
14+
'vue/first-attribute-linebreak': 'off',
15+
'import/extensions': 'off'
16+
}
17+
}

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Declare files that always have LF line endings on checkout
2+
* text eol=lf
3+
4+
# Denote all files that are truly binary and should not be modified
5+
*.heif binary
6+
*.heic binary
7+
*.hif binary
8+
*.avif binary
9+
*.png binary
10+
*.gif binary
11+
*.webp binary
12+
*.tiff binary
13+
*.jpeg binary
14+
*.jpg binary
15+
*.svg binary
16+
17+
# Files to exclude from GitHub Languages statistics
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish to Nextcloud app store
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
APP_NAME: api_gateway_framework
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Get release url
17+
run: |
18+
APP_VERSION=$(sed -n "s/<version>\(.*\)<\/version>/\\1/p" ./appinfo/info.xml | tr -d '\t')
19+
IS_NIGHTLY=$(if [[ $APP_VERSION == *"beta"* ]]; then echo "true"; else echo "false"; fi)
20+
REP_NAME=${{github.repository_owner}}
21+
RELEASE_URL=https://github.com/$REP_NAME/$APP_NAME/releases/download/v$APP_VERSION/$APP_NAME.tar.gz
22+
curl -f --output app.tar.gz -L $RELEASE_URL
23+
echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV
24+
echo "IS_NIGHTLY=$IS_NIGHTLY" >> $GITHUB_ENV
25+
26+
- name: Prepare signature data
27+
env:
28+
NEXTCLOUD_APPSTORE_SIGNING_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
29+
run: 'echo "$NEXTCLOUD_APPSTORE_SIGNING_PRIVATE_KEY" > app.key'
30+
31+
- name: Sign release package
32+
run: |
33+
RELEASE_SIGNATURE="$(openssl dgst -sha512 -sign app.key app.tar.gz | openssl base64 -A)"
34+
echo "RELEASE_SIGNATURE=$RELEASE_SIGNATURE" >> $GITHUB_ENV
35+
36+
- name: Publish release in app store
37+
env:
38+
NEXTCLOUD_APPSTORE_API_TOKEN: ${{ secrets.APP_STORE_TOKEN }}
39+
run: 'curl -f -X POST https://apps.nextcloud.com/api/v1/apps/releases -H "Authorization: Token $NEXTCLOUD_APPSTORE_API_TOKEN" -H "Content-Type: application/json" -d ''{"download":"''$RELEASE_URL''","signature": "''$RELEASE_SIGNATURE''","nightly": "''$IS_NIGHTLY''"}'''

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
APP_NAME: api_gateway_framework
8+
9+
jobs:
10+
build_app:
11+
runs-on: ubuntu-latest
12+
name: Build and create release
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Get release info
19+
run: |
20+
APP_VERSION=$(sed -n "s/<version>\(.*\)<\/version>/\\1/p" ./appinfo/info.xml | tr -d '\t')
21+
IS_NIGHTLY=$(if [[ $APP_VERSION == *"beta"* ]]; then echo "true"; else echo "false"; fi)
22+
echo RELEASE_TAG="v$APP_VERSION" >> $GITHUB_ENV
23+
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION\s.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
24+
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
25+
if [ "$CHANGELOG" == "" ]; then
26+
echo "changelog is empty!"
27+
exit 1
28+
fi
29+
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
30+
echo "$CHANGELOG" >> $GITHUB_ENV
31+
echo "EOF" >> $GITHUB_ENV
32+
echo "IS_NIGHTLY=$IS_NIGHTLY" >> $GITHUB_ENV
33+
34+
- name: Setup Node
35+
uses: actions/setup-node@v3
36+
with:
37+
node-version: 16.x
38+
39+
- name: Build
40+
run: |
41+
npm install --deps
42+
npm run build
43+
44+
- name: Install Krankerl
45+
run: |
46+
wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb
47+
sudo dpkg -i krankerl_0.14.0_amd64.deb
48+
49+
- name: Package app
50+
run: krankerl package || make appstore
51+
52+
# - name: Sign app
53+
# run: |
54+
# # Extracting release
55+
# cd ${{ env.APP_NAME }}/build/artifacts
56+
# tar -xvf ${{ env.APP_NAME }}.tar.gz
57+
# cd ../../../
58+
# # Setting up keys
59+
# echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
60+
# echo "${{ secrets.APP_PUBLIC_CRT }}" > ${{ env.APP_NAME.key }}
61+
# # Signing
62+
# php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}
63+
# # Rebuilding archive
64+
# cd ${{ env.APP_NAME }}/build/artifacts
65+
# tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
66+
67+
- name: Create release draft
68+
uses: ncipollo/[email protected]
69+
with:
70+
name: ${{ env.RELEASE_TAG }}
71+
tag: ${{ env.RELEASE_TAG }}
72+
prerelease: ${{ env.IS_NIGHTLY }}
73+
commit: ${{ github.ref }}
74+
draft: true
75+
body: ${{ env.CHANGELOG }}
76+
artifacts: "build/artifacts/${{ env.APP_NAME }}.tar.gz"
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
artifactErrorsFailBuild: true

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/js/
2+
.code-workspace
3+
.DS_Store
4+
.idea/
5+
.vscode/
6+
.vscode-upload.json
7+
.*.sw*
8+
node_modules
9+
.venv
10+
__pycache__

.nextcloudignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.git
2+
.github
3+
.gitignore
4+
.tx
5+
.vscode
6+
.php-cs-fixer.*
7+
/.codecov.yml
8+
/.eslintrc.js
9+
/.gitattributes
10+
/.gitignore
11+
/.l10nignore
12+
/.nextcloudignore
13+
/.travis.yml
14+
/.pre-commit-config.yaml
15+
/babel.config.js
16+
/build
17+
/CODE_OF_CONDUCT.md
18+
/composer.*
19+
/node_modules
20+
/screenshots
21+
/src
22+
/vendor
23+
/jest.config.js
24+
/Makefile
25+
/krankerl.toml
26+
/package-lock.json
27+
/package.json
28+
/postcss.config.js
29+
/psalm.xml
30+
/pyproject.toml
31+
/renovate.json
32+
/stylelint.config.js
33+
/webpack.config.js
34+
tests

.php-cs-fixer.dist.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once './vendor/autoload.php';
6+
7+
use Nextcloud\CodingStandard\Config;
8+
9+
$config = new Config();
10+
$config
11+
->getFinder()
12+
->ignoreVCSIgnored(true)
13+
->notPath('build')
14+
->notPath('l10n')
15+
->notPath('src')
16+
->notPath('vendor')
17+
->in(__DIR__);
18+
return $config;

.tx/backport

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main

.tx/config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[main]
2+
host = https://www.transifex.com
3+
lang_map = hu_HU: hu, nb_NO: nb, sk_SK: sk, th_TH: th, ja_JP: ja, bg_BG: bg, cs_CZ: cs, fi_FI: fi
4+
5+
[o:nextcloud:p:nextcloud:r:api_gateway_framework]
6+
file_filter = translationfiles/<lang>/api_gateway_framework.po
7+
source_file = translationfiles/templates/api_gateway_framework.pot
8+
source_lang = en
9+
type = PO

AUTHORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Authors
2+
3+
* Andrey Borysenko <[email protected]> (Developer)
4+
* Alexander Piskun <[email protected]> (Developer)

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [0.0.1 - 2023-0x-xx]
6+
7+
First release available at Nextcloud App Store

CODE_OF_CONDUCT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Code of Conduct
2+
3+
Be openness, as well as friendly and didactic in discussions.
4+
5+
Treat everybody equally, and value their contributions.
6+
7+
Decisions are made based on technical merit and consensus.
8+
9+
Try to follow most principles described here: https://nextcloud.com/code-of-conduct/

Makefile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
all: dev-setup lint build-js-production
2+
3+
# Dev env management
4+
dev-setup: clean clean-dev npm-init
5+
6+
npm-init:
7+
npm ci
8+
9+
npm-update:
10+
npm update
11+
12+
# Building
13+
build-js:
14+
npm run dev
15+
16+
build-js-production:
17+
npm run build
18+
19+
watch-js:
20+
npm run watch
21+
22+
# Testing
23+
test:
24+
npm run test
25+
26+
test-watch:
27+
npm run test:watch
28+
29+
test-coverage:
30+
npm run test:coverage
31+
32+
# Linting
33+
lint:
34+
npm run lint
35+
36+
lint-fix:
37+
npm run lint:fix
38+
39+
# Style linting
40+
stylelint:
41+
npm run stylelint
42+
43+
stylelint-fix:
44+
npm run stylelint:fix
45+
46+
# Cleaning
47+
clean:
48+
rm -rf js
49+
50+
clean-dev:
51+
rm -rf node_modules
52+
53+
# Packaging
54+
appstore:
55+
krankerl package

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Nextcloud API Gateway Framework
2+
3+
Nextcloud API Gateway Framework for developing apps on different programming languages

appinfo/info.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<info>
3+
<id>api_gateway_framework</id>
4+
<name>Nextcloud API Gateway</name>
5+
<summary>Nextcloud API Gateway Framework for developing apps on different programming languages</summary>
6+
<description><![CDATA[Nextcloud API Gateway Framework provides service to communicate bettwen Nextcloud and external modules on different programming languages.]]></description>
7+
<version>0.0.1</version>
8+
<licence>agpl</licence>
9+
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
10+
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>
11+
<namespace>CloudApiGateway</namespace>
12+
<documentation>
13+
<developer>https://github.com/cloud-py-api/api_gateway_framework</developer>
14+
</documentation>
15+
<category>integration</category>
16+
<website>https://github.com/cloud-py-api/api_gateway_framework</website>
17+
<bugs>https://github.com/cloud-py-api/api_gateway_framework/issues</bugs>
18+
<repository type="git">https://github.com/cloud-py-api/api_gateway_framework.git</repository>
19+
<dependencies>
20+
<nextcloud min-version="26" max-version="27"/>
21+
</dependencies>
22+
<settings>
23+
<admin>OCA\CloudApiGateway\Settings\Admin</admin>
24+
<admin-section>OCA\CloudApiGateway\Settings\AdminSection</admin-section>
25+
</settings>
26+
</info>

appinfo/routes.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2023 Andrey Borysenko <[email protected]>
4+
*
5+
* @copyright Copyright (c) 2023 Alexander Piskun <[email protected]>
6+
*
7+
* @author 2023 Andrey Borysenko <[email protected]>
8+
*
9+
* @license AGPL-3.0-or-later
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License as
13+
* published by the Free Software Foundation, either version 3 of the
14+
* License, or (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Affero General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
return [
27+
'routes' => [
28+
// Daemons API actions
29+
['name' => 'api#checkDaemonsConnection', 'url' => '/daemons-check', 'verb' => 'POST'],
30+
['name' => 'api#createNewDaemonConnection', 'url' => '/daemon', 'verb' => 'POST'],
31+
['name' => 'api#getDaemonInfo', 'url' => '/daemon/{daemonId}', 'verb' => 'GET'],
32+
['name' => 'api#updateDaemonInfo', 'url' => '/daemon/{daemonId}', 'verb' => 'PUT'],
33+
['name' => 'api#getDaemonInfoByName', 'url' => '/daemon/name/{daemonName}', 'verb' => 'GET'],
34+
['name' => 'api#runDaemonApp', 'url' => '/daemon/run', 'verb' => 'POST'],
35+
['name' => 'api#checkDaemonConnectionByName', 'url' => '/daemon/name/{daemonName}/status', 'verb' => 'GET'],
36+
['name' => 'api#deleteDaemonConnection', 'url' => '/daemon/{daemonId}', 'verb' => 'DELETE'],
37+
['name' => 'api#checkDaemonConnection', 'url' => '/daemon/{daemonId}/status', 'verb' => 'GET'],
38+
['name' => 'api#checkDaemonConfig', 'url' => '/daemon/{daemonId}/config-check', 'verb' => 'POST'],
39+
['name' => 'api#handleNotification', 'url' => '/daemon/{daemonId}/notify', 'verb' => 'POST'],
40+
]
41+
];

0 commit comments

Comments
 (0)