Merge branch '1.0-develop' into develop

This commit is contained in:
Matthew Penner 2022-12-12 14:06:52 -07:00
commit e64e28839b
No known key found for this signature in database
8 changed files with 73 additions and 60 deletions

View file

@ -15,20 +15,15 @@ module.exports = {
version: 'detect', version: 'detect',
}, },
linkComponents: [ linkComponents: [
{name: 'Link', linkAttribute: 'to'}, { name: 'Link', linkAttribute: 'to' },
{name: 'NavLink', linkAttribute: 'to'}, { name: 'NavLink', linkAttribute: 'to' },
], ],
}, },
env: { env: {
browser: true, browser: true,
es6: true, es6: true,
}, },
plugins: [ plugins: ['react', 'react-hooks', 'prettier', '@typescript-eslint'],
'react',
'react-hooks',
'prettier',
'@typescript-eslint',
],
extends: [ extends: [
// 'standard', // 'standard',
'eslint:recommended', 'eslint:recommended',
@ -38,7 +33,7 @@ module.exports = {
], ],
rules: { rules: {
eqeqeq: 'error', eqeqeq: 'error',
'prettier/prettier': ['error', {}, {usePrettierrc: true}], 'prettier/prettier': ['error', {}, { usePrettierrc: true }],
// TypeScript can infer this significantly better than eslint ever can. // TypeScript can infer this significantly better than eslint ever can.
'react/prop-types': 0, 'react/prop-types': 0,
'react/display-name': 0, 'react/display-name': 0,
@ -51,7 +46,7 @@ module.exports = {
// @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md#how-to-use // @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md#how-to-use
'no-use-before-define': 0, 'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': 'warn', '@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', {argsIgnorePattern: '^_', varsIgnorePattern: '^_'}], '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/ban-ts-comment': ['error', {'ts-expect-error': 'allow-with-description'}], '@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
} },
}; };

View file

@ -3,25 +3,36 @@ name: Docker
on: on:
push: push:
branches: branches:
- "develop" - develop
- "release/v*" - 1.0-develop
pull_request:
branches:
- develop
- 1.0-develop
release:
types:
- published
jobs: jobs:
push: push:
name: Push name: Push
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
# Always run against a tag, even if the commit into the tag has [docker skip]
# within the commit message.
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))" if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
steps: steps:
- name: Code checkout - name: Code checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Docker metadata - name: Docker metadata
uses: docker/metadata-action@v4
id: docker_meta id: docker_meta
uses: docker/metadata-action@v4
with: with:
images: ghcr.io/pterodactyl/panel images: ghcr.io/pterodactyl/panel
flavor: |
latest=false
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease == false }}
type=ref,event=tag
type=ref,event=branch
- name: Setup QEMU - name: Setup QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
@ -29,33 +40,28 @@ jobs:
- name: Setup Docker buildx - name: Setup Docker buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Docker login - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Release production build - name: Update version
uses: docker/build-push-action@v3 if: "github.event_name == 'release' && github.event.action == 'published'"
if: "contains(github.ref, 'release/v')" env:
with: REF: ${{ github.event.release.tag_name }}
context: . run: |
file: ./Containerfile sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Release development build - name: Build and Push
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
if: "contains(github.ref, 'develop')"
with: with:
context: . context: .
file: ./Containerfile file: ./Containerfile
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64 #,linux/arm64 platforms: linux/amd64 #,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }} labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max

View file

@ -36,21 +36,19 @@ jobs:
git push -u origin $BRANCH git push -u origin $BRANCH
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
git add config/app.php git add config/app.php
git commit -m "bump version for release" git commit -m "ci(release): bump version"
git push git push
- name: Create release archive - name: Create release archive
run: | run: |
rm -rf node_modules/ tests/ CODE_OF_CONDUCT.md CONTRIBUTING.md phpstan.neon phpunit.xml rm -rf node_modules tests CODE_OF_CONDUCT.md CONTRIBUTING.md flake.lock flake.nix phpstan.neon phpunit.xml shell.nix
tar -czf panel.tar.gz * .env.example .eslintignore .eslintrc.js tar -czf panel.tar.gz * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
- name: Extract changelog - name: Extract changelog
id: extract_changelog
env: env:
REF: ${{ github.ref }} REF: ${{ github.ref }}
run: | run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG
echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10} .*)$/\1/p" CHANGELOG.md`
- name: Create checksum and add to changelog - name: Create checksum and add to changelog
run: | run: |
@ -60,15 +58,13 @@ jobs:
- name: Create release - name: Create release
id: create_release id: create_release
uses: actions/create-release@v1 uses: softprops/action-gh-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.extract_changelog.outputs.version_name }}
body_path: ./RELEASE_CHANGELOG
draft: true draft: true
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
body_path: ./RELEASE_CHANGELOG
- name: Upload release archive - name: Upload release archive
id: upload-release-archive id: upload-release-archive

View file

@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines. This project follows [Semantic Versioning](http://semver.org) guidelines.
## v1.11.1
### Fixed
* Fixed Panel Docker image showing `canary` as it's version.
## v1.11.0 ## v1.11.0
### Changed (since 1.10.4) ### Changed (since 1.10.4)
* Changed minimum PHP version requirement from `7.4` to `8.0`. * Changed minimum PHP version requirement from `7.4` to `8.0`.

View file

@ -13,7 +13,7 @@ class NodeCreationService
/** /**
* NodeCreationService constructor. * NodeCreationService constructor.
*/ */
public function __construct(private Encrypter $encrypter, protected NodeRepositoryInterface $repository) public function __construct(protected NodeRepositoryInterface $repository)
{ {
} }
@ -25,7 +25,7 @@ class NodeCreationService
public function handle(array $data): Node public function handle(array $data): Node
{ {
$data['uuid'] = Uuid::uuid4()->toString(); $data['uuid'] = Uuid::uuid4()->toString();
$data['daemon_token'] = $this->encrypter->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)); $data['daemon_token'] = app(Encrypter::class)->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH));
$data['daemon_token_id'] = Str::random(Node::DAEMON_TOKEN_ID_LENGTH); $data['daemon_token_id'] = Str::random(Node::DAEMON_TOKEN_ID_LENGTH);
return $this->repository->create($data, true, true); return $this->repository->create($data, true, true);

View file

@ -33,7 +33,7 @@ const Spinner = ({ progress, className }: { progress: number; className?: string
const FileUploadList = () => { const FileUploadList = () => {
const { close } = useContext(DialogWrapperContext); const { close } = useContext(DialogWrapperContext);
const removeFileUpload = ServerContext.useStoreActions(actions => actions.files.removeFileUpload); const cancelFileUpload = ServerContext.useStoreActions(actions => actions.files.cancelFileUpload);
const clearFileUploads = ServerContext.useStoreActions(actions => actions.files.clearFileUploads); const clearFileUploads = ServerContext.useStoreActions(actions => actions.files.clearFileUploads);
const uploads = ServerContext.useStoreState(state => const uploads = ServerContext.useStoreState(state =>
Object.entries(state.files.uploads).sort(([a], [b]) => a.localeCompare(b)), Object.entries(state.files.uploads).sort(([a], [b]) => a.localeCompare(b)),
@ -50,7 +50,7 @@ const FileUploadList = () => {
</Tooltip> </Tooltip>
<Code className={'flex-1 truncate'}>{name}</Code> <Code className={'flex-1 truncate'}>{name}</Code>
<button <button
onClick={removeFileUpload.bind(this, name)} onClick={cancelFileUpload.bind(this, name)}
className={'text-gray-500 hover:text-gray-200 transition-colors duration-75'} className={'text-gray-500 hover:text-gray-200 transition-colors duration-75'}
> >
<XIcon className={'w-5 h-5'} /> <XIcon className={'w-5 h-5'} />

View file

@ -60,9 +60,6 @@ export default ({ className }: WithClassname) => {
const onUploadProgress = (data: ProgressEvent, name: string) => { const onUploadProgress = (data: ProgressEvent, name: string) => {
setUploadProgress({ name, loaded: data.loaded }); setUploadProgress({ name, loaded: data.loaded });
if (data.loaded >= data.total) {
timeouts.value.push(setTimeout(() => removeFileUpload(name), 500));
}
}; };
const onFileSubmission = (files: FileList) => { const onFileSubmission = (files: FileList) => {
@ -74,20 +71,25 @@ export default ({ className }: WithClassname) => {
const uploads = list.map(file => { const uploads = list.map(file => {
const controller = new AbortController(); const controller = new AbortController();
pushFileUpload({ name: file.name, data: { abort: controller, loaded: 0, total: file.size } }); pushFileUpload({
name: file.name,
data: { abort: controller, loaded: 0, total: file.size },
});
return () => return () =>
getFileUploadUrl(uuid).then(url => getFileUploadUrl(uuid).then((url) =>
axios.post( axios
url, .post(
{ files: file }, url,
{ { files: file },
signal: controller.signal, {
headers: { 'Content-Type': 'multipart/form-data' }, signal: controller.signal,
params: { directory }, headers: { 'Content-Type': 'multipart/form-data' },
onUploadProgress: data => onUploadProgress(data, file.name), params: { directory },
}, onUploadProgress: (data) => onUploadProgress(data, file.name),
), }
)
.then(() => timeouts.value.push(setTimeout(() => removeFileUpload(file.name), 500)))
); );
}); });

View file

@ -23,6 +23,7 @@ interface ServerFileStore {
setUploadProgress: Action<ServerFileStore, { name: string; loaded: number }>; setUploadProgress: Action<ServerFileStore, { name: string; loaded: number }>;
clearFileUploads: Action<ServerFileStore>; clearFileUploads: Action<ServerFileStore>;
removeFileUpload: Action<ServerFileStore, string>; removeFileUpload: Action<ServerFileStore, string>;
cancelFileUpload: Action<ServerFileStore, string>;
} }
const files: ServerFileStore = { const files: ServerFileStore = {
@ -71,6 +72,15 @@ const files: ServerFileStore = {
return; return;
} }
delete state.uploads[payload];
}),
cancelFileUpload: action((state, payload) => {
const upload = state.uploads[payload];
if (upload === undefined) {
return;
}
// Abort the request if it is still in flight. If it already completed this is // Abort the request if it is still in flight. If it already completed this is
// a no-op. // a no-op.
upload.abort.abort(); upload.abort.abort();