diff --git a/.github/assets/Github Banner.png b/.github/assets/Github Banner.png new file mode 100644 index 0000000000..aedade011a Binary files /dev/null and b/.github/assets/Github Banner.png differ diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000000..d9d1ca589b --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,36 @@ +image: + file: ./.gitpod/Dockerfile + +tasks: + - init: ./.gitpod/gitpod-init + command: ./.gitpod/gitpod-cmd + +ports: + - port: 1025 + onOpen: ignore + - port: 3306 + onOpen: ignore + - port: 33060 + onOpen: ignore + - port: 8000 + visibility: public + onOpen: ignore + - port: 8025 + onOpen: ignore + - port: 9003 + onOpen: ignore + +vscode: + extensions: + - felixfbecker.php-debug + - bmewburn.vscode-intelephense-client + +github: + prebuilds: + master: true + branches: false + pullRequests: true + pullRequestsFromForks: false + addCheck: true + addComment: false + addBadge: true diff --git a/.gitpod/Dockerfile b/.gitpod/Dockerfile new file mode 100644 index 0000000000..50d7443ee6 --- /dev/null +++ b/.gitpod/Dockerfile @@ -0,0 +1,71 @@ +FROM gitpod/workspace-mysql + +# Install XDebug extension +RUN sudo apt-get update -q \ + && sudo apt-get install -y \ + php-dev \ + golang-go \ + && sudo pecl install xdebug + +# Install Composer 2 (Gitpod comes pre-installed with Composer 1) - borrowed from official Composer Docker image +ENV COMPOSER_ALLOW_SUPERUSER 1 +ENV COMPOSER_HOME /tmp +ENV COMPOSER_VERSION 2.1.6 + +RUN set -eux; \ + curl \ + --silent \ + --fail \ + --location \ + --retry 3 \ + --output /tmp/keys.dev.pub \ + --url https://raw.githubusercontent.com/composer/composer.github.io/e7f28b7200249f8e5bc912b42837d4598c74153a/snapshots.pub \ + ; \ + php -r " \ + \$signature = '4ac45767e5ec22652f0c1167cbbb8a2b0c708369153e328cad90147dafe50952'; \ + \$hash = hash('sha256', preg_replace('{\s}', '', file_get_contents('/tmp/keys.dev.pub'))); \ + if (!hash_equals(\$signature, \$hash)) { \ + echo 'Integrity check failed, dev public key is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + ; \ + curl \ + --silent \ + --fail \ + --location \ + --retry 3 \ + --output /tmp/keys.tags.pub \ + --url https://raw.githubusercontent.com/composer/composer.github.io/e7f28b7200249f8e5bc912b42837d4598c74153a/releases.pub \ + ; \ + php -r " \ + \$signature = '57815ba27e54dc317ecc7cc5573090d087719ba68f3bb7234e5d42d084a14642'; \ + \$hash = hash('sha256', preg_replace('{\s}', '', file_get_contents('/tmp/keys.tags.pub'))); \ + if (!hash_equals(\$signature, \$hash)) { \ + echo 'Integrity check failed, tags public key is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + ; \ + curl \ + --silent \ + --fail \ + --location \ + --retry 3 \ + --output /tmp/installer.php \ + --url https://raw.githubusercontent.com/composer/getcomposer.org/f24b8f860b95b52167f91bbd3e3a7bcafe043038/web/installer \ + ; \ + php -r " \ + \$signature = '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3'; \ + \$hash = hash('sha384', file_get_contents('/tmp/installer.php')); \ + if (!hash_equals(\$signature, \$hash)) { \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + ; \ + sudo php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION}; \ + composer --ansi --version --no-interaction; \ + composer diagnose; \ + rm -f /tmp/installer.php; \ + sudo find /tmp -type d -exec chmod -v 1777 {} + + +# Configure Xdebug +RUN sudo bash -c "echo -e '\nzend_extension = /usr/lib/php/20190902/xdebug.so\n\n[XDebug]\nxdebug.mode=debug\nxdebug.start_with_request = 1\nxdebug.client_host = 127.0.0.1\n' >> /etc/php/7.4/cli/php.ini" \ No newline at end of file diff --git a/.gitpod/README.md b/.gitpod/README.md new file mode 100644 index 0000000000..183ca41dd3 --- /dev/null +++ b/.gitpod/README.md @@ -0,0 +1,53 @@ +# Winter CMS on Gitpod + +Winter CMS now supports the [Gitpod.io](https://gitpod.io) service to provide near-instant development and testing environments for Winter CMS. + +This service allows you to check out the Winter CMS codebase at any commit, any branch or any pull request and be given a full Visual Studio Code environment that is completely configured and bootstrapped to run Winter CMS immediately. + +Each instance contains the following: + +- Winter CMS with the [DebugBar plugin](https://github.com/wintercms/wn-debugbar-plugin). +- VSCode. +- MySQL 5.7. +- PHP 7.4 with all required extensions. +- PHP Xdebug extension. +- Composer 2. +- [MailHog service](https://github.com/mailhog/MailHog/) for capturing emails. + +To use this service, you will need an account on Gitpod - one can easily be created by using your GitHub login. You will receive 50 hours per month free for use on Gitpod, but can opt to increase your hours (or even get unlimited hours) by [purchasing a higher plan](https://www.gitpod.io/pricing) on Gitpod. + +## Creating a Gitpod instance + +There are several ways to create a Gitpod instance of Winter CMS: + +- Use one of the **Open in Gitpod** button, which will be available in the README of Winter CMS, as well as any pull request submitted to Winter CMS. +- Install the [Gitpod extension](https://www.gitpod.io/docs/browser-extension#browser-extension) for Chrome or Firefox, which provides a **Gitpod** button in GitHub. +- Manually create an instance by copying a GitHub address within the Winter CMS repo, and prefixing the address with `https://gitpod.io/#/` + +The Gitpod instance may take a minute or two to boot up if it has not been pre-built. + +> **Note:** For brevity, Gitpod instances have the initial admin account set to **admin / admin** as the username and password to login. If you intend to share the URL, we recommend you change this password. + +## Accessing the services + +The Gitpod instance is set-up to boot all necessary services and then provides two web-facing services - the Winter CMS install itself, which is run on port 8000, and MailHog, which is run on port 8025. + +You can click the **Ports** section in the status bar of VSCode, which will take you to the available ports, and click on one of these ports to view the actions for the port. The "globe" icon will open up a special URL which will access the service on that port. We automatically load up Winter CMS on boot in a new tab. + +### MySQL + +By default, MySQL only runs locally within the Gitpod instance, and cannot be connected to from the outside. However, you can use the [Gitpod Local Companion](https://www.gitpod.io/blog/local-app) service to tunnel into the running Gitpod instance and access its services on your own computer. + +Install the app for your OS, then run `gitpod-local-companion-[darwin|linux|windows]` to set up the tunneling service. For MySQL, this will make the database available on port 3306 on your computer. + +You can then connect to it using any MySQL management program of your choice. + +## Config files + +By default, the Winter CMS Gitpod instance will use `php artisan winter:env` to create an `.env` file that will contain your config. Because this command rewrites the main config files in the `config` directory, which will appear as changes in Git, we mark these files as "unwatched" in Git so that they are not committed to GitHub. + +If you are editing a pull request that does contain config changes that you wish to include in the PR, you can use the `.gitpod/gitpod-show-config` helper script inside your Gitpod instance to make these files appear in the Git changes. + +## Debugging + +Debugging Winter CMS in Gitpod is super simple - all necessary setup has already been done! You can access the Debugging tab in VSCode and press start on the debugging tool to use breakpoints within your code. Note that Gitpod does impose a time limit on responses from the web server, so you may find that using the debugging will result in timeouts when viewing your Winter CMS instance, however, debugging should still continue without issue. diff --git a/.gitpod/gitpod-cmd b/.gitpod/gitpod-cmd new file mode 100755 index 0000000000..fd285b6e84 --- /dev/null +++ b/.gitpod/gitpod-cmd @@ -0,0 +1,48 @@ +#!/bin/bash + +# Create database +gp await-port 3306 && mysql -e "DROP DATABASE IF EXISTS winter" +mysql -e "CREATE DATABASE winter" + +# Create environment file +php artisan winter:env + +# Hide config file changes from Git +./.gitpod/gitpod-hide-config + +# Exclude Debugbar files from Git +echo -e "plugins/winter/debugbar\nstorage/debugbar" >> ./.git/info/exclude + +# Rewrite configuration +sed -i "s|APP_URL=.*$|APP_URL=${GITPOD_WORKSPACE_URL}|g" .env +sed -i "s|APP_URL=https://|APP_URL=https://8000-|g" .env +sed -i "s|APP_KEY=.*$|APP_KEY=$(cat /dev/urandom | base64 | head -c 32)|g" .env +sed -i "s|DB_CONNECTION=.*$|DB_CONNECTION=mysql|g" .env +sed -i "s|DB_HOST=.*$|DB_HOST=127.0.0.1|g" .env +sed -i "s|DB_PORT=.*$|DB_PORT=3306|g" .env +sed -i "s|DB_DATABASE=.*$|DB_DATABASE=winter|g" .env +sed -i "s|DB_USERNAME=.*$|DB_USERNAME=root|g" .env +sed -i "s|DB_PASSWORD=.*$|DB_PASSWORD=|g" .env +sed -i "s|MAIL_DRIVER=.*$|MAIL_DRIVER=smtp|g" .env +sed -i "s|MAIL_HOST=.*$|MAIL_HOST=127.0.0.1|g" .env +sed -i "s|MAIL_PORT=.*$|MAIL_PORT=1025|g" .env +sed -i "s|MAIL_ENCRYPTION=.*$|MAIL_ENCRYPTION=null|g" .env +sed -i "s|MAIL_USERNAME=.*$|MAIL_USERNAME=null|g" .env +sed -i "s|MAIL_PASSWORD=.*$|MAIL_PASSWORD=null|g" .env +sed -i "s|'trustedProxies' => null|'trustedProxies' => '*'|g" config/app.php + +# Run migrations +php artisan winter:up + +# Set admin password +php artisan winter:passwd admin admin + +# Run Mailhog in background +/workspace/go/bin/MailHog >/dev/null 2>&1 & + +# Serve site +php artisan serve >/dev/null 2>&1 & +gp await-port 8000 && gp preview --external $(gp url 8000) + +# Open README +gp open ./.gitpod/README.md diff --git a/.gitpod/gitpod-hide-config b/.gitpod/gitpod-hide-config new file mode 100755 index 0000000000..60928c054d --- /dev/null +++ b/.gitpod/gitpod-hide-config @@ -0,0 +1,10 @@ +#!/bin/bash + +# Hide config file edits from Git changes +git update-index --skip-worktree config/app.php +git update-index --skip-worktree config/cache.php +git update-index --skip-worktree config/cms.php +git update-index --skip-worktree config/database.php +git update-index --skip-worktree config/mail.php +git update-index --skip-worktree config/queue.php +git update-index --skip-worktree config/session.php diff --git a/.gitpod/gitpod-init b/.gitpod/gitpod-init new file mode 100755 index 0000000000..086705c791 --- /dev/null +++ b/.gitpod/gitpod-init @@ -0,0 +1,15 @@ +#!/bin/bash + +# Install Mailhog +go get github.com/mailhog/MailHog + +# Add Debug Bar plugin +composer require --no-update "winter/wn-debugbar-plugin" "4.0.0" + +# Install Composer dependencies +composer update --no-progress +git reset --hard + +# Setup VSCode config +mkdir -p ./.vscode +cp ./.gitpod/vscode-launch.json ./.vscode/launch.json diff --git a/.gitpod/gitpod-show-config b/.gitpod/gitpod-show-config new file mode 100755 index 0000000000..f7d4d6f88c --- /dev/null +++ b/.gitpod/gitpod-show-config @@ -0,0 +1,10 @@ +#!/bin/bash + +# Hide config file edits from Git changes +git update-index --no-skip-worktree config/app.php +git update-index --no-skip-worktree config/cache.php +git update-index --no-skip-worktree config/cms.php +git update-index --no-skip-worktree config/database.php +git update-index --no-skip-worktree config/mail.php +git update-index --no-skip-worktree config/queue.php +git update-index --no-skip-worktree config/session.php diff --git a/.gitpod/vscode-launch.json b/.gitpod/vscode-launch.json new file mode 100644 index 0000000000..542060d33f --- /dev/null +++ b/.gitpod/vscode-launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003 + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index c04ce35af6..1185b210f3 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,47 @@

- Winter CMS Logo + Winter CMS Logo

-[Winter](https://wintercms.com) is a Content Management System (CMS) and web platform whose sole purpose is to make your development workflow simple again. It was born out of frustration with existing systems. We feel building websites has become a convoluted and confusing process that leaves developers unsatisfied. We want to turn you around to the simpler side and get back to basics. +[Winter](https://wintercms.com) is a free, open-source content management system based on the [Laravel](https://laravel.com) PHP framework. Developers and agencies all around the world rely upon Winter for its quick prototyping and development, safe and secure codebase and dedication to simplicity. -Winter's mission is to show the world that web development is not rocket science. +No matter how large or small your project is, Winter provides a rich development environment, regardless of your level of experience. [![Version](https://img.shields.io/github/v/release/wintercms/winter?sort=semver&style=flat-square)](https://github.com/wintercms/winter/releases) [![Tests](https://img.shields.io/github/workflow/status/wintercms/winter/Tests/develop?label=tests&style=flat-square)](https://github.com/wintercms/winter/actions) [![License](https://img.shields.io/github/license/wintercms/winter?label=open%20source&style=flat-square)](https://packagist.org/packages/wintercms/winter) [![Discord](https://img.shields.io/discord/816852513684193281?label=discord&style=flat-square)](https://discord.gg/D5MFSPH6Ux) +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/wintercms/winter) + ## Installing Winter -Instructions on how to install Winter can be found at the [installation guide](https://wintercms.com/docs/setup/installation). +Winter can be installed in several ways for both new users and experienced developers - see our [Installation page](https://wintercms.com/install) for more information. -### Quick Start Installation +### Quick start with Composer -For advanced users, run this in your terminal to install Winter from command line: +For advanced users, run the following command in your terminal to install Winter via Composer: ```shell composer create-project wintercms/winter example.com "dev-develop" ``` -If you plan on using a database, run this command inside the application directory. +Run the following command with the folder created by the previous command to generate an environment file which will contain your configuration settings: ```shell -php artisan winter:install +php artisan winter:env ``` -## Learning Winter +After configuring your installation, you can run the following command to run the database migrations and automatically create an administrator account with the username `admin`. The password of this account will be automatically generated and displayed in your terminal. + +```shell +php artisan winter:up +``` -The best place to learn Winter is by [reading the documentation](https://wintercms.com/docs), [watching some screencasts](https://octobercms.com/support/topic/screencast) or [following some tutorials](https://octobercms.com/support/articles/tutorials). +## Learning Winter -You may also watch these introductory videos for [beginners](https://vimeo.com/79963873) and [advanced users](https://vimeo.com/172202661). +The best place to learn Winter is by [reading the documentation](https://wintercms.com/docs) or [following some tutorials](https://wintercms.com/blog/category/tutorials). You can also join the maintenance team and our active community on [Discord](https://discord.gg/D5MFSPH6Ux) who are always willing to help out with questions. -## Development Team +## Development team Winter was forked from October CMS in March 2021 due to a difference in open source management philosophies between the core maintainer team and the two founders of October. @@ -52,18 +58,18 @@ The development of Winter is lead by [Luke Towers](https://luketowers.ca/), alon ## Foundation library -The CMS is built on top of the wildly-popular [Laravel](https://laravel.com) PHP framework, with the in-house [Storm](https://github.com/wintercms/storm) Library as a buffer between the Laravel Framework and the CMS project to minimize breaking changes and improve stability. +Winter is built on top of the wildly-popular [Laravel](https://laravel.com) framework for PHP, with the in-house [Storm](https://github.com/wintercms/storm) library as a buffer between the Laravel framework and the Winter project, to minimize breaking changes and improve stability. -## Contact +## Getting in touch -You can communicate with us using the following mediums: +You can get in touch with the maintainer team using the following mediums: * [Follow us on Twitter](https://twitter.com/usewintercms) for announcements and updates. * [Join us on Discord](https://discord.gg/D5MFSPH6Ux) to chat with us. ## Contributing -Before sending or reviewing Pull Requests, be sure to review the [Contributing Guidelines](https://github.com/wintercms/.github/blob/master/CONTRIBUTING.md) first. +Before contributing issues or pull requests, be sure to review the [Contributing Guidelines](https://github.com/wintercms/.github/blob/master/CONTRIBUTING.md) first. ### Coding standards @@ -73,14 +79,14 @@ Please follow the following guides and code standards: * [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) * [PSR 1 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) -### Code of Conduct +### Code of conduct -In order to ensure that the Winter CMS community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/wintercms/.github/blob/master/CODE_OF_CONDUCT.md). +In order to ensure that the Winter community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/wintercms/.github/blob/master/CODE_OF_CONDUCT.md). ## License -The Winter CMS platform is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). +The Winter platform is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). -## Security Vulnerabilities +## Security vulnerabilities Please review [our security policy](https://github.com/wintercms/winter/security/policy) on how to report security vulnerabilities. diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm b/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm index 5e7b020398..d8df34c81d 100644 --- a/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm +++ b/modules/backend/behaviors/relationcontroller/partials/_button_delete.htm @@ -3,7 +3,7 @@ class="btn btn-sm btn-secondary wn-icon-trash-o" data-request="onRelationButtonDelete" data-request-confirm="" - data-request-success="$.wn.relationBehavior.changed('vars['relationField']) ?>', 'deleted')" + data-request-success="$.wn.relationBehavior.changed('', 'deleted')" data-stripe-load-indicator> @@ -16,7 +16,7 @@ disabled="disabled" data-request="onRelationButtonDelete" data-request-confirm="" - data-request-success="$.wn.relationBehavior.changed('vars['relationField']) ?>', 'deleted')" + data-request-success="$.wn.relationBehavior.changed('', 'deleted')" data-trigger-action="enable" data-trigger="#relationGetId('view') ?> .control-list input[type=checkbox]" data-trigger-condition="checked" diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm b/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm index 3c5a12f771..a5326e4f4d 100644 --- a/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm +++ b/modules/backend/behaviors/relationcontroller/partials/_button_remove.htm @@ -2,7 +2,7 @@ @@ -14,7 +14,7 @@ })" disabled="disabled" data-request="onRelationButtonRemove" - data-request-success="$.wn.relationBehavior.changed('vars['relationField']) ?>', 'removed')" + data-request-success="$.wn.relationBehavior.changed('', 'removed')" data-trigger-action="enable" data-trigger="#relationGetId('view') ?> .control-list input[type=checkbox]" data-trigger-condition="checked" diff --git a/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm b/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm index d7ea202cb0..59ea3ec221 100644 --- a/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm +++ b/modules/backend/behaviors/relationcontroller/partials/_button_unlink.htm @@ -2,7 +2,7 @@ href="javascript:;" class="btn btn-sm btn-secondary wn-icon-unlink" data-request="onRelationButtonUnlink" - data-request-success="$.wn.relationBehavior.changed('vars['relationField']) ?>', 'removed')" + data-request-success="$.wn.relationBehavior.changed('', 'removed')" data-request-confirm="" data-stripe-load-indicator> diff --git a/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm b/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm index c127f91c77..b60295bdf9 100644 --- a/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm +++ b/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm @@ -4,7 +4,7 @@ true, 'sessionKey' => $newSessionKey, - 'data-request-success' => "$.wn.relationBehavior.changed('" . e($this->vars['relationField']) . "', 'updated')", + 'data-request-success' => "$.wn.relationBehavior.changed('" . e($relationField) . "', 'updated')", ]) ?> @@ -53,7 +53,7 @@