-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move kiosk project to pxt repo (#9624)
* Move kiosk to pxt repo * sync latest kiosk changes from arcade repo * Move kiosk config files to arcade docs * kiosk updates * update GameDataUrl * comment missing icon resources * disable eslint, for now * fix code scan warning
- Loading branch information
1 parent
d39643e
commit 3854acb
Showing
60 changed files
with
30,188 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DISABLE_ESLINT_PLUGIN=true | ||
GENERATE_SOURCEMAP=false | ||
BROWSER=none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.vscode | ||
build | ||
!package-lock.json | ||
src/Fonts.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Kiosk | ||
|
||
## config.json settings | ||
|
||
These settings apply only to the kiosk user experience and do not impact sim gameplay. It's assumed all gamepads use the same configuration. | ||
|
||
|Key|Purpose| | ||
|---------------------------------|-| | ||
|GameDataUrl | Path to the game data JSON file with details about the games to include.| | ||
|PlayUrlRoot | Left part of the embedded player URL up to and including --run.| | ||
|HighScoresToKeep | The maximum number of high scores to keep for a given game.| | ||
|HighScoreInitialsLength | The number of initials to allow users to enter.| | ||
|HighScoreInitialAllowedCharacters| The list and order of characters to allow in high scores.| | ||
|GamepadPollLoopMilli | How often the gamepads are polled for user interaction with the kiosk menus and other inputs. If this is too large, actions may be missed, such as a quick button press. If it's too small, then a single action may be interpretted as multiple (like a single button press counting twice).| | ||
|GamepadCacheMilli | How often the gamepad state is cached. Since multiple components access the browser's Navigator.getGamepads() API, we use a caching mechanism to optimize how often they're accessed. This value should be smaller than the gamepad polling loop.| | ||
|GamepadAButtonPin | The pin index for the A button. | | ||
|GamepadBButtonPin | The pin index for the B button.| | ||
|GamepadEscapeButtonPin | The pin index for the Escape button. This button leaves a game without waiting and returns the user to the menu.| | ||
|GamepadResetButtonPin | The pin index for the Reset button.| | ||
|GamepadMenuButtonPin | The pin index for the Menu button. Note that since this menu is used by games, it does not return the user to the kiosk menu. | | ||
|GamepadLeftRightAxis | The gamepad axis index for left/right detection.| | ||
|GamepadLeftRightThreshold | The threshold to detect for a "right" action. It's negated to detect "left" actions.| | ||
|GamepadUpDownAxis | The gamepad axis index for up/down detection.| | ||
|GamepadUpDownThreshold | The threshold to detect for a "down" action. It's negated to detect "up" actions.| | ||
|Keyboard`Input`Keys | Each is an array of string arrays matching the browser keys that map to the target behavior. The index of a list maps to the same gamepad index (player 1 is the first array at index 0, etc.) | | ||
|
||
## Localhost testing | ||
|
||
To test Kiosk locally: | ||
|
||
1. Ensure your pxt repo is up to date and has been built recently. | ||
2. In a command shell, in the `pxt` repo, cd into the `kiosk` folder and start the Kiosk dev server: `npm run start`. This will *not* open a browser window. | ||
3. In another command shell, in the `pxt-arcade` repo, start the Arcade dev server: `pxt serve --rebundle`. This will open the Arcade webapp in a browser. | ||
|
||
Requests to the `/kiosk` endpoint will be routed to the Kiosk dev server. | ||
|
||
Debug and step through Kiosk code using the browser dev tools (F12 to open). | ||
|
||
|
||
## Test in staging environment | ||
|
||
1. In the pxt repo, run `gulp` to ensure production kiosk is built. | ||
2. In a browser, go to `https://staging.pxt.io/oauth/gettoken`. This should return a url with an auth token embedded. Copy the entire url value to your clipboard. | ||
- It should look something like `https://staging.pxt.io/?access_token=X.XXXXXXXX` | ||
- If you get access denied, contact your manager to help you. | ||
3. In a command shell, set environment variable `PXT_ACCESS_TOKEN` with the copied value. | ||
4. In the same shell, in the pxt-arcade repo, run `pxt uploadtrg --rebundle`. This should return a url to your private build. | ||
- It should look something like `https://arcade.staging.pxt.io/app/XXXXXX-XXXXX` | ||
- Paste in a browser and append "/kiosk". This should take you to your kiosk build in staging. | ||
|
||
## Test in production environment | ||
|
||
Follow the "Test in staging environment" instructions, but get your auth token from `https://makecode.com/oauth/gettoken`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { aliasWebpack } = require("react-app-alias"); | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
|
||
module.exports = function (config, env) { | ||
const isEnvProduction = env === "production"; | ||
const aliasFn = aliasWebpack({}); | ||
config = { | ||
...aliasFn(config), | ||
plugins: [ | ||
...config.plugins.filter((p) => !(p instanceof HtmlWebpackPlugin)), | ||
new HtmlWebpackPlugin( | ||
Object.assign( | ||
{}, | ||
{ | ||
inject: true, | ||
template: "./public/index.html", | ||
}, | ||
isEnvProduction | ||
? { | ||
minify: { | ||
removeComments: false, | ||
collapseWhitespace: false, | ||
removeRedundantAttributes: true, | ||
useShortDoctype: true, | ||
removeEmptyAttributes: true, | ||
removeStyleLinkTypeAttributes: true, | ||
keepClosingSlash: true, | ||
minifyJS: true, | ||
minifyCSS: true, | ||
minifyURLs: true, | ||
}, | ||
} | ||
: undefined | ||
) | ||
), | ||
], | ||
module: { | ||
...config.module, | ||
rules: config.module.rules.filter(el => !(el.use && el.use.some(item => !!(item.options && item.options.eslintPath)))), | ||
} | ||
}; | ||
return config; | ||
}; |
Oops, something went wrong.