forked from cory/tildefriends
Compare commits
10 Commits
cbe1f54a2a
...
5e72c9caf4
Author | SHA1 | Date | |
---|---|---|---|
5e72c9caf4 | |||
71329c5532 | |||
feb4bf9e87 | |||
5d5567e94c | |||
684e6fb9cb | |||
ee21fa6d03 | |||
7a2974e54f | |||
f4dfc1dd98 | |||
2eebfa9a7a | |||
10097ffeb8 |
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
@ -0,0 +1 @@
|
||||
make format || exit 0
|
@ -2,6 +2,7 @@ node_modules
|
||||
src
|
||||
deps
|
||||
.clang-format
|
||||
flake.lock
|
||||
|
||||
# Minified files
|
||||
**/*.min.css
|
||||
|
@ -3,9 +3,9 @@
|
||||
MAKEFLAGS += --warn-undefined-variables
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
VERSION_CODE := 19
|
||||
VERSION_NUMBER := 0.0.19-wip
|
||||
VERSION_NAME := Don't let your loyalty become a burden.
|
||||
VERSION_CODE := 20
|
||||
VERSION_NUMBER := 0.0.20-wip
|
||||
VERSION_NAME := One word all lowercase four words all uppercase.
|
||||
|
||||
SQLITE_URL := https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip
|
||||
LIBUV_URL := https://dist.libuv.org/dist/v1.48.0/libuv-v1.48.0.tar.gz
|
||||
@ -902,7 +902,7 @@ dist-test: dist
|
||||
@rm -rf tildefriends-$(VERSION_NUMBER)
|
||||
.PHONY: dist-test
|
||||
|
||||
format:
|
||||
format: prettier
|
||||
@clang-format -i $(wildcard src/*.c src/*.h src/*.m)
|
||||
.PHONY: format
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "tildefriends-app",
|
||||
"emoji": "🐌",
|
||||
"previous": "&YhfwSB0+2jmPcHlxOXN73/81H5VEyQ1MaTJmWZbwqHU=.sha256"
|
||||
"previous": "&zRv7YNZBT/NoliiTS7Jn/Q+3przdFZljUl8yPBIpSSE=.sha256"
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as tfrpc from '/static/tfrpc.js';
|
||||
import {html, render} from './lit-all.min.js';
|
||||
import {styles} from './tf-styles.js';
|
||||
|
||||
let g_emojis;
|
||||
|
||||
@ -36,11 +38,6 @@ export async function picker(callback, anchor, author) {
|
||||
div.style.background = '#fff';
|
||||
div.style.border = '1px solid #000';
|
||||
div.style.display = 'block';
|
||||
div.style.position = 'absolute';
|
||||
div.style.minWidth = 'min(16em, 90vw)';
|
||||
div.style.width = 'min(16em, 90vw)';
|
||||
div.style.maxWidth = 'min(16em, 90vw)';
|
||||
div.style.maxHeight = '16em';
|
||||
div.style.overflow = 'scroll';
|
||||
div.style.fontWeight = 'bold';
|
||||
div.style.fontSize = 'xx-large';
|
||||
@ -58,14 +55,6 @@ export async function picker(callback, anchor, author) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
function cleanup() {
|
||||
console.log('emoji cleanup');
|
||||
div.parentElement.removeChild(div);
|
||||
window.removeEventListener('keydown', key_down);
|
||||
console.log('removing click');
|
||||
document.body.removeEventListener('mousedown', cleanup);
|
||||
}
|
||||
|
||||
function key_down(event) {
|
||||
if (event.key == 'Escape') {
|
||||
cleanup();
|
||||
@ -153,13 +142,23 @@ export async function picker(callback, anchor, author) {
|
||||
}
|
||||
refresh();
|
||||
input.oninput = refresh;
|
||||
document.body.appendChild(div);
|
||||
div.style.position = 'fixed';
|
||||
div.style.top = '50%';
|
||||
div.style.left = '50%';
|
||||
div.style.transform = 'translate(-50%, -50%)';
|
||||
let modal = html`
|
||||
<style>
|
||||
${styles}
|
||||
</style>
|
||||
<div class="w3-modal" style="display: block">
|
||||
<div class="w3-modal-content w3-card-4">${div}</div>
|
||||
</div>
|
||||
`;
|
||||
let parent = document.createElement('div');
|
||||
document.body.appendChild(parent);
|
||||
function cleanup() {
|
||||
parent.parentElement.removeChild(parent);
|
||||
window.removeEventListener('keydown', key_down);
|
||||
document.body.removeEventListener('mousedown', cleanup);
|
||||
}
|
||||
render(modal, parent);
|
||||
input.focus();
|
||||
console.log('adding click');
|
||||
document.body.addEventListener('mousedown', cleanup);
|
||||
window.addEventListener('keydown', key_down);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ let gEditor;
|
||||
let gOriginalInput;
|
||||
|
||||
let kErrorColor = '#dc322f';
|
||||
let kDisconnectColor = '#f00';
|
||||
let kStatusColor = '#fff';
|
||||
|
||||
// Functions that server-side app code can call through the app object.
|
||||
@ -1548,7 +1549,7 @@ function connectSocket(path) {
|
||||
};
|
||||
setStatusMessage(
|
||||
'🔴 Closed: ' + (k_codes[event.code] || event.code),
|
||||
kErrorColor
|
||||
kDisconnectColor
|
||||
);
|
||||
};
|
||||
}
|
||||
|
10
default.nix
10
default.nix
@ -15,24 +15,20 @@
|
||||
# - Build again, this time it should work.
|
||||
# - Check the release notes, if there's a new dependency or a change to `GNUMakefile`, this file might need to be changed too.
|
||||
# For more details, contact tasiaiso @ https://tilde.club/~tasiaiso/
|
||||
#
|
||||
# WARNING: currently it is pinned to `47838d5e482cb4aac40190fa0414f08b8cf94d40`. I couldn't get v0.0.18 to work for some reason.
|
||||
# I'll change this in the next release - tasiaiso
|
||||
{
|
||||
pkgs ? import <nixpkgs> {},
|
||||
lib ? import <nixpkgs/lib>,
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "tildefriends";
|
||||
version = "0.0.19-wip";
|
||||
version = "0.0.19";
|
||||
|
||||
src = pkgs.fetchFromGitea {
|
||||
domain = "dev.tildefriends.net";
|
||||
owner = "cory";
|
||||
repo = "tildefriends";
|
||||
# rev = "v${version}";
|
||||
rev = "47838d5e482cb4aac40190fa0414f08b8cf94d40";
|
||||
hash = "sha256-mb5KYvWPIqgV64FOaXKHm2ownBJiiSRtdH8+YWiXwvE="; # 47838d5e482cb4aac40190fa0414f08b8cf94d40
|
||||
rev = "v${version}";
|
||||
hash = "sha256-ttqL2wz06Jvn2f6kKIAGpF0nSSle+g4nSlj4jL0D+Fk=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
|
2
deps/codemirror/cm6.js
vendored
2
deps/codemirror/cm6.js
vendored
File diff suppressed because one or more lines are too long
146
deps/codemirror_src/package-lock.json
generated
vendored
146
deps/codemirror_src/package-lock.json
generated
vendored
@ -111,9 +111,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lint": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.7.0.tgz",
|
||||
"integrity": "sha512-LTLOL2nT41ADNSCCCCw8Q/UmdAFzB23OUYSjsHTdsVaH0XEo+orhuqbDNWzrzodm14w6FOxqxpmy4LF8Lixqjw==",
|
||||
"version": "6.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.0.tgz",
|
||||
"integrity": "sha512-lsFofvaw0lnPRJlQylNsC4IRt/1lI4OD/yYslrSGVndOJfStc58v+8p9dgGiD90ktOfL7OhBWns1ZETYgz0EJA==",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0",
|
||||
@ -248,9 +248,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/javascript": {
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.4.15.tgz",
|
||||
"integrity": "sha512-B082ZdjI0vo2AgLqD834GlRTE9gwRX8NzHzKq5uDwEnQ9Dq+A/CEhd3nf68tiNA2f9O+8jS1NeSTUYT9IAqcTw==",
|
||||
"version": "1.4.16",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.4.16.tgz",
|
||||
"integrity": "sha512-84UXR3N7s11MPQHWgMnjb9571fr19MmXnr5zTv2XX0gHXXUvW3uPJ8GCjKrfTXmSdfktjRK0ayKklw+A13rk4g==",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.2.0",
|
||||
"@lezer/highlight": "^1.1.3",
|
||||
@ -343,9 +343,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz",
|
||||
"integrity": "sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz",
|
||||
"integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@ -355,9 +355,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm64": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz",
|
||||
"integrity": "sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz",
|
||||
"integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@ -367,9 +367,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz",
|
||||
"integrity": "sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz",
|
||||
"integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@ -379,9 +379,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-x64": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz",
|
||||
"integrity": "sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz",
|
||||
"integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@ -391,9 +391,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz",
|
||||
"integrity": "sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz",
|
||||
"integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@ -403,9 +403,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz",
|
||||
"integrity": "sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz",
|
||||
"integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@ -415,9 +415,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz",
|
||||
"integrity": "sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz",
|
||||
"integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@ -427,9 +427,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz",
|
||||
"integrity": "sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz",
|
||||
"integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@ -439,9 +439,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz",
|
||||
"integrity": "sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz",
|
||||
"integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@ -451,9 +451,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz",
|
||||
"integrity": "sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz",
|
||||
"integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
@ -463,9 +463,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-s390x-gnu": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz",
|
||||
"integrity": "sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz",
|
||||
"integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@ -475,9 +475,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz",
|
||||
"integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz",
|
||||
"integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@ -487,9 +487,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz",
|
||||
"integrity": "sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz",
|
||||
"integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@ -499,9 +499,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz",
|
||||
"integrity": "sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz",
|
||||
"integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@ -511,9 +511,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz",
|
||||
"integrity": "sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz",
|
||||
"integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@ -523,9 +523,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz",
|
||||
"integrity": "sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz",
|
||||
"integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@ -715,9 +715,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz",
|
||||
"integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==",
|
||||
"version": "4.18.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz",
|
||||
"integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.5"
|
||||
},
|
||||
@ -729,22 +729,22 @@
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.17.2",
|
||||
"@rollup/rollup-android-arm64": "4.17.2",
|
||||
"@rollup/rollup-darwin-arm64": "4.17.2",
|
||||
"@rollup/rollup-darwin-x64": "4.17.2",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.17.2",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.17.2",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.17.2",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.17.2",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.17.2",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.17.2",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.17.2",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.17.2",
|
||||
"@rollup/rollup-linux-x64-musl": "4.17.2",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.17.2",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.17.2",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.17.2",
|
||||
"@rollup/rollup-android-arm-eabi": "4.18.0",
|
||||
"@rollup/rollup-android-arm64": "4.18.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.18.0",
|
||||
"@rollup/rollup-darwin-x64": "4.18.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.18.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.18.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.18.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.18.0",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.18.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.18.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.18.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.18.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.18.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.18.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.18.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.18.0",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
|
21
package-lock.json
generated
21
package-lock.json
generated
@ -6,12 +6,29 @@
|
||||
"": {
|
||||
"name": "tildefriends",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prettier": "^3.2.5"
|
||||
"devDependencies": {
|
||||
"husky": "9.0.11",
|
||||
"prettier": "3.2.5"
|
||||
}
|
||||
},
|
||||
"node_modules/husky": {
|
||||
"version": "9.0.11",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz",
|
||||
"integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"husky": "bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/typicode"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.2.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
|
@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "tildefriends",
|
||||
"scripts": {
|
||||
"prettier": "prettier . --check --cache --write"
|
||||
"prettier": "prettier . --check --cache --write",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"author": "Cory McWilliams",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prettier": "^3.2.5"
|
||||
"devDependencies": {
|
||||
"prettier": "3.2.5",
|
||||
"husky": "9.0.11"
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.unprompted.tildefriends"
|
||||
android:versionCode="19"
|
||||
android:versionName="0.0.19-wip">
|
||||
android:versionCode="20"
|
||||
android:versionName="0.0.20-wip">
|
||||
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="34"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
|
49
src/ssb.c
49
src/ssb.c
@ -344,6 +344,7 @@ typedef struct _tf_ssb_connection_t
|
||||
int ref_count;
|
||||
|
||||
int read_back_pressure;
|
||||
int active_write_count;
|
||||
} tf_ssb_connection_t;
|
||||
|
||||
static JSClassID _connection_class_id;
|
||||
@ -460,9 +461,10 @@ static void _tf_ssb_connection_on_tcp_alloc(uv_handle_t* handle, size_t suggeste
|
||||
|
||||
static void _tf_ssb_connection_on_write(uv_write_t* req, int status)
|
||||
{
|
||||
tf_ssb_connection_t* connection = req->data;
|
||||
tf_ssb_connection_adjust_write_count(connection, -1);
|
||||
if (status)
|
||||
{
|
||||
tf_ssb_connection_t* connection = req->data;
|
||||
char buffer[256];
|
||||
snprintf(buffer, sizeof(buffer), "write failed asynchronously: %s", uv_strerror(status));
|
||||
_tf_ssb_connection_close(connection, buffer);
|
||||
@ -477,9 +479,11 @@ static void _tf_ssb_write(tf_ssb_connection_t* connection, void* data, size_t si
|
||||
uv_write_t* write = tf_malloc(sizeof(uv_write_t) + size);
|
||||
*write = (uv_write_t) { .data = connection };
|
||||
memcpy(write + 1, data, size);
|
||||
tf_ssb_connection_adjust_write_count(connection, 1);
|
||||
int result = uv_write(write, (uv_stream_t*)&connection->tcp, &(uv_buf_t) { .base = (char*)(write + 1), .len = size }, 1, _tf_ssb_connection_on_write);
|
||||
if (result)
|
||||
{
|
||||
tf_ssb_connection_adjust_write_count(connection, -1);
|
||||
_tf_ssb_connection_close(connection, "write failed");
|
||||
tf_free(write);
|
||||
}
|
||||
@ -606,6 +610,19 @@ static void _tf_ssb_connection_box_stream_send(tf_ssb_connection_t* connection,
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection)
|
||||
{
|
||||
while ((connection->active_write_count == 0 || connection->closing) && connection->scheduled_count && connection->scheduled)
|
||||
{
|
||||
tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0];
|
||||
memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1));
|
||||
connection->scheduled_count--;
|
||||
tf_trace_begin(connection->ssb->trace, "scheduled callback");
|
||||
scheduled.callback(connection, scheduled.user_data);
|
||||
tf_trace_end(connection->ssb->trace);
|
||||
}
|
||||
}
|
||||
|
||||
void tf_ssb_connection_schedule_idle(tf_ssb_connection_t* connection, tf_ssb_scheduled_callback_t* callback, void* user_data)
|
||||
{
|
||||
connection->scheduled = tf_resize_vec(connection->scheduled, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count + 1));
|
||||
@ -613,7 +630,7 @@ void tf_ssb_connection_schedule_idle(tf_ssb_connection_t* connection, tf_ssb_sch
|
||||
.callback = callback,
|
||||
.user_data = user_data,
|
||||
};
|
||||
uv_async_send(&connection->async);
|
||||
_tf_ssb_connection_dispatch_scheduled(connection);
|
||||
}
|
||||
|
||||
static int _request_compare(const void* a, const void* b)
|
||||
@ -1815,24 +1832,6 @@ JSValue tf_ssb_sign_message(tf_ssb_t* ssb, const char* author, const uint8_t* pr
|
||||
return root;
|
||||
}
|
||||
|
||||
static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connection)
|
||||
{
|
||||
const int k_scheduled_batch_count = 8;
|
||||
for (int i = 0; i < k_scheduled_batch_count && connection->scheduled_count && connection->scheduled; i++)
|
||||
{
|
||||
tf_ssb_connection_scheduled_t scheduled = connection->scheduled[0];
|
||||
memmove(connection->scheduled, connection->scheduled + 1, sizeof(tf_ssb_connection_scheduled_t) * (connection->scheduled_count - 1));
|
||||
connection->scheduled_count--;
|
||||
tf_trace_begin(connection->ssb->trace, "scheduled callback");
|
||||
scheduled.callback(connection, scheduled.user_data);
|
||||
tf_trace_end(connection->ssb->trace);
|
||||
}
|
||||
if (connection->scheduled_count)
|
||||
{
|
||||
uv_async_send(&connection->async);
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const char* reason)
|
||||
{
|
||||
tf_ssb_t* ssb = connection->ssb;
|
||||
@ -1841,10 +1840,7 @@ static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const ch
|
||||
{
|
||||
connection->destroy_reason = reason;
|
||||
}
|
||||
while (connection->scheduled_count)
|
||||
{
|
||||
_tf_ssb_connection_dispatch_scheduled(connection);
|
||||
}
|
||||
tf_free(connection->scheduled);
|
||||
connection->scheduled = NULL;
|
||||
while (connection->requests)
|
||||
@ -2613,7 +2609,6 @@ static void _tf_ssb_connection_process_message_async(uv_async_t* async)
|
||||
{
|
||||
uv_async_send(&connection->async);
|
||||
}
|
||||
_tf_ssb_connection_dispatch_scheduled(connection);
|
||||
}
|
||||
|
||||
tf_ssb_connection_t* tf_ssb_connection_create(tf_ssb_t* ssb, const char* host, const struct sockaddr_in* addr, const uint8_t* public_key)
|
||||
@ -4108,3 +4103,9 @@ void tf_ssb_connection_adjust_read_backpressure(tf_ssb_connection_t* connection,
|
||||
_tf_ssb_connection_destroy(connection, "backpressure released");
|
||||
}
|
||||
}
|
||||
|
||||
void tf_ssb_connection_adjust_write_count(tf_ssb_connection_t* connection, int delta)
|
||||
{
|
||||
connection->active_write_count += delta;
|
||||
_tf_ssb_connection_dispatch_scheduled(connection);
|
||||
}
|
||||
|
11
src/ssb.h
11
src/ssb.h
@ -745,7 +745,7 @@ JSValue tf_ssb_connection_requests_to_object(tf_ssb_connection_t* connection);
|
||||
typedef void(tf_ssb_scheduled_callback_t)(tf_ssb_connection_t* connection, void* user_data);
|
||||
|
||||
/**
|
||||
** Schedule work to be run when the server is next idle.
|
||||
** Schedule work to be run when the connection is next idle.
|
||||
** @param connection The owning connection.
|
||||
** @param callback The callback to call.
|
||||
** @param user_data User data to pass to the callback.
|
||||
@ -1005,4 +1005,13 @@ bool tf_ssb_hmacsha256_verify(const char* public_key, const void* payload, size_
|
||||
*/
|
||||
void tf_ssb_connection_adjust_read_backpressure(tf_ssb_connection_t* connection, int delta);
|
||||
|
||||
/**
|
||||
** Adjust write count. Work scheduled by tf_ssb_connection_schedule_idle will
|
||||
** only start when this reaches zero.
|
||||
** @param connection The connection on which to affect backpressure.
|
||||
** @param delta The change in write count. Higher will pause processing
|
||||
** scheduled idle work queue. Lower will resume it.
|
||||
*/
|
||||
void tf_ssb_connection_adjust_write_count(tf_ssb_connection_t* connection, int delta);
|
||||
|
||||
/** @} */
|
||||
|
@ -744,6 +744,7 @@ static void _tf_ssb_connection_send_history_stream_work(tf_ssb_connection_t* con
|
||||
static void _tf_ssb_connection_send_history_stream_after_work(tf_ssb_connection_t* connection, int result, void* user_data)
|
||||
{
|
||||
tf_ssb_connection_send_history_stream_t* request = user_data;
|
||||
tf_ssb_connection_adjust_write_count(connection, -1);
|
||||
if (tf_ssb_connection_is_connected(connection))
|
||||
{
|
||||
for (int i = 0; i < request->out_messages_count; i++)
|
||||
@ -768,6 +769,15 @@ static void _tf_ssb_connection_send_history_stream_after_work(tf_ssb_connection_
|
||||
tf_free(request);
|
||||
}
|
||||
|
||||
static void _tf_ssb_connection_send_history_stream_callback(tf_ssb_connection_t* connection, void* user_data)
|
||||
{
|
||||
tf_ssb_connection_adjust_write_count(connection, 1);
|
||||
if (tf_ssb_connection_is_connected(connection))
|
||||
{
|
||||
tf_ssb_connection_run_work(connection, _tf_ssb_connection_send_history_stream_work, _tf_ssb_connection_send_history_stream_after_work, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_connection_send_history_stream(tf_ssb_connection_t* connection, int32_t request_number, const char* author, int64_t sequence, bool keys, bool live)
|
||||
{
|
||||
tf_ssb_connection_send_history_stream_t* async = tf_malloc(sizeof(tf_ssb_connection_send_history_stream_t));
|
||||
@ -778,7 +788,7 @@ static void _tf_ssb_connection_send_history_stream(tf_ssb_connection_t* connecti
|
||||
.live = live,
|
||||
};
|
||||
snprintf(async->author, sizeof(async->author), "%s", author);
|
||||
tf_ssb_connection_run_work(connection, _tf_ssb_connection_send_history_stream_work, _tf_ssb_connection_send_history_stream_after_work, async);
|
||||
tf_ssb_connection_schedule_idle(connection, _tf_ssb_connection_send_history_stream_callback, async);
|
||||
}
|
||||
|
||||
static void _tf_ssb_rpc_createHistoryStream(
|
||||
|
@ -1,2 +1,2 @@
|
||||
#define VERSION_NUMBER "0.0.19-wip"
|
||||
#define VERSION_NAME "Don't let your loyalty become a burden."
|
||||
#define VERSION_NUMBER "0.0.20-wip"
|
||||
#define VERSION_NAME "One word all lowercase four words all uppercase."
|
||||
|
Loading…
Reference in New Issue
Block a user