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

@ -23,12 +23,7 @@ module.exports = {
browser: true,
es6: true,
},
plugins: [
'react',
'react-hooks',
'prettier',
'@typescript-eslint',
],
plugins: ['react', 'react-hooks', 'prettier', '@typescript-eslint'],
extends: [
// 'standard',
'eslint:recommended',
@ -53,5 +48,5 @@ module.exports = {
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
}
},
};

View file

@ -3,25 +3,36 @@ name: Docker
on:
push:
branches:
- "develop"
- "release/v*"
- develop
- 1.0-develop
pull_request:
branches:
- develop
- 1.0-develop
release:
types:
- published
jobs:
push:
name: Push
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'))"
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Docker metadata
uses: docker/metadata-action@v4
id: docker_meta
uses: docker/metadata-action@v4
with:
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
uses: docker/setup-qemu-action@v2
@ -29,33 +40,28 @@ jobs:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Release production build
uses: docker/build-push-action@v3
if: "contains(github.ref, 'release/v')"
with:
context: .
file: ./Containerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Update version
if: "github.event_name == 'release' && github.event.action == 'published'"
env:
REF: ${{ github.event.release.tag_name }}
run: |
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
- name: Release development build
- name: Build and Push
uses: docker/build-push-action@v3
if: "contains(github.ref, 'develop')"
with:
context: .
file: ./Containerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64 #,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -36,21 +36,19 @@ jobs:
git push -u origin $BRANCH
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
git add config/app.php
git commit -m "bump version for release"
git commit -m "ci(release): bump version"
git push
- name: Create release archive
run: |
rm -rf node_modules/ tests/ CODE_OF_CONDUCT.md CONTRIBUTING.md phpstan.neon phpunit.xml
tar -czf panel.tar.gz * .env.example .eslintignore .eslintrc.js
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 * .editorconfig .env.example .eslintignore .eslintrc.js .gitignore .prettierrc.json
- name: Extract changelog
id: extract_changelog
env:
REF: ${{ github.ref }}
run: |
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
run: |
@ -60,15 +58,13 @@ jobs:
- name: Create release
id: create_release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.extract_changelog.outputs.version_name }}
body_path: ./RELEASE_CHANGELOG
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
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.
## v1.11.1
### Fixed
* Fixed Panel Docker image showing `canary` as it's version.
## v1.11.0
### Changed (since 1.10.4)
* Changed minimum PHP version requirement from `7.4` to `8.0`.

View file

@ -13,7 +13,7 @@ class NodeCreationService
/**
* 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
{
$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);
return $this->repository->create($data, true, true);

View file

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

View file

@ -60,9 +60,6 @@ export default ({ className }: WithClassname) => {
const onUploadProgress = (data: ProgressEvent, name: string) => {
setUploadProgress({ name, loaded: data.loaded });
if (data.loaded >= data.total) {
timeouts.value.push(setTimeout(() => removeFileUpload(name), 500));
}
};
const onFileSubmission = (files: FileList) => {
@ -74,20 +71,25 @@ export default ({ className }: WithClassname) => {
const uploads = list.map(file => {
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 () =>
getFileUploadUrl(uuid).then(url =>
axios.post(
getFileUploadUrl(uuid).then((url) =>
axios
.post(
url,
{ files: file },
{
signal: controller.signal,
headers: { 'Content-Type': 'multipart/form-data' },
params: { directory },
onUploadProgress: data => onUploadProgress(data, file.name),
},
),
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 }>;
clearFileUploads: Action<ServerFileStore>;
removeFileUpload: Action<ServerFileStore, string>;
cancelFileUpload: Action<ServerFileStore, string>;
}
const files: ServerFileStore = {
@ -71,6 +72,15 @@ const files: ServerFileStore = {
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
// a no-op.
upload.abort.abort();