sliftutils 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursorrules +2 -0
- package/index.d.ts +0 -14
- package/package.json +1 -1
- package/render-utils/Table.tsx +1 -1
- package/render-utils/observer.tsx +4 -1
- package/misc/https/ip.d.ts +0 -10
- package/misc/https/ip.ts +0 -21
package/.cursorrules
CHANGED
|
@@ -26,6 +26,8 @@ We use MobX for state management. Components should use a variable called synced
|
|
|
26
26
|
|
|
27
27
|
The code automatically updates on save, so do not ever run commands to rerun the site.
|
|
28
28
|
|
|
29
|
+
If you need to add a dependency, don't just change the packs to JSON file. Properly use yarn add so you get the latest version, unless the user specifies a version or tells you otherwise.
|
|
30
|
+
|
|
29
31
|
Use tool calls to read files and directories where possible, instead of running "ls", "dir", etc.
|
|
30
32
|
|
|
31
33
|
Coding Styles
|
package/index.d.ts
CHANGED
|
@@ -176,20 +176,6 @@ declare module "sliftutils/misc/https/httpsCerts" {
|
|
|
176
176
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
declare module "sliftutils/misc/https/ip" {
|
|
180
|
-
export declare const getExternalIP: {
|
|
181
|
-
(): Promise<string>;
|
|
182
|
-
reset(): void;
|
|
183
|
-
set(newValue: Promise<string>): void;
|
|
184
|
-
};
|
|
185
|
-
export declare const getPublicIP: {
|
|
186
|
-
(): Promise<string>;
|
|
187
|
-
reset(): void;
|
|
188
|
-
set(newValue: Promise<string>): void;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
179
|
declare module "sliftutils/misc/https/node-forge-ed25519" {
|
|
194
180
|
|
|
195
181
|
|
package/package.json
CHANGED
package/render-utils/Table.tsx
CHANGED
|
@@ -70,7 +70,7 @@ export class Table<RowT extends RowType> extends preact.Component<TableType<RowT
|
|
|
70
70
|
let rowFields = this.props.getRowFields?.(row) || {};
|
|
71
71
|
return <tr
|
|
72
72
|
{...rowFields}
|
|
73
|
-
className={rowFields.className + " " + (index % 2 === 1 && css.hsla(0, 0
|
|
73
|
+
className={rowFields.className + " " + (index % 2 === 1 && css.background("hsla(0, 0%, 100%, 0.25)", "soft") || "")}
|
|
74
74
|
>
|
|
75
75
|
<td className={css.center}>{index + 1}</td>
|
|
76
76
|
{Object.entries(columns).filter(x => x[1] !== null).map(([columnName, column]: [string, ColumnType]) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as preact from "preact";
|
|
2
2
|
import { observable, Reaction } from "mobx";
|
|
3
|
+
import { measureBlock } from "socket-function/src/profiling/measure";
|
|
3
4
|
|
|
4
5
|
let globalConstructOrder = 1;
|
|
5
6
|
export function observer<
|
|
@@ -27,7 +28,9 @@ export function observer<
|
|
|
27
28
|
render(...args: any[]) {
|
|
28
29
|
let output: preact.ComponentChild;
|
|
29
30
|
this.reaction.track(() => {
|
|
30
|
-
|
|
31
|
+
measureBlock(() => {
|
|
32
|
+
output = (super.render as any)(...args);
|
|
33
|
+
}, `${name}|render`);
|
|
31
34
|
});
|
|
32
35
|
return output;
|
|
33
36
|
}
|
package/misc/https/ip.d.ts
DELETED
package/misc/https/ip.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { lazy } from "socket-function/src/caching";
|
|
2
|
-
import { httpsRequest } from "socket-function/src/https";
|
|
3
|
-
|
|
4
|
-
const ipServers = [
|
|
5
|
-
"http://quentinbrooks.com:4283",
|
|
6
|
-
"https://ipinfo.io/ip",
|
|
7
|
-
"https://api.ipify.org"
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
export const getExternalIP = lazy((async function getExternalIP(): Promise<string> {
|
|
11
|
-
for (let server of ipServers) {
|
|
12
|
-
try {
|
|
13
|
-
return (await httpsRequest(server, undefined, undefined, false)).toString();
|
|
14
|
-
} catch (e) {
|
|
15
|
-
console.warn(`Failed to get external ip from ${server}: ${e}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
throw new Error(`Failed to get external ip from any server`);
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
export const getPublicIP = getExternalIP;
|