diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 8fcfbdc2..2a5f5665 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -21,6 +21,11 @@ jobs: uses: actions/checkout@v2 with: ref: refs/pull/${{ github.event.issue.number }}/head + - run: npm i -g pnpm + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: "pnpm" - name: Install Global Dependencies run: npm install --global vercel pnpm - name: Pull Vercel Environment Information diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 00000000..ae01d42f --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,16 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + video: false, + chromeWebSecurity: false, + e2e: { + // We've imported your old cypress plugins here. + // You may want to clean this up later by importing these. + setupNodeEvents(on, config) { + return require('./cypress/plugins/index.js')(on, config) + }, + baseUrl: 'http://localhost:8080', + specPattern: 'cypress/e2e/**/*.spec.ts', + excludeSpecPattern: ['**/__snapshots__/*', '**/__image_snapshots__/*'], + }, +}) diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 63bfb351..00000000 --- a/cypress.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/cypress-io/cypress/188b9a742ee2ef51102167bfd84b3696a3f72a26/cli/schema/cypress.schema.json", - "baseUrl": "http://localhost:8080", - "testFiles": "**/*.spec.ts", - "video": false, - "chromeWebSecurity": false, - "ignoreTestFiles": [ - "**/__snapshots__/*", - "**/__image_snapshots__/*" - ] -} diff --git a/cypress/integration/__image_snapshots__/superflat-world #0.png b/cypress/e2e/__image_snapshots__/superflat-world #0.png similarity index 100% rename from cypress/integration/__image_snapshots__/superflat-world #0.png rename to cypress/e2e/__image_snapshots__/superflat-world #0.png diff --git a/cypress/integration/__image_snapshots__/superflat-world #1.png b/cypress/e2e/__image_snapshots__/superflat-world #1.png similarity index 100% rename from cypress/integration/__image_snapshots__/superflat-world #1.png rename to cypress/e2e/__image_snapshots__/superflat-world #1.png diff --git a/cypress/integration/__image_snapshots__/superflat-world #2.png b/cypress/e2e/__image_snapshots__/superflat-world #2.png similarity index 100% rename from cypress/integration/__image_snapshots__/superflat-world #2.png rename to cypress/e2e/__image_snapshots__/superflat-world #2.png diff --git a/cypress/integration/index.spec.ts b/cypress/e2e/index.spec.ts similarity index 100% rename from cypress/integration/index.spec.ts rename to cypress/e2e/index.spec.ts diff --git a/cypress/support/index.js b/cypress/support/e2e.js similarity index 100% rename from cypress/support/index.js rename to cypress/support/e2e.js diff --git a/package.json b/package.json index 8d6bfbf6..881be9cc 100644 --- a/package.json +++ b/package.json @@ -62,11 +62,11 @@ "node-gzip": "^1.1.2", "peerjs": "^1.5.0", "pretty-bytes": "^6.1.1", + "prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything", "prosemirror-example-setup": "^1.2.2", "prosemirror-markdown": "^1.12.0", "prosemirror-state": "^1.4.3", "prosemirror-view": "^1.33.1", - "prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything", "qrcode.react": "^3.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -103,7 +103,7 @@ "constants-browserify": "^1.0.0", "contro-max": "^0.1.1", "crypto-browserify": "^3.12.0", - "cypress": "^9.5.4", + "cypress": "^10.11.0", "cypress-esbuild-preprocessor": "^1.0.2", "eslint": "^8.50.0", "eslint-config-zardoy": "^0.2.17", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 759690ff..483f0277 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,7 +68,7 @@ importers: version: 2.8.5 cypress-plugin-snapshots: specifier: ^1.4.4 - version: 1.4.4(cypress@9.5.4) + version: 1.4.4(cypress@10.11.0) debug: specifier: ^4.3.4 version: 4.3.4(supports-color@8.1.1) @@ -246,8 +246,8 @@ importers: specifier: ^3.12.0 version: 3.12.0 cypress: - specifier: ^9.5.4 - version: 9.5.4 + specifier: ^10.11.0 + version: 10.11.0 cypress-esbuild-preprocessor: specifier: ^1.0.2 version: 1.0.2 @@ -5357,7 +5357,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 20.8.10 + '@types/node': 20.11.19 optional: true /@typescript-eslint/eslint-plugin@6.1.0(@typescript-eslint/parser@6.7.3)(eslint@8.50.0)(typescript@5.2.2): @@ -6621,7 +6621,6 @@ packages: function-bind: 1.1.2 get-intrinsic: 1.2.4 set-function-length: 1.2.1 - dev: true /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -7223,13 +7222,13 @@ packages: resolution: {integrity: sha512-JsFnm6fBQt/OEzstknJ1KLMTuUERUaG0ZB9fk0KdNUlZqxaVEoQ9/pFvKmqRfzUe2y00cWD++ptccQA4tNAAlQ==} dev: true - /cypress-plugin-snapshots@1.4.4(cypress@9.5.4): + /cypress-plugin-snapshots@1.4.4(cypress@10.11.0): resolution: {integrity: sha512-rijq3RTEZNtxQA4KCUwjXinmE1Ww+z6cQW0B14iodFM/HlX5LN16XT/2QS3X1nUXRKt0QdTrAC5MQfMUrjBkSQ==} engines: {node: '>=8.2.1'} peerDependencies: cypress: ^4.5.0 dependencies: - cypress: 9.5.4 + cypress: 10.11.0 diff2html: 2.12.2 fs-extra: 7.0.1 image-size: 0.7.5 @@ -7251,8 +7250,8 @@ packages: - utf-8-validate dev: false - /cypress@9.5.4: - resolution: {integrity: sha512-6AyJAD8phe7IMvOL4oBsI9puRNOWxZjl8z1lgixJMcgJ85JJmyKeP6uqNA0dI1z14lmJ7Qklf2MOgP/xdAqJ/Q==} + /cypress@10.11.0: + resolution: {integrity: sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true @@ -7276,7 +7275,7 @@ packages: dayjs: 1.11.9 debug: 4.3.4(supports-color@8.1.1) enquirer: 2.4.1 - eventemitter2: 6.4.9 + eventemitter2: 6.4.7 execa: 4.1.0 executable: 4.1.1 extract-zip: 2.0.1(supports-color@8.1.1) @@ -7294,7 +7293,7 @@ packages: pretty-bytes: 5.6.0 proxy-from-env: 1.0.0 request-progress: 3.0.0 - semver: 7.5.4 + semver: 7.6.0 supports-color: 8.1.1 tmp: 0.2.1 untildify: 4.0.0 @@ -7458,7 +7457,6 @@ packages: es-define-property: 1.0.0 es-errors: 1.3.0 gopd: 1.0.1 - dev: true /define-lazy-prop@2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} @@ -7999,12 +7997,10 @@ packages: engines: {node: '>= 0.4'} dependencies: get-intrinsic: 1.2.4 - dev: true /es-errors@1.3.0: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - dev: true /es-iterator-helpers@1.0.17: resolution: {integrity: sha512-lh7BsUqelv4KUbR5a/ZTaGGIMLCjPGPqJ6q+Oq24YP0RdyptX1uzm4vvaqzk7Zx3bpl/76YLTTDj9L7uYQ92oQ==} @@ -8624,8 +8620,8 @@ packages: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} - /eventemitter2@6.4.9: - resolution: {integrity: sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==} + /eventemitter2@6.4.7: + resolution: {integrity: sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==} /eventemitter3@4.0.7: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} @@ -9096,7 +9092,6 @@ packages: /function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - dev: true /function.prototype.name@1.1.6: resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} @@ -9170,7 +9165,6 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 hasown: 2.0.1 - dev: true /get-nonce@1.0.1: resolution: {integrity: sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==} @@ -9466,7 +9460,6 @@ packages: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} dependencies: es-define-property: 1.0.0 - dev: true /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} @@ -9520,7 +9513,6 @@ packages: engines: {node: '>= 0.4'} dependencies: function-bind: 1.1.2 - dev: true /he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} @@ -11792,7 +11784,6 @@ packages: /object-inspect@1.13.1: resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - dev: true /object-is@1.1.5: resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} @@ -12751,7 +12742,6 @@ packages: /punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - dev: false /puppeteer-core@2.1.1: resolution: {integrity: sha512-n13AWriBMPYxnpbb6bnaY5YoY6rGj8vPLrz6CZF3o0qJNEwlcfJVxBzYZ0NJsQ21UbdJoijPCDrM++SUVEz7+w==} @@ -12785,7 +12775,7 @@ packages: resolution: {integrity: sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==} engines: {node: '>=0.6'} dependencies: - side-channel: 1.0.4 + side-channel: 1.0.5 /qs@6.11.0: resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} @@ -13705,7 +13695,6 @@ packages: get-intrinsic: 1.2.4 gopd: 1.0.1 has-property-descriptors: 1.0.2 - dev: true /set-function-name@2.0.1: resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} @@ -13797,7 +13786,6 @@ packages: es-errors: 1.3.0 get-intrinsic: 1.2.4 object-inspect: 1.13.1 - dev: true /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -14607,7 +14595,7 @@ packages: engines: {node: '>=6'} dependencies: psl: 1.9.0 - punycode: 2.3.0 + punycode: 2.3.1 universalify: 0.2.0 url-parse: 1.5.10 diff --git a/src/loadSave.ts b/src/loadSave.ts index 965b1a7c..a707da4d 100644 --- a/src/loadSave.ts +++ b/src/loadSave.ts @@ -6,7 +6,7 @@ import { proxy } from 'valtio' import { gzip } from 'node-gzip' import { options } from './optionsStorage' import { nameToMcOfflineUUID, disconnect } from './flyingSquidUtils' -import { forceCachedDataPaths, forceRedirectPaths, mkdirRecursive } from './browserfs' +import { existsViaStats, forceCachedDataPaths, forceRedirectPaths, mkdirRecursive } from './browserfs' import { isMajorVersionGreater } from './utils' import { activeModalStacks, insertActiveModalStack, miscUiState } from './globalState' @@ -154,7 +154,9 @@ export const loadSave = async (root = '/world') => { // improve compatibility with community saves const rootRemapFiles = ['Warp files'] for (const rootRemapFile of rootRemapFiles) { - forceRedirectPaths[path.join(root, rootRemapFile)] = path.join(root, '..', rootRemapFile) + if (await existsViaStats(path.join(root, '..', rootRemapFile))) { + forceRedirectPaths[path.join(root, rootRemapFile)] = path.join(root, '..', rootRemapFile) + } } // todo reimplement diff --git a/src/react/Notification.tsx b/src/react/Notification.tsx index 6ebd49e2..0f3a6325 100644 --- a/src/react/Notification.tsx +++ b/src/react/Notification.tsx @@ -36,7 +36,7 @@ export default ({ type = 'message', message, subMessage = '', open, icon = '', a position: 'fixed', top: 0, right: 0, - width: '160px', + width: '155px', whiteSpace: 'nowrap', fontSize: '9px', display: 'flex', @@ -45,7 +45,7 @@ export default ({ type = 'message', message, subMessage = '', open, icon = '', a padding: '3px 8px', background: isError ? 'rgba(255, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0.7)', borderRadius: '0 0 0 5px', - pointerEvents: action ? 'auto' : 'none', + pointerEvents: action ? '' : 'none', zIndex: 1200, // even above stats ...addStyles }}> diff --git a/src/react/NotificationProvider.tsx b/src/react/NotificationProvider.tsx index 2f27a595..e5ceb0b3 100644 --- a/src/react/NotificationProvider.tsx +++ b/src/react/NotificationProvider.tsx @@ -40,7 +40,7 @@ export const hideNotification = () => { } export default () => { - const { autoHide, message, open, icon, type, subMessage } = useSnapshot(notificationProxy) + const { autoHide, message, open, icon, type, subMessage, action } = useSnapshot(notificationProxy) useEffect(() => { if (autoHide && open) { @@ -58,6 +58,7 @@ export default () => { // }, []) return { return
{ + // arrow down/up, Enter to navigate between lines + if (isWysiwyg) return // todo let { code } = e if ((e.target as HTMLElement).matches('input') && e.key === 'Enter') code = 'ArrowDown' if (code === 'ArrowDown' || code === 'ArrowUp') {