From 6d343b7686741b13ff17ef2a6ec78eb598f3e8e7 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 30 Oct 2022 14:18:01 +0100 Subject: [PATCH 001/383] add webpack-encore --- package.json | 16 ++++++----- src/admin.js | 2 ++ src/{SideMenu.js => menu.js} | 14 +++++++--- webpack.config.js | 34 +++++++++++++++++++++++ webpack.js | 54 ------------------------------------ 5 files changed, 55 insertions(+), 65 deletions(-) rename src/{SideMenu.js => menu.js} (87%) create mode 100644 webpack.config.js delete mode 100644 webpack.js diff --git a/package.json b/package.json index 503c7d1..a284b60 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "license": "agpl", "private": true, "scripts": { - "build": "NODE_ENV=production ./node_modules/.bin/webpack-cli --progress --config webpack.js", - "dev": "NODE_ENV=development ./node_modules/.bin/webpack-cli --progress --config webpack.js", - "watch": "NODE_ENV=development ./node_modules/.bin/webpack-cli --progress --watch --config webpack.js", + "build": "./node_modules/.bin/encore prod", + "dev": "./node_modules/.bin/encore dev", + "watch": "./node_modules/.bin/encore dev --watch", "lint": "./node_modules/.bin/eslint --ext .js,.vue src", "lint:fix": "./node_modules/.bin/eslint --ext .js,.vue src --fix", "stylelint": "./node_modules/.bin/stylelint src", @@ -12,7 +12,6 @@ }, "dependencies": { "axios": "^0.24.0", - "trim": "^1.0.1", "vue": "^2.6.11" }, "browserslist": [ @@ -24,13 +23,16 @@ "devDependencies": { "@babel/core": "^7.9.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.19.6", "@babel/preset-env": "^7.9.0", + "@babel/runtime": "^7.20.0", "@nextcloud/axios": "^1.8.0", "@nextcloud/browserslist-config": "^1.0.0", "@nextcloud/eslint-config": "^8.1.2", "@nextcloud/initial-state": "^2.0.0", "@nextcloud/l10n": "^1.6.0", "@nextcloud/vue": "^7.0.0", + "@symfony/webpack-encore": "^4.1.1", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "css-loader": "^3.4.2", @@ -45,8 +47,8 @@ "eslint-plugin-vue": "^9.0.0", "eslint-webpack-plugin": "^3.0.0", "file-loader": "^6.0.0", - "sass": "^1.49.9", - "sass-loader": "^13.0.2", + "sass": "^1.55.0", + "sass-loader": "^13.1.0", "stylelint": "^14.0.0", "stylelint-config-recommended-scss": "^7.0.0", "stylelint-scss": "^4.0.0", @@ -55,7 +57,7 @@ "vue-loader": "^15", "vue-style-loader": "^4.1.3", "vue-template-compiler": "^2.7.13", - "webpack": "^5.0.0", + "webpack": "^5.74.0", "webpack-cli": "^4.0.0", "webpack-merge": "^4.2.2", "webpack-node-externals": "^1.7.2" diff --git a/src/admin.js b/src/admin.js index 66fb71d..d4b9bab 100644 --- a/src/admin.js +++ b/src/admin.js @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +import 'regenerator-runtime/runtime' +import './css/admin.scss' import AdminCategoriesCustom from './AdminCategoriesCustom.vue' import Vue from 'vue' diff --git a/src/SideMenu.js b/src/menu.js similarity index 87% rename from src/SideMenu.js rename to src/menu.js index e7b3675..4267bbe 100644 --- a/src/SideMenu.js +++ b/src/menu.js @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +import 'regenerator-runtime/runtime' +import './css/menu.scss' import Vue from 'vue' import AppMenu from './AppMenu.vue' import SideMenu from './SideMenu.vue' @@ -23,11 +25,15 @@ import SideMenuWithCategories from './SideMenuWithCategories.vue' import PageLoader from './PageLoader' import SMcreateElement from './lib/createElement' -Vue.prototype.OC = OC -Vue.prototype.t = OC.L10N.translate +setInterval(() => { + console.log(window.OC) +}, 100) -window.SMcreateElement = SMcreateElement -window.PageLoader = PageLoader +// Vue.prototype.OC = window.OC +// Vue.prototype.t = OC.L10N.translate +// +// window.SMcreateElement = SMcreateElement +// window.PageLoader = PageLoader const mountSideMenuComponent = () => { const container = document.querySelector('#side-menu') diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..36fbaf5 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,34 @@ +const Encore = require('@symfony/webpack-encore'); + +// Manually configure the runtime environment if not already configured yet by the "encore" command. +// It's useful when you use tools that rely on webpack.config.js file. +if (!Encore.isRuntimeEnvironmentConfigured()) { + Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); +} + +Encore + .setOutputPath('assets/') + .setPublicPath('./') + .addEntry('admin', './src/admin.js') + .addEntry('menu', './src/menu.js') + .setManifestKeyPrefix('./') + .enableSingleRuntimeChunk() + .cleanupOutputBeforeBuild() + .enableVueLoader() + .enableSourceMaps(!Encore.isProduction()) + .enableVersioning(Encore.isProduction()) + .configureBabel((config) => { + config.plugins.push('@babel/plugin-proposal-class-properties'); + }) + .configureBabelPresetEnv((config) => { + config.useBuiltIns = 'usage'; + config.corejs = 3; + }) + .copyFiles({ + from: './img', + to: 'images/[path][name].[hash:8].[ext]' + }) + .enableSassLoader() +; + +module.exports = Encore.getWebpackConfig(); diff --git a/webpack.js b/webpack.js deleted file mode 100644 index 6e3eac8..0000000 --- a/webpack.js +++ /dev/null @@ -1,54 +0,0 @@ -const path = require('path') -const { VueLoaderPlugin } = require('vue-loader') -const StyleLintPlugin = require('stylelint-webpack-plugin') - -module.exports = { - devtool: "source-map", - entry: { - 'admin': path.join(__dirname, 'src', 'admin.js'), - 'sideMenu': path.join(__dirname, 'src', 'SideMenu.js'), - }, - output: { - path: path.resolve(__dirname, './js'), - publicPath: '/js', - filename: '[name].js?v=[hash]', - chunkFilename: 'chunks/[name]-[hash].js', - }, - module: { - rules: [ - { - test: /\.css$/, - use: ['vue-style-loader', 'css-loader'], - }, - { - test: /\.scss$/, - use: ['vue-style-loader', 'css-loader', 'sass-loader'], - }, - { - test: /\.vue$/, - loader: 'vue-loader', - }, - { - test: /\.js$/, - loader: 'babel-loader', - exclude: /node_modules/, - }, - { - test: /\.(png|jpg|gif|svg)$/, - loader: 'url-loader', - options: { - name: '[name].[ext]?[hash]', - limit: 8192, - }, - }, - ], - }, - plugins: [ - new VueLoaderPlugin(), - new StyleLintPlugin(), - ], - resolve: { - extensions: ['*', '.js', '.vue'], - symlinks: false, - }, -} From 38db493ac5ded7a4e86024c82ecb664142f5e18c Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 30 Oct 2022 14:18:35 +0100 Subject: [PATCH 002/383] remove unused trim package --- src/SideMenu.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SideMenu.vue b/src/SideMenu.vue index ee9d477..c52ac1f 100644 --- a/src/SideMenu.vue +++ b/src/SideMenu.vue @@ -53,7 +53,6 @@ along with this program. If not, see . From 66e4d2989a8a9088967693cecbdb0ea2c4d03825 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 23 Mar 2023 22:22:36 +0100 Subject: [PATCH 125/383] update pipeline conditions allowing fix/* --- .woodpecker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 59a771b..1c02aa5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,7 +6,7 @@ pipeline: - npm i when: event: [tag, push, pull_request] - branch: [master, develop, feature/*, translations] + branch: [master, develop, feature/*, fix/*, translations] osv_detector: image: gitnet.fr/deblan/osv-detector:v0.10 @@ -19,7 +19,7 @@ pipeline: commands: - npm run build when: - branch: [master, develop, feature/*, translations] + branch: [master, develop, feature/*, fix/*, translations] event: [tag, push, pull_request] build_php: @@ -27,7 +27,7 @@ pipeline: commands: - php bin/generate_l10n.php when: - branch: [master, develop, feature/*, translations] + branch: [master, develop, feature/*, fix/*, translations] event: [tag, push, pull_request] code_quality: From 7ab2816bd9502108d89a2f6154e49dc98a93e165 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 27 Mar 2023 18:34:50 +0200 Subject: [PATCH 126/383] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42089a2..6a44bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## [Unreleased] +## 3.7.2 +### Added +* update pipeline conditions allowing `fix/*` +### Fixed +* fix #233: load configuration and then retrieve apps in default side menu display + ## 3.7.1 ### Fixed * fix build process (#230) From b65c0c650a54d6b4cc8cc625b22f438f99a31197 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 27 Mar 2023 18:35:59 +0200 Subject: [PATCH 127/383] update app version --- appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index d14d467..8614a98 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -32,7 +32,7 @@ Notice Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**. In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/). ]]> - 3.7.1 + 3.7.2 agpl Simon Vieille SideMenu From 917288eb54a9d81cac7588aafa3a9a48e50d7f04 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 31 Mar 2023 14:07:19 +0200 Subject: [PATCH 128/383] add signature generation rename steps --- .woodpecker.yml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1c02aa5..9c24f2b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -8,13 +8,13 @@ pipeline: event: [tag, push, pull_request] branch: [master, develop, feature/*, fix/*, translations] - osv_detector: + osv-detector: image: gitnet.fr/deblan/osv-detector:v0.10 commands: - osv-detector package-lock.json failure: ignore - build_js: + build-js: image: node:16 commands: - npm run build @@ -22,7 +22,7 @@ pipeline: branch: [master, develop, feature/*, fix/*, translations] event: [tag, push, pull_request] - build_php: + build-translations: image: deblan/php:8.0 commands: - php bin/generate_l10n.php @@ -30,7 +30,24 @@ pipeline: branch: [master, develop, feature/*, fix/*, translations] event: [tag, push, pull_request] - code_quality: + create-signature: + image: nextcloud:25 + secrets: [app_certificate, app_public_certificate] + environment: + SQLITE_DATABASE: /var/www/data/data.db + NEXTCLOUD_ADMIN_USER: admin + NEXTCLOUD_ADMIN_PASSWORD: admin + commands: + - echo "$APP_CERTIFICATE" > "/tmp/side_menu.key" + - echo "$APP_PUBLIC_CERTIFICATE" > "/tmp/side_menu.crt" + - /usr/src/nextcloud/occ integrity:sign-app + --privateKey=/tmp/side_menu.key + --certificate=/tmp/side_menu.crt + --path=$CI_WORKSPACE + when: + event: [tag] + + check-code-quality: image: sonarsource/sonar-scanner-cli secrets: [sonar_token, sonar_host, sonar_project] commands: @@ -45,7 +62,7 @@ pipeline: when: event: [pull_request] - package: + create-package: image: deblan/php:8.0 volumes: - /var/www/html/artifacts:/var/www/html/artifacts @@ -61,7 +78,7 @@ pipeline: when: event: [tag] - release: + push-release: image: plugins/gitea-release volumes: - /var/www/html/artifacts:/var/www/html/artifacts From 361badff6b0f7756917d5c2b660bca578bbd3b5a Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 31 Mar 2023 17:06:30 +0200 Subject: [PATCH 129/383] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a44bf0..6992410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## [Unreleased] +### Added +* add signature on build + ## 3.7.2 ### Added * update pipeline conditions allowing `fix/*` From dca727c120e94869995ada878aba307a1bd0d2d7 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 14 Apr 2023 20:58:56 +0200 Subject: [PATCH 130/383] use app href for redirection (fix #244) --- lib/Controller/AppController.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/Controller/AppController.php b/lib/Controller/AppController.php index 83a0e8c..5516090 100644 --- a/lib/Controller/AppController.php +++ b/lib/Controller/AppController.php @@ -78,29 +78,33 @@ class AppController extends Controller continue; } - return $this->redirectToApp($app['id']); + return $this->redirectToApp($app, true); } return $this->redirectToApp('files'); } - protected function redirectToApp($appId): RedirectResponse + protected function redirectToApp($app, bool $isHref = false): RedirectResponse { - $isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue( - 'htaccess.IgnoreFrontController', - false - ); + if (!$isHref) { + $isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue( + 'htaccess.IgnoreFrontController', + false + ); - $isFrontControllerActive = 'true' === getenv('front_controller_active'); + $isFrontControllerActive = 'true' === getenv('front_controller_active'); - if ($isIgnoreFrontController || $isFrontControllerActive) { - $path = '/apps/%s/'; + if ($isIgnoreFrontController || $isFrontControllerActive) { + $path = '/apps/%s/'; + } else { + $path = '/index.php/apps/%s/'; + } + + $url = $this->urlGenerator->getAbsoluteURL(sprintf($path, $app)); } else { - $path = '/index.php/apps/%s/'; + $url = $app['href']; } - $url = $this->urlGenerator->getAbsoluteURL(sprintf($path, $appId)); - return new RedirectResponse($url); } } From b9264d7e0511f61809d783edbb382adcd239db4e Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 14 Apr 2023 21:12:35 +0200 Subject: [PATCH 131/383] release v3.7.3 --- CHANGELOG.md | 3 +++ appinfo/info.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6992410..0b84da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## [Unreleased] +## 3.7.3 +### Fixed +* fix #244: use app href for redirection ### Added * add signature on build diff --git a/appinfo/info.xml b/appinfo/info.xml index 8614a98..b24bd58 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -32,7 +32,7 @@ Notice Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**. In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/). ]]> - 3.7.2 + 3.7.3 agpl Simon Vieille SideMenu From 0a556670b1a5a91ae38ec20c475916c2e93e43d5 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 16 Apr 2023 14:16:18 +0200 Subject: [PATCH 132/383] update signature generation --- .woodpecker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 9c24f2b..a598a0f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -40,10 +40,13 @@ pipeline: commands: - echo "$APP_CERTIFICATE" > "/tmp/side_menu.key" - echo "$APP_PUBLIC_CERTIFICATE" > "/tmp/side_menu.crt" + - mkdir /tmp/app + - cp -r README.md CHANGELOG.md appinfo css lib img l10n js src templates screenshots vendor /tmp/app - /usr/src/nextcloud/occ integrity:sign-app --privateKey=/tmp/side_menu.key --certificate=/tmp/side_menu.crt - --path=$CI_WORKSPACE + --path=/tmp/app + - mv /tmp/app/appinfo/signature.json appinfo/ when: event: [tag] From 6583883e2d7e89e83f7805372422df36bfe5c0f5 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 16 Apr 2023 14:17:09 +0200 Subject: [PATCH 133/383] update signature generation --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a598a0f..bca4ef8 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -47,8 +47,8 @@ pipeline: --certificate=/tmp/side_menu.crt --path=/tmp/app - mv /tmp/app/appinfo/signature.json appinfo/ - when: - event: [tag] + # when: + # event: [tag] check-code-quality: image: sonarsource/sonar-scanner-cli From 27f8888a904bd9b8c598c4995a28c0b933561cb3 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 16 Apr 2023 14:24:17 +0200 Subject: [PATCH 134/383] update signature generation --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index bca4ef8..a598a0f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -47,8 +47,8 @@ pipeline: --certificate=/tmp/side_menu.crt --path=/tmp/app - mv /tmp/app/appinfo/signature.json appinfo/ - # when: - # event: [tag] + when: + event: [tag] check-code-quality: image: sonarsource/sonar-scanner-cli From 135f27cc32a1aec15021f87b5ec3477bd1351cdd Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 16 Apr 2023 18:05:25 +0200 Subject: [PATCH 135/383] release v3.7.4 --- CHANGELOG.md | 4 ++++ appinfo/info.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b84da9..c9a1b79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [Unreleased] +## 3.7.4 +### Fixed +* fix Integrity failed (#247) + ## 3.7.3 ### Fixed * fix #244: use app href for redirection diff --git a/appinfo/info.xml b/appinfo/info.xml index b24bd58..f9933b4 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -32,7 +32,7 @@ Notice Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**. In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/). ]]> - 3.7.3 + 3.7.4 agpl Simon Vieille SideMenu From 93fef370338c0f28620c0a5d12ea7a5f24344306 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 23 May 2023 14:09:55 +0200 Subject: [PATCH 136/383] add option to show hovered label only on top menu --- lib/Controller/JsController.php | 2 +- src/AppMenu.vue | 29 ++++++++++++++++++++++------- src/l10n/fixtures/cs.yaml | 1 + src/l10n/fixtures/de.yaml | 1 + src/l10n/fixtures/es.yaml | 1 + src/l10n/fixtures/fr.yaml | 1 + src/l10n/fixtures/nl.yaml | 1 + src/l10n/fixtures/ru.yaml | 1 + src/l10n/fixtures/tpl/base.yaml | 1 + src/l10n/fixtures/zh_CN.yaml | 1 + templates/settings/admin-form.php | 2 +- 11 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/Controller/JsController.php b/lib/Controller/JsController.php index 3abcdba..13d803e 100644 --- a/lib/Controller/JsController.php +++ b/lib/Controller/JsController.php @@ -171,7 +171,7 @@ class JsController extends Controller 'avatar' => $avatar, 'top-menu-apps' => $topMenuApps, 'top-side-menu-apps' => $topSideMenuApps, - 'top-menu-mouse-over-hidden-label' => $this->config->getAppValueBool( + 'top-menu-mouse-over-hidden-label' => $this->config->getAppValueInt( 'top-menu-mouse-over-hidden-label', '0' ), diff --git a/src/AppMenu.vue b/src/AppMenu.vue index 0e550d7..52a9810 100644 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -24,14 +24,14 @@