diff --git a/lib/depject/page/html/render/chess.js b/lib/depject/page/html/render/chess.js index 66496003..d0329fef 100644 --- a/lib/depject/page/html/render/chess.js +++ b/lib/depject/page/html/render/chess.js @@ -1,6 +1,7 @@ const { h } = require("mutant"); const nest = require("depnest"); const SsbChessDataAccess = require("ssb-chess-data-access"); +const {FlumeViewChessIndex} = require('ssb-chess-index'); const SsbChessMithril = require("ssb-chess-mithril"); const { onceTrue, computed } = require("mutant"); const defer = require('pull-defer'); @@ -17,7 +18,9 @@ exports.gives = nest({ function createChess(ssb) { const dataAccess = new SsbChessDataAccess.SbotClassic(ssb); - return SsbChessMithril(dataAccess); + const chessIndex = FlumeViewChessIndex(ssb.patchwork.chessView) + + return SsbChessMithril(chessIndex, dataAccess); } function waitForSbot(api) { diff --git a/lib/plugins/chess-view.js b/lib/plugins/chess-view.js new file mode 100644 index 00000000..6f43618e --- /dev/null +++ b/lib/plugins/chess-view.js @@ -0,0 +1,15 @@ +const { chessFlumeview } = require('ssb-chess-index'); + +exports.manifest = { + get: 'async', + read: 'source' +} + +exports.init = function (ssb) { + const chessFlumeView = ssb._flumeUse('chess-view', chessFlumeview); + + return { + get: chessFlumeView.get, + read: chessFlumeView.read + } +} \ No newline at end of file diff --git a/lib/plugins/index.js b/lib/plugins/index.js index f297dee9..c1ae21e5 100644 --- a/lib/plugins/index.js +++ b/lib/plugins/index.js @@ -25,6 +25,7 @@ const plugins = { contacts: require("./contacts.js"), blogs: require("./blogs.js"), books: require("./books.js"), + chessView: require('./chess-view.js'), // notify notifier: require("./notifier.js"), }; diff --git a/package-lock.json b/package-lock.json index 93444231..efb9622b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ssb-ponchowonky", - "version": "5.7.0", + "version": "5.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ssb-ponchowonky", - "version": "5.7.0", + "version": "5.7.1", "license": "AGPL-3.0", "dependencies": { "@electron/remote": "^2.1.3", @@ -79,7 +79,8 @@ "ssb-blobs": "^2.0.1", "ssb-book-schema": "^1.0.3", "ssb-chess-data-access": "^2.1.4", - "ssb-chess-mithril": "3.0.1", + "ssb-chess-index": "3.1.0", + "ssb-chess-mithril": "4.1.1", "ssb-client": "^4.9.0", "ssb-config": "^3.4.4", "ssb-conn": "~1.0.0", @@ -832,6 +833,49 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@happy0/flumeview-level-custom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@happy0/flumeview-level-custom/-/flumeview-level-custom-3.0.0.tgz", + "integrity": "sha512-oAIY0ZAuGaq7VRw+7ANoBnVQHHBoacN0fBjor20MfPlJPUL4dXO8YsyuE2vhPhn/vCeFLqcX7NPSOw8ghVykPw==", + "license": "MIT", + "dependencies": { + "charwise": "^3.0.1", + "level": "^10.0.0", + "level-read-stream": "^2.0.0", + "ltgt": "^2.2.1", + "obv": "^0.0.1", + "pull-level": "^2.0.4", + "pull-live": "^1.0.1", + "pull-pushable": "^2.2.0", + "pull-stream": "^3.7.0", + "pull-write": "^1.1.4", + "stream-to-pull-stream": "^1.7.3" + } + }, + "node_modules/@happy0/flumeview-level-custom/node_modules/level": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/level/-/level-10.0.0.tgz", + "integrity": "sha512-aZJvdfRr/f0VBbSRF5C81FHON47ZsC2TkGxbBezXpGGXAUEL/s6+GP73nnhAYRSCIqUNsmJjfeOF4lzRDKbUig==", + "license": "MIT", + "dependencies": { + "abstract-level": "^3.1.0", + "browser-level": "^3.0.0", + "classic-level": "^3.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/level" + } + }, + "node_modules/@happy0/flumeview-level-custom/node_modules/pull-stream": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.7.0.tgz", + "integrity": "sha512-Eco+/R004UaCK2qEDE8vGklcTG2OeZSVm1kTUQNrykEjDwcFXDZhygFDsW49DbXyJMEhHeRL3z5cRVqPAhXlIw==", + "license": "MIT" + }, "node_modules/@iarna/toml": { "version": "2.2.5", "license": "ISC" @@ -1258,6 +1302,68 @@ "node": "^20.17.0 || >=22.9.0" } }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/abstract-level": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-3.1.1.tgz", + "integrity": "sha512-CW2gKbJFTuX1feMvOrvsVMmijAOgI9kg2Ie9Dq3gOcMt/dVVoVmqNlLcEUCT13NxHFMEajcUcVBIplbyDroDiw==", + "license": "MIT", + "dependencies": { + "buffer": "^6.0.3", + "is-buffer": "^2.0.5", + "level-supports": "^6.2.0", + "level-transcoder": "^1.0.1", + "maybe-combine-errors": "^1.0.0", + "module-error": "^1.0.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/abstract-level/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/abstract-level/node_modules/level-supports": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-6.2.0.tgz", + "integrity": "sha512-QNxVXP0IRnBmMsJIh+sb2kwNCYcKciQZJEt+L1hPCHrKNELllXhvrlClVHXBYZVT+a7aTSM6StgNXdAldoab3w==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, "node_modules/abstract-leveldown": { "version": "6.0.3", "license": "MIT", @@ -2691,6 +2797,15 @@ "broadcast-stream": "bin.js" } }, + "node_modules/browser-level": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/browser-level/-/browser-level-3.0.0.tgz", + "integrity": "sha512-kGXtLh29jMwqKaskz5xeDLtCtN1KBz/DbQSqmvH7QdJiyGRC7RAM8PPg6gvUiNMa+wVnaxS9eSmEtP/f5ajOVw==", + "license": "MIT", + "dependencies": { + "abstract-level": "^3.1.0" + } + }, "node_modules/browser-split": { "version": "0.0.1", "license": "MIT" @@ -3308,6 +3423,39 @@ "indexof": "0.0.1" } }, + "node_modules/classic-level": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/classic-level/-/classic-level-3.0.0.tgz", + "integrity": "sha512-yGy8j8LjPbN0Bh3+ygmyYvrmskVita92pD/zCoalfcC9XxZj6iDtZTAnz+ot7GG8p9KLTG+MZ84tSA4AhkgVZQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "abstract-level": "^3.1.0", + "module-error": "^1.0.1", + "napi-macros": "^2.2.2", + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/classic-level/node_modules/napi-macros": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", + "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==", + "license": "MIT" + }, + "node_modules/classic-level/node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/cli-truncate": { "version": "2.1.0", "license": "MIT", @@ -5738,6 +5886,24 @@ "es5-ext": "~0.10.14" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/execa": { "version": "0.5.1", "license": "MIT", @@ -7260,6 +7426,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/is-callable": { "version": "1.1.4", "license": "MIT", @@ -7978,6 +8167,95 @@ "ltgt": "^2.1.2" } }, + "node_modules/level-read-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/level-read-stream/-/level-read-stream-2.0.0.tgz", + "integrity": "sha512-9TQl3pThIoFMrA2PWwoM1D/fkQgy/ynmA4vmg+EA3oxOxp+DlIKJT5glvGg37m9HL7/MKZTWn2iYfM4kYOy1Ig==", + "license": "MIT", + "dependencies": { + "readable-stream": "^4.6.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "abstract-level": ">=2.0.0" + }, + "peerDependenciesMeta": { + "abstract-level": { + "optional": true + } + } + }, + "node_modules/level-read-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/level-read-stream/node_modules/readable-stream": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.8.0.tgz", + "integrity": "sha512-2jhTTU3Eilp/2DMT71gbcoqC35eQHasMJH0RHkYxwlxIv3+FR6Y5xAFZIwEGLxKkjZYEFlsiMNIdwUqjK2lLHQ==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/level-read-stream/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/level-read-stream/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/level-supports": { "version": "1.0.0", "license": "MIT", @@ -7988,6 +8266,43 @@ "node": ">=6" } }, + "node_modules/level-transcoder": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", + "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", + "license": "MIT", + "dependencies": { + "buffer": "^6.0.3", + "module-error": "^1.0.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/level-transcoder/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/leveldown": { "version": "5.6.0", "hasInstallScript": true, @@ -8289,6 +8604,15 @@ "node": ">= 0.4" } }, + "node_modules/maybe-combine-errors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/maybe-combine-errors/-/maybe-combine-errors-1.0.0.tgz", + "integrity": "sha512-eefp6IduNPT6fVdwPp+1NgD0PML1NU5P6j1Mj5nz1nidX8/sWY7119WL8vTAHgqfsY74TzW0w1XPgdYEKkGZ5A==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/md5.js": { "version": "1.3.5", "license": "MIT", @@ -8494,6 +8818,15 @@ "node": ">=0.10.0" } }, + "node_modules/module-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", + "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/moment": { "version": "2.29.1", "license": "MIT", @@ -10251,6 +10584,15 @@ "node": "^20.17.0 || >=22.9.0" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "license": "MIT" @@ -12188,9 +12530,9 @@ "license": "CC0-1.0" }, "node_modules/ssb-chess": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/ssb-chess/-/ssb-chess-4.0.9.tgz", - "integrity": "sha512-6feAw6Vkxt2uO9uV7pzlHIToOQz/39gaY5Fu1bKFXRrHbfmvJ4aCB1IwL/tMyO1vYe+dP/kcEgdUS/RNpSPwzA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/ssb-chess/-/ssb-chess-5.1.1.tgz", + "integrity": "sha512-lq3H/yP3WE6zZvcuBhRkzLRYaUvqMRHvSp7C/z3FuebSekNDonsDYyuAGcyqVxqeCveO7DPttz77lzliRkfNYA==", "license": "GPL-2.0", "dependencies": { "bluebird": "^3.7.2", @@ -12207,7 +12549,6 @@ "pull-resolve": "^1.2.0", "pull-scan": "^1.0.0", "pull-stream": "^3.6.14", - "ssb-chess-index": "2.0.0", "tiny-worker": "2.3.0" } }, @@ -12227,20 +12568,21 @@ } }, "node_modules/ssb-chess-index": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ssb-chess-index/-/ssb-chess-index-2.0.0.tgz", - "integrity": "sha512-BlILk0XjGFqqeKpBFbayKCHZ+pVWNZInv0mSt6SEqQpK1rUnDCnJlrWox8ajb5yXc8xJz24bupd9MUVK/y1D1Q==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ssb-chess-index/-/ssb-chess-index-3.1.0.tgz", + "integrity": "sha512-TCo4TEtAw/5pzbu0sIU0oWXeD9KO+qEao8F/UtYTGsdxGsCQoMAdzkkRE0AuAQf7AL5Ou8d7ba+U/gzsyO2bLg==", "license": "MIT", "dependencies": { + "@happy0/flumeview-level-custom": "3.0.0", "pull-many": "^1.0.9", "pull-scan": "^1.0.0", "pull-stream": "^3.6.14" } }, "node_modules/ssb-chess-mithril": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ssb-chess-mithril/-/ssb-chess-mithril-3.0.1.tgz", - "integrity": "sha512-AvZUoV3sfOpPLItYKserryzYUpyZ8ZmEQ+4LDWtenuLXPiN4cU+rLfr7VN9j3X/bdn6WTTaLCepE+xIR0Cl7SQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ssb-chess-mithril/-/ssb-chess-mithril-4.1.1.tgz", + "integrity": "sha512-wyLuR3LrryeR1/oSSeGShKhaid/a5bvVa9oq3VKo817ltIG5XNSArhgSenQH3F6kVn9nfeNyWTY9boH8PaoVtw==", "license": "GPL-3.0", "dependencies": { "@lichess-org/chessground": "^10.4.2", @@ -12253,7 +12595,7 @@ "pull-scroll": "^1.0.9", "pull-stream": "^3.6.14", "ramda": "^0.25.0", - "ssb-chess": "4.0.9", + "ssb-chess": "5.1.1", "ssb-embedded-chat": "2.0.2" } }, diff --git a/package.json b/package.json index 7859526d..216d0b2a 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,8 @@ "ssb-blobs": "^2.0.1", "ssb-book-schema": "^1.0.3", "ssb-chess-data-access": "^2.1.4", - "ssb-chess-mithril": "3.0.1", + "ssb-chess-index": "3.1.0", + "ssb-chess-mithril": "4.1.1", "ssb-client": "^4.9.0", "ssb-config": "^3.4.4", "ssb-conn": "~1.0.0", @@ -137,4 +138,4 @@ "overrides": { "epidemic-broadcast-trees": "soapdog/epidemic-broadcast-trees#068dd5347c68a40c6d7cefb913cbaa53c20c5464" } -} \ No newline at end of file +}