Skip to content

Commit

Permalink
Update version to 2.0.2 + misc client side fixes
Browse files Browse the repository at this point in the history
- Use python instead of python3 in scripts for compatability with WSL
- Use grep in precommit because of non-recursive wildcard behavior
- Add more information to verbose log to debug on-going issues.
  • Loading branch information
MattWiethoff committed Jul 15, 2022
1 parent 96d1ae2 commit ea0486c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ then
exit 1
fi

changed=$(git diff --cached --name-only --diff-filter=ACMR "*.java" "*.ts" "*.css")
changed=$(git diff --cached --name-only --diff-filter=ACMR | grep -P "\.(java|ts|css)$")
for f in ${changed[@]} ; do
echo "Formatting $f..."
prettier --write "$f" &>/dev/null
git add "$f"
done

changed=$(git diff --cached --name-only --diff-filter=ACMR "*.py")
changed=$(git diff --cached --name-only --diff-filter=ACMR | grep -P "\.py$")
for f in ${changed[@]} ; do
echo "Formatting $f..."
black -l 100 "$f" &>/dev/null
Expand Down
2 changes: 1 addition & 1 deletion client/bin/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python

import os.path
import subprocess
Expand Down
4 changes: 2 additions & 2 deletions client/bin/dev.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python

import os
import subprocess
Expand All @@ -7,7 +7,7 @@
os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))

if len(sys.argv) == 1:
subprocess.check_call("python3 ./bin/build.py", shell=True)
subprocess.check_call("python ./bin/build.py", shell=True)

env = {**os.environ, **{"npm_config_arch": "x64"}}
subprocess.check_call("npm run dev", env=env, shell=True)
4 changes: 2 additions & 2 deletions client/package-lock.json

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

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Serenade",
"productName": "Serenade",
"version": "2.0.1",
"version": "2.0.2",
"author": "Serenade Labs, Inc. <contact@serenade.ai>",
"description": "Code with voice. Learn more at https://serenade.ai",
"license": "MIT",
Expand Down
8 changes: 8 additions & 0 deletions client/src/main/ipc/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ export default class Local {
this.started = true;
this.killAll();
this.pollUntilRunning();

let speechEngineModels = path.join(__dirname, "..", "static", "local", "speech-engine-models");
this.log.logVerbose("Initial speech engine model path: " + speechEngineModels);

let codeEngineModels = path.join(__dirname, "..", "static", "local", "code-engine-models");
this.log.logVerbose("Initial code engine model path: " + codeEngineModels);

if (os.platform() == "win32") {
speechEngineModels =
"/" +
Expand All @@ -140,6 +145,8 @@ export default class Local {
])
.stdout.toString()
.trim();
this.log.logVerbose("WSL speech engine path: " + speechEngineModels);

codeEngineModels =
"/" +
child_process
Expand All @@ -150,6 +157,7 @@ export default class Local {
])
.stdout.toString()
.trim();
this.log.logVerbose("WSL code engine path: " + codeEngineModels);
}

// here and below: WSL doesn't deal well with paths, so set the cwd to be the same as the binary
Expand Down
20 changes: 15 additions & 5 deletions client/src/main/ipc/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ export default class IPCServer {
if (request.message == "active") {
let icon = request.data.icon;

const iconValid = (
const iconValid =
icon == undefined ||
(typeof icon == 'string' && icon.startsWith('data:') && icon.length <= maximumIconLength)
);
(typeof icon == "string" &&
icon.startsWith("data:") &&
icon.length <= maximumIconLength);

if (!iconValid) {
this.log.logVerbose('Plugin provided an app icon that does not adhere to requirements');
this.log.logVerbose("Plugin provided an app icon that does not adhere to requirements");
icon = undefined;
}

Expand All @@ -48,7 +49,7 @@ export default class IPCServer {
request.data.id,
request.data.app,
request.data.match,
icon,
icon
);
} else if (request.message == "callback") {
this.pluginManager.resolve(request.data.callback, request.data.data);
Expand All @@ -59,6 +60,15 @@ export default class IPCServer {
}
// custom commands messages from custom commands servers
if (request.message == "customCommands") {
this.log.logVerbose(
"Received " +
request.data.commands.length +
" commands, " +
request.data.hints.length +
" hints, " +
request.data.words.length +
" words"
);
this.active.customCommands = request.data.commands;
this.active.customHints = request.data.hints;
this.active.customWords = request.data.words;
Expand Down

0 comments on commit ea0486c

Please sign in to comment.