diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 9e39697a38799..a4b5255e3257a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -166,6 +166,7 @@ The development container provides several convenience features for development: * Pay attention to the IONOS-specific scripts and configurations when working on related features. * Use the `IONOS/configure.sh` script for most configuration tasks rather than manual OCC commands. * Before committing any changes, make sure to run the relevant tests and linters. +* **Recurring Tasks Documentation:** For common development tasks (e.g., delegating settings to admin, adding apps, etc.), check `..//docs/recurring-tasks/` for step-by-step guides. ## Code Organization & Structure diff --git a/.github/workflows/build-artifact.yml b/.github/workflows/build-artifact.yml index ae9148c3ffc06..f2f0d2a36dd77 100644 --- a/.github/workflows/build-artifact.yml +++ b/.github/workflows/build-artifact.yml @@ -478,7 +478,6 @@ jobs: fetch-depth: 1 - name: Setup JFrog CLI - if: needs.prepare-matrix.outputs.has_apps_to_restore == 'true' uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.4.1 env: JF_URL: ${{ secrets.JF_ARTIFACTORY_URL }} @@ -490,29 +489,111 @@ jobs: # Ping the server jf rt ping - - name: Restore cached apps - if: needs.prepare-matrix.outputs.has_apps_to_restore == 'true' + - name: Restore all apps from cache and JFrog run: | - set -e + set -euo pipefail + + # Restore apps that are in cache (from apps_to_restore) + if [ "${{ needs.prepare-matrix.outputs.has_apps_to_restore }}" == "true" ]; then + echo "📦 Restoring cached apps..." + APPS_TO_RESTORE='${{ needs.prepare-matrix.outputs.apps_to_restore }}' + + # Process each app in the restore list + echo "$APPS_TO_RESTORE" | jq -c '.[]' | while read -r app_json; do + APP_NAME=$(echo "$app_json" | jq -r '.name') + APP_SHA=$(echo "$app_json" | jq -r '.sha') + APP_PATH=$(echo "$app_json" | jq -r '.path') + SOURCE=$(echo "$app_json" | jq -r '.source') + + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "Restoring: $APP_NAME (source: $SOURCE)" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + + if [ "$SOURCE" == "jfrog" ]; then + # Restore from JFrog + JFROG_PATH=$(echo "$app_json" | jq -r '.jfrog_path') + ARCHIVE_NAME="${APP_NAME}-${APP_SHA}.tar.gz" + + echo "📥 Downloading from JFrog: $JFROG_PATH" + + if jf rt download "$JFROG_PATH" "$ARCHIVE_NAME" --flat=true; then + echo "✅ Downloaded successfully" + echo "Extracting to $APP_PATH..." + mkdir -p "$(dirname "$APP_PATH")" + tar -xzf "$ARCHIVE_NAME" -C "$(dirname "$APP_PATH")" + + if [ -d "$APP_PATH" ] && [ -f "$APP_PATH/appinfo/info.xml" ]; then + echo "✅ Restored $APP_NAME from JFrog" + else + echo "❌ Failed to extract or validate $APP_NAME" + exit 1 + fi + + rm -f "$ARCHIVE_NAME" + else + echo "❌ Failed to download from JFrog" + exit 1 + fi - echo "📦 Restoring cached apps..." - APPS_TO_RESTORE='${{ needs.prepare-matrix.outputs.apps_to_restore }}' + elif [ "$SOURCE" == "github-cache" ]; then + # Restore from GitHub cache + CACHE_KEY=$(echo "$app_json" | jq -r '.cache_key') - # Process each app in the restore list - echo "$APPS_TO_RESTORE" | jq -c '.[]' | while read -r app_json; do - APP_NAME=$(echo "$app_json" | jq -r '.name') - APP_SHA=$(echo "$app_json" | jq -r '.sha') - APP_PATH=$(echo "$app_json" | jq -r '.path') - SOURCE=$(echo "$app_json" | jq -r '.source') + echo "💾 Restoring from GitHub cache: $CACHE_KEY" + + # Use actions/cache/restore in a way that works in a script context + # We need to use gh CLI to restore the cache + if gh cache restore "$CACHE_KEY" --key "$CACHE_KEY"; then + echo "✅ Restored $APP_NAME from GitHub cache" + + # Validate restoration + if [ ! -d "$APP_PATH" ] || [ ! -f "$APP_PATH/appinfo/info.xml" ]; then + echo "❌ Validation failed for $APP_NAME" + exit 1 + fi + else + echo "❌ Failed to restore from GitHub cache" + exit 1 + fi + else + echo "❌ Unknown source: $SOURCE" + exit 1 + fi + done echo "" - echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - echo "Restoring: $APP_NAME (source: $SOURCE)" - echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "✅ All cached apps restored successfully" + fi + + # Also restore newly built apps from JFrog (from apps_to_build) + if [ "${{ needs.prepare-matrix.outputs.has_apps_to_build }}" == "true" ]; then + echo "" + echo "📦 Restoring newly built apps from JFrog..." + APPS_TO_BUILD='${{ needs.prepare-matrix.outputs.apps_to_build }}' + FULL_MATRIX='${{ needs.prepare-matrix.outputs.external_apps_matrix }}' + EFFECTIVE_CACHE_VERSION="${{ needs.prepare-matrix.outputs.effective_cache_version }}" + + # Process each app in the build list + echo "$APPS_TO_BUILD" | jq -c '.[]' | while read -r app_json; do + APP_NAME=$(echo "$app_json" | jq -r '.name') + APP_SHA=$(echo "$app_json" | jq -r '.sha') + + # Get app path from full matrix + APP_PATH=$(echo "$FULL_MATRIX" | jq -r --arg name "$APP_NAME" '.[] | select(.name == $name) | .path') - if [ "$SOURCE" == "jfrog" ]; then - # Restore from JFrog - JFROG_PATH=$(echo "$app_json" | jq -r '.jfrog_path') + if [ -z "$APP_PATH" ] || [ "$APP_PATH" == "null" ]; then + echo "❌ Could not find path for $APP_NAME in matrix" + exit 1 + fi + + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "Restoring newly built: $APP_NAME" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + + # Construct JFrog path matching what build-external-apps uploaded + JFROG_PATH="${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }}/apps/${EFFECTIVE_CACHE_VERSION}/${APP_NAME}/${APP_NAME}-${APP_SHA}.tar.gz" ARCHIVE_NAME="${APP_NAME}-${APP_SHA}.tar.gz" echo "📥 Downloading from JFrog: $JFROG_PATH" @@ -535,88 +616,19 @@ jobs: echo "❌ Failed to download from JFrog" exit 1 fi + done - elif [ "$SOURCE" == "github-cache" ]; then - # Restore from GitHub cache - CACHE_KEY=$(echo "$app_json" | jq -r '.cache_key') - - echo "💾 Restoring from GitHub cache: $CACHE_KEY" - - # Use actions/cache/restore in a way that works in a script context - # We need to use gh CLI to restore the cache - if gh cache restore "$CACHE_KEY" --key "$CACHE_KEY"; then - echo "✅ Restored $APP_NAME from GitHub cache" - - # Validate restoration - if [ ! -d "$APP_PATH" ] || [ ! -f "$APP_PATH/appinfo/info.xml" ]; then - echo "❌ Validation failed for $APP_NAME" - exit 1 - fi - else - echo "❌ Failed to restore from GitHub cache" - exit 1 - fi - else - echo "❌ Unknown source: $SOURCE" - exit 1 - fi - done + echo "" + echo "✅ All newly built apps restored from JFrog successfully" + fi echo "" - echo "✅ All cached apps restored successfully" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "✅ All apps restored successfully" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" env: GH_TOKEN: ${{ github.token }} - - name: Download build external apps - uses: actions/download-artifact@v5 - with: - pattern: external-app-build-* - path: apps-external/ - - - name: Reorganize downloaded apps-external artifacts - run: | - cd apps-external/ - - echo "Initial structure:" - ls -la - - # Move contents from external-app-build-* directories to their target directories - for artifact_dir in external-app-build-*; do - if [ -d "$artifact_dir" ]; then - # Extract app name from artifact directory name - app_name=${artifact_dir#external-app-build-} - - echo "Processing artifact: $artifact_dir -> $app_name" - - # If target directory exists, merge the contents from the artifact directory containing build artifacts - if [ -d "$app_name" ]; then - echo "Target directory $app_name exists, merging contents from $artifact_dir" - # Copy contents from artifact directory to target directory - cp -r "$artifact_dir"/* "$app_name"/ - # Remove the now-empty artifact directory - rm -rf "$artifact_dir" - else - # Move the artifact directory to the proper app name - echo "Moving $artifact_dir to $app_name" - mv "$artifact_dir" "$app_name" - fi - fi - done - - echo "Reorganization complete. Final structure:" - ls -la - - - name: Verify downloaded artifacts structure - run: | - echo "External apps structure:" - ls -la apps-external/ - for app_dir in apps-external/*/; do - if [ -d "$app_dir" ]; then - echo "Contents of $app_dir:" - ls -la "$app_dir" - fi - done - - name: Set up node with version from package.json's engines uses: actions/setup-node@v6 with: @@ -698,10 +710,10 @@ jobs: upload-to-artifactory: runs-on: self-hosted - # Upload the artifact to the Artifactory repository on PR *OR* on "ionos-dev|ionos-stable|rc/*" branch push defined in the on:push:branches + # Upload the artifact to the Artifactory repository on PR *OR* on "ionos-dev|ionos-stable|rc/*" branch push defined in the on:push:branches *OR* on manual workflow_dispatch if: | always() && - (github.event_name == 'pull_request' || github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable' || startsWith(github.ref_name, 'rc/')) && + (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable' || startsWith(github.ref_name, 'rc/')) && needs.prepare-matrix.result == 'success' && (needs.build-external-apps.result == 'success' || needs.build-external-apps.result == 'skipped') && needs.build-artifact.result == 'success' diff --git a/.gitmodules b/.gitmodules index a7c0d60e7e858..a612546b88da1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -24,7 +24,7 @@ url = git@github.com:nextcloud/notify_push.git [submodule "apps-external/activity"] path = apps-external/activity - url = git@github.com:nextcloud/activity.git + url = git@github.com:IONOS-Productivity/nc-activity.git [submodule "apps-external/tasks"] path = apps-external/tasks url = git@github.com:nextcloud/tasks.git @@ -81,7 +81,7 @@ url = git@github.com:IONOS-Productivity/nc-notifications.git [submodule "apps-external/user_oidc"] path = apps-external/user_oidc - url = git@github.com:nextcloud/user_oidc.git + url = git@github.com:IONOS-Productivity/nc-user_oidc.git [submodule "apps-external/end_to_end_encryption"] path = apps-external/end_to_end_encryption url = git@github.com:nextcloud/end_to_end_encryption.git @@ -91,3 +91,9 @@ [submodule "apps-external/ncw_tools"] path = apps-external/ncw_tools url = git@github.com:IONOS-Productivity/ncw-tools.git +[submodule "apps-external/files_pdfviewer"] + path = apps-external/files_pdfviewer + url = git@github.com:nextcloud/files_pdfviewer.git +[submodule "apps-external/bruteforcesettings"] + path = apps-external/bruteforcesettings + url = git@github.com:IONOS-Productivity/nc-bruteforcesettings.git diff --git a/IONOS b/IONOS index 66c2a3ad8087a..7d2d1bb7bbfee 160000 --- a/IONOS +++ b/IONOS @@ -1 +1 @@ -Subproject commit 66c2a3ad8087a35b4f276990bd53aa66c948c969 +Subproject commit 7d2d1bb7bbfee8e7fd0e3443a18bf4c303d53095 diff --git a/apps-external/activity b/apps-external/activity index d5a969a1c52a7..ca3cd2e5e5883 160000 --- a/apps-external/activity +++ b/apps-external/activity @@ -1 +1 @@ -Subproject commit d5a969a1c52a7fbc42431df0949f383933419576 +Subproject commit ca3cd2e5e58839d62e5ec3e6afbac0b58d52f8a0 diff --git a/apps-external/bruteforcesettings b/apps-external/bruteforcesettings new file mode 160000 index 0000000000000..423a1065c682b --- /dev/null +++ b/apps-external/bruteforcesettings @@ -0,0 +1 @@ +Subproject commit 423a1065c682be3cb065bdc91c78353fee36c798 diff --git a/apps-external/files_pdfviewer b/apps-external/files_pdfviewer new file mode 160000 index 0000000000000..21125af4ab4a8 --- /dev/null +++ b/apps-external/files_pdfviewer @@ -0,0 +1 @@ +Subproject commit 21125af4ab4a8c2f9784fc4cd66cdae85a41ed4e diff --git a/apps-external/user_oidc b/apps-external/user_oidc index 192826636cc8b..085f98727f738 160000 --- a/apps-external/user_oidc +++ b/apps-external/user_oidc @@ -1 +1 @@ -Subproject commit 192826636cc8b25acfb43a56617db0758869f808 +Subproject commit 085f98727f73886e3144cf0b65e6580aebd17d87 diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index d76408010da79..370ff883a769f 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -35,7 +35,6 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; use OCP\Http\Client\IClientService; -use OCP\IAppConfig; use OCP\IConfig; use OCP\IGroup; use OCP\IL10N; @@ -75,7 +74,6 @@ public function __construct( private IInitialState $initialState, private AppDiscoverFetcher $discoverFetcher, private IClientService $clientService, - private IAppConfig $appConfig, ) { parent::__construct($appName, $request); $this->appData = $appDataFactory->get('appstore'); @@ -92,12 +90,6 @@ public function viewApps(): TemplateResponse { $this->initialState->provideInitialState('appstoreEnabled', $this->config->getSystemValueBool('appstoreenabled', true)); $this->initialState->provideInitialState('appstoreBundles', $this->getBundles()); - - // Conditionally set developer docs link based on configuration - $displayDocumentationLink = $this->appConfig->getValueBool('settings', 'display_documentation_link', true); - $developerDocsUrl = $displayDocumentationLink ? $this->urlGenerator->linkToDocs('developer-manual') : ''; - $this->initialState->provideInitialState('appstoreDeveloperDocs', $developerDocsUrl); - $this->initialState->provideInitialState('appstoreUpdateCount', count($this->getAppsWithUpdates())); if ($this->appManager->isInstalled('app_api')) { diff --git a/apps/settings/lib/Settings/Personal/ServerDevNotice.php b/apps/settings/lib/Settings/Personal/ServerDevNotice.php index 71c83740b9291..916d69e97d1da 100644 --- a/apps/settings/lib/Settings/Personal/ServerDevNotice.php +++ b/apps/settings/lib/Settings/Personal/ServerDevNotice.php @@ -15,6 +15,7 @@ use OCP\Settings\ISettings; use OCP\Support\Subscription\IRegistry; use OCP\Util; +use OCP\IConfig; class ServerDevNotice implements ISettings { @@ -25,6 +26,7 @@ public function __construct( private IUserSession $userSession, private IInitialState $initialState, private IURLGenerator $urlGenerator, + private IConfig $config, ) { } @@ -62,6 +64,10 @@ public function getSection(): ?string { return null; } + if ($this->config->getSystemValueBool('settings.hide-dev-notice')) { + return null; + } + return 'personal-info'; } diff --git a/apps/settings/src/views/AppStoreNavigation.vue b/apps/settings/src/views/AppStoreNavigation.vue index 3507006c47d5b..4d8a2b3e48ce1 100644 --- a/apps/settings/src/views/AppStoreNavigation.vue +++ b/apps/settings/src/views/AppStoreNavigation.vue @@ -91,10 +91,6 @@ - @@ -116,7 +112,6 @@ import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js' import APPSTORE_CATEGORY_ICONS from '../constants/AppstoreCategoryIcons.ts' const appstoreEnabled = loadState('settings', 'appstoreEnabled', true) -const developerDocsUrl = loadState('settings', 'appstoreDeveloperDocs', '') const store = useAppsStore() const categories = computed(() => store.categories) diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index 3c0df4532d79f..f72bd45a3d234 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -19,7 +19,6 @@ use OCP\AppFramework\Services\IInitialState; use OCP\Files\AppData\IAppDataFactory; use OCP\Http\Client\IClientService; -use OCP\IAppConfig; use OCP\IConfig; use OCP\IL10N; use OCP\INavigationManager; @@ -46,8 +45,6 @@ class AppSettingsControllerTest extends TestCase { private $l10n; /** @var IConfig|MockObject */ private $config; - /** @var IAppConfig|MockObject */ - private $appConfig; /** @var INavigationManager|MockObject */ private $navigationManager; private AppManager&MockObject $appManager; @@ -84,7 +81,6 @@ protected function setUp(): void { ->method('t') ->willReturnArgument(0); $this->config = $this->createMock(IConfig::class); - $this->appConfig = $this->createMock(IAppConfig::class); $this->navigationManager = $this->createMock(INavigationManager::class); $this->appManager = $this->createMock(AppManager::class); $this->categoryFetcher = $this->createMock(CategoryFetcher::class); @@ -116,7 +112,6 @@ protected function setUp(): void { $this->initialState, $this->discoverFetcher, $this->clientService, - $this->appConfig, ); } @@ -185,31 +180,14 @@ public function testViewApps(): void { ->method('getSystemValueBool') ->with('appstoreenabled', true) ->willReturn(true); - $this->appConfig - ->expects($this->once()) - ->method('getValueBool') - ->with('settings', 'display_documentation_link', true) - ->willReturn(true); $this->navigationManager ->expects($this->once()) ->method('setActiveEntry') ->with('core_apps'); - // Test that developer docs link is generated correctly - $this->urlGenerator - ->expects($this->once()) - ->method('linkToDocs') - ->with('developer-manual') - ->willReturn('https://docs.nextcloud.com/server/latest/developer_manual/'); - $this->initialState ->expects($this->exactly(4)) - ->method('provideInitialState') - ->willReturnCallback(function ($key, $value) { - if ($key === 'appstoreDeveloperDocs') { - $this->assertEquals('https://docs.nextcloud.com/server/latest/developer_manual/', $value); - } - }); + ->method('provideInitialState'); $policy = new ContentSecurityPolicy(); $policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com'); @@ -235,31 +213,14 @@ public function testViewAppsAppstoreNotEnabled(): void { ->method('getSystemValueBool') ->with('appstoreenabled', true) ->willReturn(false); - $this->appConfig - ->expects($this->once()) - ->method('getValueBool') - ->with('settings', 'display_documentation_link', true) - ->willReturn(true); $this->navigationManager ->expects($this->once()) ->method('setActiveEntry') ->with('core_apps'); - // Test that developer docs link is still generated even when appstore is disabled - $this->urlGenerator - ->expects($this->once()) - ->method('linkToDocs') - ->with('developer-manual') - ->willReturn('https://docs.nextcloud.com/server/latest/developer_manual/'); - $this->initialState ->expects($this->exactly(4)) - ->method('provideInitialState') - ->willReturnCallback(function ($key, $value) { - if ($key === 'appstoreDeveloperDocs') { - $this->assertEquals('https://docs.nextcloud.com/server/latest/developer_manual/', $value); - } - }); + ->method('provideInitialState'); $policy = new ContentSecurityPolicy(); $policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com'); @@ -274,88 +235,4 @@ public function testViewAppsAppstoreNotEnabled(): void { $this->assertEquals($expected, $this->appSettingsController->viewApps()); } - - public function testDeveloperDocumentationLinkHiddenWhenConfigured(): void { - $this->installer->expects($this->any()) - ->method('isUpdateAvailable') - ->willReturn(false); - $this->bundleFetcher->expects($this->once())->method('getBundles')->willReturn([]); - $this->config - ->expects($this->once()) - ->method('getSystemValueBool') - ->with('appstoreenabled', true) - ->willReturn(true); - $this->appConfig - ->expects($this->once()) - ->method('getValueBool') - ->with('settings', 'display_documentation_link', true) - ->willReturn(false); - $this->navigationManager - ->expects($this->once()) - ->method('setActiveEntry') - ->with('core_apps'); - - // When display_documentation_link is false, linkToDocs should not be called - $this->urlGenerator - ->expects($this->never()) - ->method('linkToDocs'); - - $providedStates = []; - $this->initialState - ->expects($this->exactly(4)) - ->method('provideInitialState') - ->willReturnCallback(function ($key, $value) use (&$providedStates) { - $providedStates[$key] = $value; - }); - - $this->appSettingsController->viewApps(); - - // Assert that the developer docs state was provided with an empty string - $this->assertArrayHasKey('appstoreDeveloperDocs', $providedStates); - $this->assertEquals('', $providedStates['appstoreDeveloperDocs']); - } - - public function testDeveloperDocumentationLinkShownByDefault(): void { - $this->installer->expects($this->any()) - ->method('isUpdateAvailable') - ->willReturn(false); - $this->bundleFetcher->expects($this->once())->method('getBundles')->willReturn([]); - $this->config - ->expects($this->once()) - ->method('getSystemValueBool') - ->with('appstoreenabled', true) - ->willReturn(true); - $this->appConfig - ->expects($this->once()) - ->method('getValueBool') - ->with('settings', 'display_documentation_link', true) - ->willReturn(true); - $this->navigationManager - ->expects($this->once()) - ->method('setActiveEntry') - ->with('core_apps'); - - $developerDocsUrl = 'https://docs.nextcloud.com/server/latest/developer_manual/'; - - // When display_documentation_link is true (default), linkToDocs should be called - $this->urlGenerator - ->expects($this->once()) - ->method('linkToDocs') - ->with('developer-manual') - ->willReturn($developerDocsUrl); - - $providedStates = []; - $this->initialState - ->expects($this->exactly(4)) - ->method('provideInitialState') - ->willReturnCallback(function ($key, $value) use (&$providedStates) { - $providedStates[$key] = $value; - }); - - $this->appSettingsController->viewApps(); - - // Assert that the developer docs state was provided with the correct URL - $this->assertArrayHasKey('appstoreDeveloperDocs', $providedStates); - $this->assertEquals($developerDocsUrl, $providedStates['appstoreDeveloperDocs']); - } }