See https://www.woltlab.com/community/thread/301678-acp-lizenzierte-produkte-plugins-installieren/
function installPackage(button: HTMLButtonElement): Promise<void> {
const installation = new AcpUiPackagePrepareInstallation();
- return installation.start(button.dataset.package!, button.dataset.packageVersion!);
+ return installation.start(button.dataset.package!, button.dataset.packageVersion!, "license");
}
export function setup(): void {
};
}
+type RedirectLocation = "license";
+
class AcpUiPackagePrepareInstallation {
private identifier = "";
private version = "";
#resolve?: () => void;
+ #redirectLocation?: RedirectLocation;
- start(identifier: string, version: string): Promise<void> {
+ start(identifier: string, version: string, redirectLocation?: RedirectLocation): Promise<void> {
if (this.#resolve !== undefined) {
throw new Error("There is already a pending installation.");
}
this.identifier = identifier;
this.version = version;
+ this.#redirectLocation = redirectLocation;
return new Promise<void>((resolve) => {
this.#resolve = resolve;
UiDialog.close(this);
}
- const installation = new window.WCF.ACP.Package.Installation(data.returnValues.queueID, undefined, false);
+ const installation = new window.WCF.ACP.Package.Installation(data.returnValues.queueID, undefined, false, false, {
+ redirectLocation: this.#redirectLocation,
+ });
installation.prepareInstallation();
} else if (data.returnValues.template) {
UiDialog.open(this, data.returnValues.template);
PrepareInstallation_1 = tslib_1.__importDefault(PrepareInstallation_1);
function installPackage(button) {
const installation = new PrepareInstallation_1.default();
- return installation.start(button.dataset.package, button.dataset.packageVersion);
+ return installation.start(button.dataset.package, button.dataset.packageVersion, "license");
}
function setup() {
const callback = (0, PromiseMutex_1.promiseMutex)((button) => installPackage(button));
identifier = "";
version = "";
#resolve;
- start(identifier, version) {
+ #redirectLocation;
+ start(identifier, version, redirectLocation) {
if (this.#resolve !== undefined) {
throw new Error("There is already a pending installation.");
}
this.identifier = identifier;
this.version = version;
+ this.#redirectLocation = redirectLocation;
return new Promise((resolve) => {
this.#resolve = resolve;
this.prepare({});
if (Dialog_1.default.isOpen(this)) {
Dialog_1.default.close(this);
}
- const installation = new window.WCF.ACP.Package.Installation(data.returnValues.queueID, undefined, false);
+ const installation = new window.WCF.ACP.Package.Installation(data.returnValues.queueID, undefined, false, false, {
+ redirectLocation: this.#redirectLocation,
+ });
installation.prepareInstallation();
}
else if (data.returnValues.template) {
public PackageInstallationQueue $queue;
+ private string $redirectLocation = '';
+
/**
* @inheritDoc
*/
throw new IllegalLinkException();
}
+ $redirectLocation = $_REQUEST['redirectLocation'] ?? '';
+ if ($redirectLocation === 'license') {
+ $this->redirectLocation = $redirectLocation;
+ }
+
$this->installation = new PackageInstallationDispatcher($this->queue);
}
$controller = 'first-time-setup';
WCF::getSession()->unregister('__wcfSetup_completed');
+ } else if ($this->redirectLocation === 'license') {
+ $controller = 'license';
}
// Do not use the LinkHandler here as it is sort of unreliable during WCFSetup.