esoftplay 0.0.268 → 0.0.269-beta3bf30de
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/assets/plugins/withAndroidPermissionsFix.js +37 -0
- package/bin/build.js +18 -1
- package/bin/cli.js +7 -3
- package/bin/router.js +2 -1
- package/modules/lib/autoreload.ts +1 -2
- package/modules/lib/crypt.js +22340 -2
- package/modules/lib/curl.ts +2 -2
- package/modules/lib/focus.tsx +6 -6
- package/modules/lib/lazy.tsx +2 -3
- package/modules/lib/notify.ts +1 -2
- package/modules/lib/updater.tsx +1 -1
- package/modules/lib/workloop.tsx +2 -2
- package/modules/sys/esp.ts +6 -4
- package/modules/sys/mmkv.ts +5 -3
- package/modules/sys/storage.ts +82 -53
- package/modules/sys/subscribe.ts +1 -2
- package/modules/use/deeplink.ts +0 -1
- package/modules/user/class.ts +1 -1
- package/package.json +1 -1
- package/publisher.js +4 -8
- package/publisher_beta.js +12 -0
package/modules/lib/curl.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
//noPage
|
|
4
|
-
import { reportApiError } from "esoftplay/error";
|
|
5
4
|
import esp from 'esoftplay/esp';
|
|
5
|
+
import { LibCrypt } from 'esoftplay/cache/lib/crypt/import';
|
|
6
|
+
import { reportApiError } from "esoftplay/error";
|
|
6
7
|
|
|
7
8
|
//api_logger_import
|
|
8
9
|
|
|
@@ -115,7 +116,6 @@ export default class m {
|
|
|
115
116
|
protected async setHeader(): Promise<void> {
|
|
116
117
|
return new Promise((r) => {
|
|
117
118
|
if ((/:\/\/data.*?\/(.*)/g).test(this.url)) {
|
|
118
|
-
const LibCrypt = esp.mod("lib/crypt")
|
|
119
119
|
this.header["masterkey"] = new LibCrypt().encode(this.url)
|
|
120
120
|
}
|
|
121
121
|
r()
|
package/modules/lib/focus.tsx
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// noPage
|
|
3
3
|
|
|
4
4
|
import { useIsFocused } from '@react-navigation/native';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { View, ViewStyle } from 'react-native';
|
|
7
7
|
|
|
8
8
|
export interface LibFocusProps {
|
|
9
9
|
isFocused?: boolean
|
|
@@ -21,10 +21,10 @@ export default function m(props: LibFocusProps): any {
|
|
|
21
21
|
const isFocused = useIsFocused()
|
|
22
22
|
|
|
23
23
|
useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const callback = isFocused ? props.onFocus : props.onBlur
|
|
25
|
+
if (typeof callback === "function") {
|
|
26
|
+
const task = requestIdleCallback(callback)
|
|
27
|
+
return () => cancelIdleCallback(task)
|
|
28
28
|
}
|
|
29
29
|
}, [isFocused]);
|
|
30
30
|
|
package/modules/lib/lazy.tsx
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import useSafeState from 'esoftplay/state';
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
|
-
import { InteractionManager } from 'react-native';
|
|
7
6
|
|
|
8
7
|
export interface LibLazyProps {
|
|
9
8
|
children?: any;
|
|
@@ -32,10 +31,10 @@ export default function m(props: LibLazyProps): any {
|
|
|
32
31
|
const [done, setDone] = useSafeState(false);
|
|
33
32
|
|
|
34
33
|
useEffect(() => {
|
|
35
|
-
const int =
|
|
34
|
+
const int = requestIdleCallback(() => {
|
|
36
35
|
setDone(true)
|
|
37
36
|
})
|
|
38
|
-
return () => int
|
|
37
|
+
return () => cancelIdleCallback(int)
|
|
39
38
|
}, [])
|
|
40
39
|
|
|
41
40
|
// const [sync] = useTasks((item) => new Promise((next) => {
|
package/modules/lib/notify.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// noPage
|
|
3
3
|
import esp from 'esoftplay/esp';
|
|
4
4
|
import useGlobalState from 'esoftplay/global';
|
|
5
|
-
|
|
5
|
+
import { LibCrypt } from 'esoftplay/cache/lib/crypt/import';
|
|
6
6
|
|
|
7
7
|
export interface LibNotifyItem {
|
|
8
8
|
to: string,
|
|
@@ -27,7 +27,6 @@ export default function libnotify(res: LibNotifyProps): any {
|
|
|
27
27
|
const curl = (data: LibNotifyItem) => {
|
|
28
28
|
let dData: any = data
|
|
29
29
|
if (!dData.to.includes("ExponentPushToken")) {
|
|
30
|
-
const LibCrypt = esp.mod("lib/crypt")
|
|
31
30
|
dData['to'] = new LibCrypt().decode(dData.to)
|
|
32
31
|
}
|
|
33
32
|
fetch('https://exp.host/--/api/v2/push/send', {
|
package/modules/lib/updater.tsx
CHANGED
|
@@ -8,7 +8,6 @@ import { createTimeout } from 'esoftplay/timeout';
|
|
|
8
8
|
|
|
9
9
|
import Constants from 'expo-constants';
|
|
10
10
|
import * as Updates from 'expo-updates';
|
|
11
|
-
import React from 'react';
|
|
12
11
|
import { Alert, Pressable } from 'react-native';
|
|
13
12
|
|
|
14
13
|
export interface LibUpdaterProps {
|
|
@@ -47,6 +46,7 @@ export function check(callback?: (isNew: boolean) => void): void {
|
|
|
47
46
|
return
|
|
48
47
|
}
|
|
49
48
|
Updates.checkForUpdateAsync().then(({ isAvailable }) => {
|
|
49
|
+
Updates.clearLogEntriesAsync()
|
|
50
50
|
if (!isAvailable) {
|
|
51
51
|
callback?.(false)
|
|
52
52
|
LibProgress?.hide?.()
|
package/modules/lib/workloop.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { LibNotification } from 'esoftplay/cache/lib/notification/import';
|
|
|
4
4
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
5
5
|
import esp from 'esoftplay/esp';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { View } from 'react-native';
|
|
8
8
|
import { WebView } from 'react-native-webview';
|
|
9
9
|
|
|
10
10
|
export interface LibWorkloopProps {
|
|
@@ -58,7 +58,7 @@ export default class m extends LibComponent<LibWorkloopProps, LibWorkloopState>
|
|
|
58
58
|
|
|
59
59
|
static onMessage(e: any): void {
|
|
60
60
|
if (workloopHasTask) {
|
|
61
|
-
|
|
61
|
+
requestIdleCallback(() => {
|
|
62
62
|
const ctask = workloopTasks?.[0]
|
|
63
63
|
if (ctask) {
|
|
64
64
|
if (ctask.length == 2) {
|
package/modules/sys/esp.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { appjson, configjson, configlivejson } from 'esoftplay/bin/files';
|
|
4
4
|
import { EspAssets } from 'esoftplay/cache/assets';
|
|
5
|
-
import cacheConfig from 'esoftplay/cache/config.json';
|
|
6
5
|
import { LibLocale } from 'esoftplay/cache/lib/locale/import';
|
|
7
6
|
import { EspRouterPropertyInterface } from 'esoftplay/cache/properties';
|
|
8
7
|
import { EspRouterInterface } from 'esoftplay/cache/routers';
|
|
@@ -10,8 +9,11 @@ import * as Application from 'expo-application';
|
|
|
10
9
|
import { LogBox, Platform } from 'react-native';
|
|
11
10
|
import 'react-native-reanimated';
|
|
12
11
|
import './oneplusfixfont';
|
|
12
|
+
// import cacheConfig from 'esoftplay/../../config.json';
|
|
13
|
+
// import idJson from 'esoftplay/../../assets/locale/id.json';
|
|
13
14
|
|
|
14
|
-
type ConfigType =
|
|
15
|
+
type ConfigType = any;
|
|
16
|
+
type LangIndexType = any;
|
|
15
17
|
|
|
16
18
|
const ignoreWarns = [
|
|
17
19
|
"Setting a timer for a long period of time",
|
|
@@ -127,7 +129,7 @@ const esp = {
|
|
|
127
129
|
return out;
|
|
128
130
|
}
|
|
129
131
|
},
|
|
130
|
-
lang<T extends keyof
|
|
132
|
+
lang<T extends keyof LangIndexType>(moduleTask: T, langName: string, ...stringToBe: string[]): string {
|
|
131
133
|
let string = LibLocale.stateLang().get()?.[esp.langId()]?.[moduleTask]?.[langName]
|
|
132
134
|
if (!string) {
|
|
133
135
|
string = esp.assets("locale/id.json")?.[moduleTask]?.[langName]
|
|
@@ -166,7 +168,7 @@ const esp = {
|
|
|
166
168
|
const properties = require('esoftplay/cache/properties')
|
|
167
169
|
return properties(modtast.join("/"));
|
|
168
170
|
},
|
|
169
|
-
_config():
|
|
171
|
+
_config(): ConfigType {
|
|
170
172
|
let app = esp.mergeDeep(appjson, configjson)
|
|
171
173
|
var msg = ''
|
|
172
174
|
if (!app.hasOwnProperty('config')) {
|
package/modules/sys/mmkv.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// noPage
|
|
2
|
+
|
|
3
|
+
import { createMMKV } from "react-native-mmkv";
|
|
4
|
+
|
|
2
5
|
// withObject
|
|
3
6
|
let storage: any;
|
|
4
7
|
let isWeb = typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';
|
|
@@ -19,8 +22,7 @@ if (isWeb) {
|
|
|
19
22
|
}
|
|
20
23
|
} else {
|
|
21
24
|
// @ts-ignore
|
|
22
|
-
|
|
23
|
-
storage = new MMKV();
|
|
25
|
+
storage = createMMKV()
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/mmkv.md) untuk melihat dokumentasi*/
|
|
@@ -39,7 +41,7 @@ const FastStorage = {
|
|
|
39
41
|
},
|
|
40
42
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/mmkv.md#removeItem) untuk melihat dokumentasi*/
|
|
41
43
|
removeItem(key: string) {
|
|
42
|
-
storage.
|
|
44
|
+
storage.remove(key)
|
|
43
45
|
},
|
|
44
46
|
/** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/mmkv.md#clear) untuk melihat dokumentasi*/
|
|
45
47
|
clear(): void {
|
package/modules/sys/storage.ts
CHANGED
|
@@ -1,90 +1,119 @@
|
|
|
1
1
|
//noPage
|
|
2
|
-
import
|
|
2
|
+
import { Directory, File, Paths } from "expo-file-system";
|
|
3
3
|
|
|
4
|
-
const CACHE_DIR =
|
|
4
|
+
const CACHE_DIR = new Directory(Paths.cache, "lib-storage-cache");
|
|
5
5
|
|
|
6
6
|
(async () => {
|
|
7
7
|
try {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
if (!CACHE_DIR.exists) {
|
|
9
|
+
CACHE_DIR.create();
|
|
10
|
+
}
|
|
11
|
+
} catch { }
|
|
12
12
|
})();
|
|
13
13
|
|
|
14
14
|
const Storage = {
|
|
15
|
-
getDBPath(key: string):
|
|
16
|
-
const
|
|
17
|
-
return
|
|
15
|
+
getDBPath(key: string): File {
|
|
16
|
+
const name = key.replace(/\//g, "-") + ".txt";
|
|
17
|
+
return new File(CACHE_DIR, name);
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
async getItem(key: string): Promise<any | null> {
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (exists)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} catch
|
|
22
|
+
const file = this.getDBPath(key);
|
|
23
|
+
|
|
24
|
+
if (!file.exists) return null;
|
|
25
|
+
|
|
26
|
+
const value = await file.text();
|
|
27
|
+
return JSON.parse(value);
|
|
28
|
+
} catch {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
return null;
|
|
32
31
|
},
|
|
32
|
+
|
|
33
33
|
async setItem(key: string, value: string): Promise<string> {
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const file = this.getDBPath(key);
|
|
35
|
+
|
|
36
|
+
await file.write(value);
|
|
37
|
+
|
|
36
38
|
return value;
|
|
37
39
|
},
|
|
40
|
+
|
|
38
41
|
async removeItem(key: string): Promise<string> {
|
|
39
|
-
const path = this.getDBPath(key);
|
|
40
42
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
const file = this.getDBPath(key);
|
|
44
|
+
|
|
45
|
+
if (file.exists) {
|
|
46
|
+
file.delete();
|
|
47
|
+
}
|
|
48
|
+
} catch { }
|
|
49
|
+
|
|
43
50
|
return key;
|
|
44
51
|
},
|
|
52
|
+
|
|
45
53
|
clear(): void {
|
|
46
|
-
|
|
54
|
+
try {
|
|
55
|
+
if (CACHE_DIR.exists) {
|
|
56
|
+
CACHE_DIR.delete();
|
|
57
|
+
}
|
|
58
|
+
} catch { }
|
|
47
59
|
},
|
|
48
|
-
async sendTelegram(key: string, message: string, onDone?: () => void, onFailed?: (reason: string) => void, chat_id?: string, customFileName?: (originalName: string) => string,) {
|
|
49
60
|
|
|
61
|
+
async sendTelegram(
|
|
62
|
+
key: string,
|
|
63
|
+
message: string,
|
|
64
|
+
onDone?: () => void,
|
|
65
|
+
onFailed?: (reason: string) => void,
|
|
66
|
+
chat_id?: string,
|
|
67
|
+
customFileName?: (originalName: string) => string
|
|
68
|
+
) {
|
|
50
69
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!
|
|
54
|
-
onFailed?.("File not found")
|
|
55
|
-
return
|
|
70
|
+
const file = this.getDBPath(key);
|
|
71
|
+
|
|
72
|
+
if (!file.exists) {
|
|
73
|
+
onFailed?.("File not found");
|
|
74
|
+
return;
|
|
56
75
|
}
|
|
57
76
|
|
|
58
|
-
const fileName =
|
|
77
|
+
const fileName = file.name;
|
|
59
78
|
|
|
60
79
|
if (fileName) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
const parts = fileName.split(".");
|
|
81
|
+
const fileWithoutExtension = parts.slice(0, -1).join(".");
|
|
82
|
+
const extension = parts[parts.length - 1];
|
|
83
|
+
|
|
64
84
|
const formData = new FormData();
|
|
65
|
-
formData.append(
|
|
66
|
-
formData.append(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
85
|
+
formData.append("caption", message);
|
|
86
|
+
formData.append("chat_id", chat_id ?? "-1001737180019");
|
|
87
|
+
|
|
88
|
+
formData.append("document", {
|
|
89
|
+
uri: file.uri,
|
|
90
|
+
name:
|
|
91
|
+
(customFileName?.(fileWithoutExtension) || fileWithoutExtension) +
|
|
92
|
+
"." +
|
|
93
|
+
extension,
|
|
94
|
+
type: "text/csv",
|
|
95
|
+
} as any);
|
|
96
|
+
|
|
97
|
+
const response = await fetch(
|
|
98
|
+
`https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendDocument`,
|
|
99
|
+
{
|
|
100
|
+
method: "POST",
|
|
101
|
+
body: formData,
|
|
102
|
+
}
|
|
103
|
+
);
|
|
76
104
|
|
|
77
105
|
const result = await response.json();
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
|
|
107
|
+
if (result.ok === true) {
|
|
108
|
+
onDone?.();
|
|
80
109
|
} else {
|
|
81
|
-
onFailed?.(result)
|
|
110
|
+
onFailed?.(JSON.stringify(result));
|
|
82
111
|
}
|
|
83
112
|
}
|
|
84
113
|
} catch (ex) {
|
|
85
|
-
onFailed?.(String(ex))
|
|
114
|
+
onFailed?.(String(ex));
|
|
86
115
|
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
116
|
+
},
|
|
117
|
+
};
|
|
89
118
|
|
|
90
|
-
export default Storage;
|
|
119
|
+
export default Storage;
|
package/modules/sys/subscribe.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// useLibs
|
|
3
3
|
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { InteractionManager } from 'react-native';
|
|
6
5
|
|
|
7
6
|
export interface useGlobalSubscriberReturn<T> {
|
|
8
7
|
getValue: () => any,
|
|
@@ -38,7 +37,7 @@ export default function useGlobalSubscriber<T>(defaultValue?: any): useGlobalSub
|
|
|
38
37
|
function notify(newValue?: any) {
|
|
39
38
|
value = newValue;
|
|
40
39
|
subscribers.forEach((fun: Function) => {
|
|
41
|
-
|
|
40
|
+
requestIdleCallback(() => {
|
|
42
41
|
fun?.(newValue)
|
|
43
42
|
})
|
|
44
43
|
});
|
package/modules/use/deeplink.ts
CHANGED
package/modules/user/class.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
4
|
import { getMessaging } from '@react-native-firebase/messaging';
|
|
5
5
|
import { LibObject } from 'esoftplay/cache/lib/object/import';
|
|
6
|
+
import { LibCrypt } from 'esoftplay/cache/lib/crypt/import';
|
|
6
7
|
import esp from 'esoftplay/esp';
|
|
7
8
|
import useGlobalState, { useGlobalReturn } from 'esoftplay/global';
|
|
8
9
|
import moment from "esoftplay/moment";
|
|
@@ -91,7 +92,6 @@ export default {
|
|
|
91
92
|
async sendToken(token: string) {
|
|
92
93
|
if (token) {
|
|
93
94
|
const config = esp.config();
|
|
94
|
-
const LibCrypt = esp.mod("lib/crypt")
|
|
95
95
|
var post: any = {
|
|
96
96
|
user_id: 0,
|
|
97
97
|
group_id: esp.config('group_id'),
|
package/package.json
CHANGED
package/publisher.js
CHANGED
|
@@ -2,14 +2,10 @@ const shell = require('child_process').execSync;
|
|
|
2
2
|
const packJson = require("./package.json")
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const version = packJson.version
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
let
|
|
9
|
-
let nextVersion = number.split(".")[0] + "." + number.split(".")[1] + "."
|
|
10
|
-
|
|
11
|
-
nextNumber = Number(nextNumber) + 1
|
|
12
|
-
nextVersion += nextNumber
|
|
5
|
+
const baseVersion = version.split('-')[0]
|
|
6
|
+
const parts = baseVersion.split('.')
|
|
7
|
+
let nextNumber = parseInt(parts[2]) + 1
|
|
8
|
+
let nextVersion = parts[0] + '.' + parts[1] + '.' + nextNumber
|
|
13
9
|
const newPackJson = { ...packJson, version: nextVersion }
|
|
14
10
|
fs.writeFileSync("./package.json", JSON.stringify(newPackJson, undefined, 2))
|
|
15
11
|
shell("npm publish", { stdio: ['inherit', 'inherit', 'inherit'] })
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const shell = require('child_process').execSync;
|
|
2
|
+
const packJson = require("./package.json")
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const crypto = require('crypto')
|
|
5
|
+
const version = packJson.version
|
|
6
|
+
const baseVersion = version.split('-')[0]
|
|
7
|
+
const randomHash = crypto.randomBytes(4).toString('hex').substring(0,7)
|
|
8
|
+
const nextVersion = baseVersion + '-beta' + randomHash
|
|
9
|
+
const newPackJson = { ...packJson, version: nextVersion }
|
|
10
|
+
fs.writeFileSync("./package.json", JSON.stringify(newPackJson, undefined, 2))
|
|
11
|
+
shell("npm publish", { stdio: ['inherit', 'inherit', 'inherit'] })
|
|
12
|
+
console.log("\nbun add esoftplay@" + nextVersion + " && bun install\n")
|