In the future, if users are converting phars into zips via pmt.mcpe.me, developers can require the users to agree with their terms before downloading the extraction.
The terms are composed of two parts, namely "lock" and "key". When a user clicked the Convert
button of the webpage submitting a phar that requires agreeing with terms, he will get a prompt that shows the content of the "lock". To continue and download the zip, he has to enter the "key" into the prompt.
There are currently three simple ways to add lock-and-key into your phar:
If your plugin is compiled with pmt.mcpe.me, you can add this into your plugin.yml:
me.mcpe.pmt:
agree:
lock: "Do not redistribute this phar! Type 'ok' to continue."
key: ok
If you omit key
, Type "yes" if you agree with the above terms to continue
will be automatically appended to the lock and the key will be yes
.
Run the terms.php
in this gist with php
, with the following parameters:
--phar
- A relative or absolute path to your phar file
--lock
(optional)- Path to a file whose contents are the lock to use, or
php://stdin
for STDIN. If not provided, the user will be prompted to enter that during the script run.
- Path to a file whose contents are the lock to use, or
--key
(optional)- The key itself. If not provided,
Type "yes" if you agree with the above terms to continue
will be automatically appended to the lock and the key will beyes
.
- The key itself. If not provided,
Run a simple PHP script that updates the metadata of your phar:
php -r '$phar = new Phar("my.phar");
$phar->startBuffering();
$metadata = $phar->getMetadata();
$metadata["me.mcpe.pmt"] = [
"agree" => [
"lock" => "The lock here",
" key" => "The key here"
]
];
$phar->setMetadata($metadata);
$phar->stopBuffering();'
You can also omit key
, and same rules as above if you do so.
If you need help, please contact @PEMapModder_Flw
on Twitter. If you found out a bug, please create an issue at https://github.com/PEMapModder/web-server-source