fix(AntiGateV2): also accept string taskId
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				release-tag / release (push) Successful in 1m54s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	release-tag / release (push) Successful in 1m54s
				
			This commit is contained in:
		@ -5,6 +5,7 @@ import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"git.sati.ac/sati.ac/sati-go"
 | 
			
		||||
@ -83,9 +84,23 @@ var (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (a *antigateV2Api) getTaskResult(request struct {
 | 
			
		||||
	TaskId uint32 `json:"taskId"`
 | 
			
		||||
	TaskId any `json:"taskId"`
 | 
			
		||||
}) any {
 | 
			
		||||
	task := a.ctx.Registry.Get(request.TaskId)
 | 
			
		||||
	var taskId uint32
 | 
			
		||||
	switch id := request.TaskId.(type) {
 | 
			
		||||
	case float64:
 | 
			
		||||
		taskId = uint32(id)
 | 
			
		||||
	case string:
 | 
			
		||||
		parsed, err := strconv.ParseUint(id, 10, 32)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return errorBadRequest
 | 
			
		||||
		}
 | 
			
		||||
		taskId = uint32(parsed)
 | 
			
		||||
	default:
 | 
			
		||||
		return errorBadRequest
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	task := a.ctx.Registry.Get(taskId)
 | 
			
		||||
	if task == nil {
 | 
			
		||||
		return errorNoSuchCaptchaId
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user