mirror of
				https://github.com/whyour/qinglong.git
				synced 2025-10-31 17:06:07 +08:00 
			
		
		
		
	修改 task 获取 token 逻辑
This commit is contained in:
		
							parent
							
								
									3a3b945de8
								
							
						
					
					
						commit
						955d815d14
					
				
							
								
								
									
										21
									
								
								shell/api.sh
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								shell/api.sh
									
									
									
									
									
								
							|  | @ -1,15 +1,24 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
| 
 | 
 | ||||||
|  | create_token() { | ||||||
|  |   local token_command="tsx ${dir_root}/back/token.ts" | ||||||
|  |   local token_file="${dir_root}static/build/token.js" | ||||||
|  |   if [[ -f $token_file ]]; then | ||||||
|  |     token_command="node ${token_file}" | ||||||
|  |   fi | ||||||
|  |   token=$(eval "$token_command") | ||||||
|  | } | ||||||
|  | 
 | ||||||
| get_token() { | get_token() { | ||||||
|   if [[ -f $file_auth_token ]]; then |   if [[ -f $file_auth_token ]]; then | ||||||
|     token=$(cat $file_auth_token | jq -r .value) |     token=$(cat $file_auth_token | jq -r .value) | ||||||
|   else |     local expiration=$(cat $file_auth_token | jq -r .expiration) | ||||||
|     local token_command="tsx ${dir_root}/back/token.ts" |     local currentTimeStamp=$(date +%s) | ||||||
|     local token_file="${dir_root}static/build/token.js" |     if [[ $currentTimeStamp -ge $expiration ]]; then | ||||||
|     if [[ -f $token_file ]]; then |       create_token | ||||||
|       token_command="node ${token_file}" |  | ||||||
|     fi |     fi | ||||||
|     token=$(eval "$token_command") |   else | ||||||
|  |     create_token | ||||||
|   fi |   fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -15,7 +15,11 @@ define_program() { | ||||||
|   elif [[ $file_param == *.sh ]]; then |   elif [[ $file_param == *.sh ]]; then | ||||||
|     which_program="bash" |     which_program="bash" | ||||||
|   elif [[ $file_param == *.ts ]]; then |   elif [[ $file_param == *.ts ]]; then | ||||||
|     which_program="tsx" |     if ! type tsx &>/dev/null; then | ||||||
|  |       which_program="ts-node-transpile-only" | ||||||
|  |     else | ||||||
|  |       which_program="tsx" | ||||||
|  |     fi | ||||||
|   else |   else | ||||||
|     which_program="" |     which_program="" | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|  | @ -103,6 +103,7 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => { | ||||||
|       width: 600, |       width: 600, | ||||||
|       maskClosable: false, |       maskClosable: false, | ||||||
|       closable: false, |       closable: false, | ||||||
|  |       keyboard: false, | ||||||
|       okButtonProps: { disabled: true }, |       okButtonProps: { disabled: true }, | ||||||
|       title: '更新中...', |       title: '更新中...', | ||||||
|       centered: true, |       centered: true, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 whyour
						whyour