refactor(database): make DBListFrpcInstances able to list all users' frpc instances but not single user
feat(frpcAct): user will get createdBy when query frpc instances on current server docs(api): update related api documentation
This commit is contained in:
@@ -40,19 +40,6 @@ type CreateInstanceRequest struct {
|
||||
Additional map[string]interface{} `json:"additionalProperties"`
|
||||
}
|
||||
|
||||
type FrpcInstance struct {
|
||||
ID int
|
||||
UserID int
|
||||
Name string
|
||||
ServerAddr string
|
||||
ServerPort string
|
||||
AuthMethod string
|
||||
BootAtStart bool
|
||||
RunUser string
|
||||
ConfigPath string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
var frpcDB *sql.DB
|
||||
|
||||
func CloseFrpcDatabase() error {
|
||||
@@ -610,11 +597,7 @@ func ListInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// rows, err := frpcDB.Query(`
|
||||
// SELECT id, userID, name, serverAddr, serverPort, auth_method, bootAtStart, runUser, configPath, createdAt
|
||||
// FROM frpcInstances WHERE userID = ?
|
||||
// `, userID)
|
||||
instanceList, err := DBListFrpcInstances(userID)
|
||||
instanceList, err := DBListFrpcInstances()
|
||||
if err != nil {
|
||||
postLog.Error(fmt.Sprintf("[ListInstancesHandler] Failed to query instances: %v", err))
|
||||
SendErrorResponse(w, http.StatusInternalServerError, "Failed to query instances")
|
||||
@@ -633,6 +616,7 @@ func ListInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
"runUser": instance.RunUser,
|
||||
"configPath": instance.ConfigPath,
|
||||
"createdAt": instance.CreatedAt,
|
||||
"createdBy": instance.CreatedBy,
|
||||
}
|
||||
|
||||
if userType == "visitor" {
|
||||
|
||||
Reference in New Issue
Block a user