Skip to content

Commit

Permalink
merge branch v2 (release 2.0.0-alpha.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Feb 24, 2024
2 parents 46ba17b + c04a17e commit 0b38cec
Show file tree
Hide file tree
Showing 23 changed files with 797 additions and 104 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ echo ".gitattributes export-ignore" >.gitattributes
echo ".github export-ignore" >>.gitattributes
echo "VERSION export-ignore" >>.gitattributes

echo -e "> :bell: Note that is the distribution-only repository for [Automad](https://automad.org). Head over to [marcantondahmen/automad](https://github.com/marcantondahmen/automad) for the source code and issues.\n---\n" >README.md
cat $srcDir/README.md >>README.md

echo '---------------------------------------------------------------------------'
echo 'Commit and push'

Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ on:
- '*'

jobs:
release-notes:
name: 'Regex Filtered Release Notes'
runs-on: 'ubuntu-latest'
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: 'marcantondahmen/release-notes-action@master'
- uses: actions/checkout@v4
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: true
draft: true
filter: '^(feat|fix|refactor)'
strict: true
fetch-depth: 0
fetch-tags: true
- run: bash bin/changelog.sh 1 >body.md
- uses: ncipollo/release-action@v1
with:
bodyFile: 'body.md'
342 changes: 342 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# Automad

A flat-file content management system and template engine
A flat-file content management system and template engine.

![Tag](https://img.shields.io/github/v/tag/marcantondahmen/automad?include_prereleases&sort=semver&color=222222)
![PHP](https://img.shields.io/packagist/dependency-v/automad/dist/php?color=222222)
![PHP](https://img.shields.io/packagist/dependency-v/automad/automad/php?color=222222)
![Language](https://img.shields.io/github/languages/top/marcantondahmen/automad?color=222222)
![Size](https://img.shields.io/github/languages/code-size/marcantondahmen/automad?color=222222)
![License](https://img.shields.io/github/license/marcantondahmen/automad?color=222222)
[![Twitter](https://img.shields.io/twitter/follow/automadcms?label=Follow)](https://twitter.com/automadcms)

![](https://raw.githubusercontent.com/marcantondahmen/media-files/master/automad-v2/readme-light.png)

## Links

- [Documentation](https://automad.org)
- [Changelog](https://github.com/marcantondahmen/automad/blob/-/CHANGELOG.md)
- [Discussion](https://automad.org/discuss)

## Installation

Automad can be installed using [Docker](https://docker.com), [Composer](https://getcomposer.org) or manually.
Note that this repository only contains source code. Please follow the instructions below in order to install a fully bundled
version of Automad using [Docker](https://docker.com) or [Composer](https://getcomposer.org).

### Composer

Expand All @@ -33,18 +40,16 @@ It is also possible to run Automad in a [Docker](https://hub.docker.com/r/automa
docker run -dp 80:80 -v ./app:/app --name mysite automad/automad:v2
```

The first time you run the image, a new user account for the Automad dashboard will be created automatically. The account details will be logged by the running container. You can show these logs using the following command:
This will essentially make your site available at port `80` and mount a directory called `app` in the current working directory for data persistence.
A new user account for the Automad dashboard will be created automatically. The account details will be logged by the running container.
You can show these logs using the following command:

```bash
docker logs mysite
```

Your can now navigate to [localhost](http://localhost) to view your new site.

### Manual Download

Alternatively Automad can also be [downloaded](https://github.com/automadcms/automad-dist/archive/refs/heads/v2.zip) as a `.zip` file and installed manually. [Read more here.](https://automad.org/version-2#getting-started)

## Documentation

Take a look at the [documentation](https://automad.org) to get started with Automad.
Expand All @@ -63,7 +68,7 @@ In case you are interested in contributing, the following types of contribution

- Improving [language packs](https://github.com/automadcms/automad-language-packs) by fixing translation errors or adding new languages
- [Publishing packages](https://automad.org/developer-guide/publishing-packages) like themes or extensions to the Automad package [browser](https://packages.automad.org)
- Giving feedback and helping to grow a [community](https://discuss.automad.org)
- Giving feedback and helping to grow a [community](https://automad.org/discuss)
- Reporting bugs or requesting features at [GitHub](https://github.com/marcantondahmen/automad/issues)

However, I do not exclude at this point using parts of Automad's source in future projects under different licenses. In order to avoid having to ask anybody for permission when doing so, I will not accept any contributions to **this** repository. Please understand that pull requests will therefore be ignored.
Expand Down
1 change: 0 additions & 1 deletion automad/lang/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@
"selectTargetNewPage": "Select a location for the new page",
"sendMailError": "Error sending email!",
"serverInfo": "Server Information",
"setupUserAccount": "Setup user account",
"shadow": "Shadow",
"sharedImages": "Shared images",
"sharedTitle": "General Data and Files",
Expand Down
165 changes: 165 additions & 0 deletions automad/src/client/admin/components/Forms/SetupForm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* ....
* .: '':.
* :::: ':..
* ::. ''..
* .:'.. ..':.:::' . :. '':.
* :. '' '' '. ::::.. ..:
* ::::. ..':.. .'''::::: .
* :::::::.. '..:::: :. :::: :
* ::'':::::::. ':::.'':.:::: :
* :.. ''::::::....': '':: :
* :::::. '::::: : .. '' .
* .''::::::::... ':::.'' ..'' :.''''.
* :..:::''::::: :::::...:'' :..:
* ::::::. ':::: :::::::: ..:: .
* ::::::::.:::: :::::::: :'':.:: .''
* ::: '::::::::.' ''::::: :.' '': :
* ::: :::::::::..' :::: ::...' .
* ::: .:::::::::: :::: :::: .:'
* '::' ''::::::: :::: : :: :
* ':::: :::: :'' .:
* :::: :::: ..''
* :::: ..:::: .:''
* '''' '''''
*
*
* AUTOMAD
*
* Copyright (c) 2024 by Marc Anton Dahmen
* https://marcdahmen.de
*
* Licensed under the MIT license.
*/

import { create, CSS, html, KeyValueMap, Route } from '@/core';
import { FormComponent } from './Form';

/**
* Create the first user account.
*
* @extends FormComponent
*/
export class SetupFormComponent extends FormComponent {
/**
* The callback function used when an element is created in the DOM.
*/
connectedCallback(): void {
this.renderForm();
}

/**
* Process the response that is received after submitting the form.
*
* @param response
* @async
*/
protected async processResponse(response: KeyValueMap): Promise<void> {
const { data } = response;

if (data?.php && data?.filename && data?.configDir) {
this.renderSuccess(data.configDir, data.filename);

const href = window.URL.createObjectURL(
new Blob([data.php], { type: 'application/octet-stream' })
);

create('a', [], {
href,
target: '_blank',
download: data.filename,
}).click();
}

super.processResponse(response);
}

/**
* Render the account data form.
*/
private renderForm(): void {
// Setup happens before a user can set a language.
// Therefore all text modules will be by default in English.
this.innerHTML = html`
<h2>Create User &mdash; Step 1/2</h2>
<am-form-error></am-form-error>
<div class="${CSS.card}">
<div class="${CSS.cardBody} ${CSS.cardBodyLarge}">
<p>
Create the first user account using the form below and
download the account file to your computer.
</p>
</div>
<div class="${CSS.cardForm}">
<input
class="${CSS.input}"
type="text"
name="username"
placeholder="Username"
required
/>
<input
class="${CSS.input}"
type="email"
name="email"
placeholder="Email"
required
/>
<input
class="${CSS.input}"
type="password"
name="password1"
placeholder="Password"
required
/>
<input
class="${CSS.input}"
type="password"
name="password2"
placeholder="Repeat Password"
required
/>
<div class="${CSS.cardFormButtons}">
<am-submit class="${CSS.button} ${CSS.buttonPrimary}">
Create Account and Download File
</am-submit>
</div>
</div>
</div>
`;
}

/**
* Render the second step of the process.
*
* @param configDir
* @param filename
*/
private renderSuccess(configDir: string, filename: string): void {
this.innerHTML = html`
<h2>Create User &mdash; Step 2/2</h2>
<div class="${CSS.card}">
<div class="${CSS.cardBody} ${CSS.cardBodyLarge}">
<p>
Now, upload the downloaded <code>${filename}</code> to
your webserver and place it inside
<code>${configDir}</code>. After the file is uploaded,
hit the button below in order to sign in.
</p>
</div>
<div class="${CSS.cardForm}">
<div class="${CSS.cardFormButtons}">
<a
href="./${Route.login}"
class="${CSS.button} ${CSS.buttonPrimary}"
>
I have uploaded the file, let me sign in!
</a>
</div>
</div>
</div>
`;
}
}

customElements.define('am-setup-form', SetupFormComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const searchData = (): JumpbarItemData[] => {
const inPageData = (): JumpbarItemData[] => {
return [
{
external: App.baseURL,
external: App.baseURL || '/',
value: App.text('inPageEdit'),
title: App.text('inPageEdit'),
icon: 'window-desktop',
Expand Down
2 changes: 1 addition & 1 deletion automad/src/client/admin/components/Pages/Home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const systemInfo = (): string => {
</div>
<div class="${CSS.formGroup}">
<a
href="${App.baseURL}"
href="${App.baseURL || '/'}"
class="${CSS.button} ${CSS.formGroupItem}"
target="_blank"
>
Expand Down
11 changes: 5 additions & 6 deletions automad/src/client/admin/components/Pages/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class LoginComponent extends BaseCenteredLayoutComponent {
${Attr.enter}
>
<am-form-error></am-form-error>
<div class="am-c-card">
<div class="${CSS.card}">
<div class="${CSS.cardForm}">
<input
class="${CSS.input}"
Expand All @@ -86,16 +86,15 @@ export class LoginComponent extends BaseCenteredLayoutComponent {
placeholder="${App.text('password')}"
required
/>
<div class="am-c-card__form-buttons">
<a
href="./${Route.resetpassword}"
<div class="${CSS.cardFormButtons}">
<am-link
${Attr.target}="${Route.resetpassword}"
class="${CSS.button}"
>
${App.text('forgotPassword')}
</a>
</am-link>
<am-submit
class="${CSS.button} ${CSS.buttonPrimary}"
${Attr.form}="${SessionController.login}"
>
${App.text('signIn')}
</am-submit>
Expand Down
20 changes: 17 additions & 3 deletions automad/src/client/admin/components/Pages/Setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
* Licensed under the MIT license.
*/

import { App, getTagFromRoute, Route } from '@/core';
import {
Attr,
getTagFromRoute,
html,
Route,
UserCollectionController,
} from '@/core';
import { BaseCenteredLayoutComponent } from './BaseCenteredLayout';

/**
Expand All @@ -45,7 +51,9 @@ export class SetupComponent extends BaseCenteredLayoutComponent {
* Set the page title that is used a document title suffix.
*/
protected get pageTitle(): string {
return App.text('setupUserAccount');
// Setup happens before a user can set a language.
// Therefore the title will be by default in English.
return 'Create User';
}

/**
Expand All @@ -54,7 +62,13 @@ export class SetupComponent extends BaseCenteredLayoutComponent {
* @returns the rendered HTML
*/
protected renderMainPartial(): string {
return 'Setup';
return html`
<am-setup-form
${Attr.api}="${UserCollectionController.createFirstUser}"
${Attr.focus}
${Attr.enter}
></am-setup-form>
`;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export const centered = ({ main }: Partials): string => {
<div class="${CSS.layoutCentered}">
<div class="${CSS.layoutCenteredNavbar}">
<nav class="${CSS.navbar}">
<a href="${App.baseURL}" class="${CSS.navbarItem}">
<a href="${App.baseURL || '/'}" class="${CSS.navbarItem}">
<am-logo></am-logo>
</a>
<a
href="${App.baseURL}"
href="${App.baseURL || '/'}"
class="${CSS.navbarItem}"
${Attr.tooltip}="${App.text('close')}"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const inPage = ({ main }: Partials): string => {
</am-submit>
</span>
<am-link
href="${App.baseURL}"
href="${App.baseURL || '/'}"
class="${CSS.navbarItem}"
${Attr.bind}="inPageReturnUrl"
${Attr.bindTo}="${Attr.external}"
Expand Down
1 change: 1 addition & 0 deletions automad/src/client/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import './components/Forms/PageDataForm';
import './components/Forms/PublishForm';
import './components/Forms/ResetPasswordForm';
import './components/Forms/SearchForm';
import './components/Forms/SetupForm';
import './components/Forms/SharedDataForm';
import './components/Forms/Submit';
import './components/Forms/SystemUpdateForm';
Expand Down
1 change: 1 addition & 0 deletions automad/src/client/common/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const enum SystemController {
}

export const enum UserCollectionController {
createFirstUser = 'UserCollectionController::createFirstUser',
createUser = 'UserCollectionController::createUser',
edit = 'UserCollectionController::edit',
inviteUser = 'UserCollectionController::inviteUser',
Expand Down
Loading

0 comments on commit 0b38cec

Please sign in to comment.