Skip to content

Commit

Permalink
js mvp ; udpate process needs test (py + filperms across the board)
Browse files Browse the repository at this point in the history
  • Loading branch information
froger-me committed Jan 11, 2024
1 parent 02597e2 commit ae7f45e
Show file tree
Hide file tree
Showing 13 changed files with 282 additions and 92 deletions.
2 changes: 1 addition & 1 deletion inc/class-wppus-license-update-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function checkAuthorization( $request ) {
$license_signature
)
) {
$this->exitWithError( '', 403 );
$this->exitWithError( 'Invalid license key or signature.', 403 );
}
}

Expand Down
2 changes: 1 addition & 1 deletion integration/docs/generic.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ if ($http_response_header[0] == 'HTTP/1.1 200 OK') {
#### Node.js

```js
const https = require('https');
const https = require('follow-redirects').https;
const fs = require('fs');
const url = "https://server.domain.tld/wppus-update-api/?action=download&token=c0c403841752170640518823d752baba&package_id=dummy-generic-package&license_key=41ec1eba0f17d47f76827a33c7daab2c&license_signature=ZaH%2Ba_p1_EkM3BUIpqn7T53htuVPBem2lDtGIxr28oHjdCycvo_ZkxItYqb7mOHhfCMSwnMofWW7UchztEo0k2TwRgk81rNvZyYv6GfRZIxzDP5SzgREjnSAu6JVxDa5yvdd6uqWHWi_U1wRxff0nItItoAloWsek1SVbWbmQXs%3D";

Expand Down
5 changes: 3 additions & 2 deletions integration/dummy-generic/dummy-generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ wppusApi.on('ready', function (api) {
// If the command is "update" and the script is installed
if (true === api.is_installed()) {
// Get the update information
api.update();
await api.update();

console.log("Updated");
console.log(api.get_update_info());
console.log("");
console.log(await api.get_update_info());
} else {
console.log("The package is not installed");
}
Expand Down
5 changes: 3 additions & 2 deletions integration/dummy-generic/dummy-generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_update_info():
print("---------")
print("")
# Pretty print the response
print(json.dumps(wppus_api.get_update_info(), indent=4))
print(json.dumps(wppus_api.get_update_info(), indent=4).replace("\\/", "/"))
print("")
else:
print("The package is not installed")
Expand All @@ -114,7 +114,8 @@ def update():
print("Updated")
print("")
# Pretty print the response
print(json.dumps(wppus_api.get_update_info(), indent=4))
print(json.dumps(wppus_api.get_update_info(), indent=4).replace("\\/", "/"))
print("")
else:
print("The package is not installed")

Expand Down
2 changes: 1 addition & 1 deletion integration/dummy-generic/node-dist/exports.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion integration/dummy-generic/node-src/exports.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const AdmZip = require('adm-zip');
const { machineIdSync } = require('node-machine-id');
const https = require('follow-redirects').https;
const fs = require('fs-extra');

module.exports = {
AdmZip,
machineIdSync
machineIdSync,
https,
fs
};
138 changes: 132 additions & 6 deletions integration/dummy-generic/node-src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion integration/dummy-generic/node-src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"dependencies": {
"adm-zip": "^0.5.10",
"node-machine-id": "^1.1.12"
"debug": "^4.3.4",
"follow-redirects": "^1.15.4",
"fs-extra": "^11.2.0",
"node-machine-id": "^1.1.12",
"original-fs": "^1.2.0"
},
"devDependencies": {
"webpack": "^5.89.0",
Expand Down
7 changes: 4 additions & 3 deletions integration/dummy-generic/node-src/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const path = require('path');

module.exports = {
entry: './exports.js',
output: {
filename: '../node-dist/exports.js',
path: __dirname,
library: 'WppusAPIModules',
libraryTarget: 'umd',
},
target: 'node'
target: 'node',
mode: 'production',
};
Loading

0 comments on commit ae7f45e

Please sign in to comment.