mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-30 06:56:57 +00:00
boxdd: Add insecure mode
This commit is contained in:
@@ -2,6 +2,7 @@ package ccm
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
"github.com/sagernet/sing/service/filemanager"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -42,8 +44,8 @@ func getDefaultCredentialsPath() (string, error) {
|
||||
return filepath.Join(userInfo.HomeDir, ".claude", ".credentials.json"), nil
|
||||
}
|
||||
|
||||
func readCredentialsFromFile(path string) (*oauthCredentials, error) {
|
||||
data, err := os.ReadFile(path)
|
||||
func readCredentialsFromFile(ctx context.Context, path string) (*oauthCredentials, error) {
|
||||
data, err := filemanager.ReadFile(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -60,14 +62,14 @@ func readCredentialsFromFile(path string) (*oauthCredentials, error) {
|
||||
return credentialsContainer.ClaudeAIAuth, nil
|
||||
}
|
||||
|
||||
func writeCredentialsToFile(oauthCredentials *oauthCredentials, path string) error {
|
||||
func writeCredentialsToFile(ctx context.Context, oauthCredentials *oauthCredentials, path string) error {
|
||||
data, err := json.MarshalIndent(map[string]any{
|
||||
"claudeAiOauth": oauthCredentials,
|
||||
}, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(path, data, 0o600)
|
||||
return filemanager.WriteFile(ctx, path, data, 0o600)
|
||||
}
|
||||
|
||||
type oauthCredentials struct {
|
||||
|
||||
Reference in New Issue
Block a user