File tree 9 files changed +459
-826
lines changed
9 files changed +459
-826
lines changed Original file line number Diff line number Diff line change 23
23
"@vkontakte/vk-bridge-react" : " ^1.0.0" ,
24
24
"@vkontakte/vk-mini-apps-router" : " 1.4.2" ,
25
25
"@vkontakte/vkui" : " 6.0.0" ,
26
- "jshashes" : " ^1.0.8" ,
27
26
"preact" : " ^10.19.3" ,
28
27
"react" : " npm:@preact/compat" ,
29
28
"react-dom" : " npm:@preact/compat"
33
32
"react-dom" : " ^18.2.0"
34
33
},
35
34
"devDependencies" : {
36
- "@babel/eslint-parser" : " ^7.23.3" ,
37
35
"@biomejs/biome" : " 1.5.2" ,
38
36
"@diary-spo/shared" : " 1.8.9" ,
39
37
"@diary-spo/types" : " latest" ,
40
- "@preact/preset-vite" : " ^2.8.1" ,
41
- "@rollup/plugin-terser" : " ^0.4.4" ,
42
38
"@rsbuild/core" : " ^0.3.6" ,
39
+ "@rsbuild/plugin-image-compress" : " ^0.3.7" ,
43
40
"@rsbuild/plugin-react" : " ^0.3.6" ,
44
41
"@types/node" : " ^20.11.5" ,
45
42
"@vitest/coverage-v8" : " ^1.2.1" ,
46
43
"@vkontakte/vk-miniapps-deploy" : " ^0.1.6" ,
47
- "dotenv" : " ^16.3.2" ,
48
44
"gh-pages" : " ^6.0.0" ,
49
45
"jsdom" : " ^23.2.0" ,
50
46
"typescript" : " ^5.2.2" ,
51
- "vite" : " 5.0.12" ,
52
47
"vitest" : " ^1.2.1" ,
53
48
"vitest-localstorage-mock" : " ^0.0.1"
54
49
}
Original file line number Diff line number Diff line change 1
- import { pluginReact } from '@rsbuild/plugin-react' ;
1
+ import { loadEnv } from '@rsbuild/core'
2
+ import { pluginImageCompress } from '@rsbuild/plugin-image-compress'
3
+ import { pluginReact } from '@rsbuild/plugin-react'
4
+
5
+ const { publicVars } = loadEnv ( )
2
6
3
7
export default {
4
- plugins : [ pluginReact ( ) ] ,
5
- html : {
6
- template : './index.html' ,
8
+ performance : {
9
+ removeMomentLocale : true ,
10
+ chunkSplit : {
11
+ strategy : 'split-by-experience'
12
+ }
7
13
} ,
8
-
9
- } ;
14
+ output : {
15
+ polyfill : 'usage'
16
+ } ,
17
+ analyzerMode : 'static' ,
18
+ openAnalyzer : false ,
19
+ reportFilename : 'report-web.html' ,
20
+ source : {
21
+ define : publicVars
22
+ } ,
23
+ plugins : [ pluginReact ( ) , pluginImageCompress ( ) ] ,
24
+ html : {
25
+ template : './index.html'
26
+ }
27
+ }
Original file line number Diff line number Diff line change 1
- import 'dotenv/config'
2
- export const BASE_URL = process . env . VITE_SERVER_URL
3
- export const SECOND_SERVER_URL = process . env . VITE_SERVER_URL_SECOND
4
- console . log ( process . env . BAR ) ; // '1'
5
- export const MODE = process . env . VITE_MODE
1
+ export const BASE_URL = process . env . PUBLIC_SERVER_URL
2
+ export const SECOND_SERVER_URL = process . env . PUBLIC_SERVER_URL_SECOND
3
+ export const MODE = process . env . PUBLIC_MODE
6
4
7
5
export const Mode = {
8
6
DEV : 'dev' ,
Original file line number Diff line number Diff line change
1
+ export * from './jshashes.ts'
Original file line number Diff line number Diff line change
1
+ const generateSHA256Hash = async ( input : string ) : Promise < string > => {
2
+ const encoder = new TextEncoder ( )
3
+ const data = encoder . encode ( input )
4
+
5
+ const buffer = await crypto . subtle . digest ( 'SHA-256' , data )
6
+
7
+ const arrayBuffer = new Uint8Array ( buffer )
8
+ return Array . from ( arrayBuffer )
9
+ . map ( ( byte ) => String . fromCharCode ( byte ) )
10
+ . join ( '' )
11
+ }
12
+
13
+ export const Hashes = {
14
+ SHA256 : {
15
+ b64 : async ( input : string ) : Promise < string > => {
16
+ const sha256Hash = await generateSHA256Hash ( input )
17
+ return btoa ( sha256Hash )
18
+ }
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ import {
15
15
Input ,
16
16
Panel
17
17
} from '@vkontakte/vkui'
18
- import Hashes from 'jshashes'
19
18
import { ChangeEvent , FC } from 'preact/compat'
20
19
import { useEffect , useState } from 'preact/hooks'
21
20
import { useSnackbar } from '../hooks'
21
+ import { Hashes } from '../libs'
22
22
import { makeRequest } from '../methods'
23
23
import { VIEW_SCHEDULE } from '../routes'
24
24
import { loginPattern } from '../types'
@@ -70,15 +70,16 @@ const LoginForm: FC<{ id: string }> = ({ id }) => {
70
70
return
71
71
}
72
72
73
- const passwordHashed = new Hashes . SHA256 ( ) . b64 ( password )
73
+ const passwordHashed2 = await Hashes . SHA256 . b64 ( password )
74
74
75
+ console . error ( 'passwordHashed2' , passwordHashed2 )
75
76
setIsLoading ( true )
76
77
const response = await makeRequest < ResponseLogin > (
77
78
'/login/' ,
78
79
'POST' ,
79
80
JSON . stringify ( {
80
81
login,
81
- password : passwordHashed ,
82
+ password : passwordHashed2 ,
82
83
isHash : true
83
84
} )
84
85
)
Original file line number Diff line number Diff line change 1
1
// import { AppRoot, Button, Div } from '@vkontakte/vkui'
2
- // import { notFoundStyle, text } from '../views/index.tsx '
2
+ // import { notFoundStyle, text } from '../views/index.ts '
3
3
//
4
4
// const TechWorking = () => {
5
5
// return (
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export default defineConfig({
39
39
safari10 : false
40
40
} ,
41
41
rollupOptions : {
42
- logLevel : 'debug' ,
42
+ logLevel : 'debug'
43
43
}
44
44
}
45
45
} )
You can’t perform that action at this time.
0 commit comments