修改登录判断问题

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-03-11 13:57:38 +08:00
parent 9e51213189
commit ed18478626
276 changed files with 8169 additions and 13445 deletions

View File

@@ -228,7 +228,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
}
// Parse url
const fullPath = buildFullPath(config.baseURL, config.url);
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
const protocol = parsed.protocol || supportedProtocols[0];

View File

@@ -97,6 +97,15 @@ class Axios {
}
}
// Set config.allowAbsoluteUrls
if (config.allowAbsoluteUrls !== undefined) {
// do nothing
} else if (this.defaults.allowAbsoluteUrls !== undefined) {
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
} else {
config.allowAbsoluteUrls = true;
}
validator.assertOptions(config, {
baseUrl: validators.spelling('baseURL'),
withXsrfToken: validators.spelling('withXSRFToken')
@@ -192,7 +201,7 @@ class Axios {
getUri(config) {
config = mergeConfig(this.defaults, config);
const fullPath = buildFullPath(config.baseURL, config.url);
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
return buildURL(fullPath, config.params, config.paramsSerializer);
}
}

View File

@@ -13,8 +13,9 @@ import combineURLs from '../helpers/combineURLs.js';
*
* @returns {string} The combined full path
*/
export default function buildFullPath(baseURL, requestedURL) {
if (baseURL && !isAbsoluteURL(requestedURL)) {
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
let isRelativeUrl = !isAbsoluteURL(requestedURL);
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
return combineURLs(baseURL, requestedURL);
}
return requestedURL;

View File

@@ -1 +1 @@
export const VERSION = "1.7.9";
export const VERSION = "1.8.2";

View File

@@ -2,8 +2,9 @@ import util from 'util';
import {Readable} from 'stream';
import utils from "../utils.js";
import readBlob from "./readBlob.js";
import platform from "../platform/index.js";
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
@@ -63,7 +64,7 @@ const formDataToStream = (form, headersHandler, options) => {
const {
tag = 'form-data-boundary',
size = 25,
boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
} = options || {};
if(!utils.isFormData(form)) {

View File

@@ -1,6 +1,30 @@
import crypto from 'crypto';
import URLSearchParams from './classes/URLSearchParams.js'
import FormData from './classes/FormData.js'
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
const DIGIT = '0123456789';
const ALPHABET = {
DIGIT,
ALPHA,
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
}
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
let str = '';
const {length} = alphabet;
const randomValues = new Uint32Array(size);
crypto.randomFillSync(randomValues);
for (let i = 0; i < size; i++) {
str += alphabet[randomValues[i] % length];
}
return str;
}
export default {
isNode: true,
classes: {
@@ -8,5 +32,7 @@ export default {
FormData,
Blob: typeof Blob !== 'undefined' && Blob || null
},
ALPHABET,
generateString,
protocols: [ 'http', 'https', 'file', 'data' ]
};

View File

@@ -602,26 +602,6 @@ const toFiniteNumber = (value, defaultValue) => {
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
}
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
const DIGIT = '0123456789';
const ALPHABET = {
DIGIT,
ALPHA,
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
}
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
let str = '';
const {length} = alphabet;
while (size--) {
str += alphabet[Math.random() * length|0]
}
return str;
}
/**
* If the thing is a FormData object, return true, otherwise return false.
*
@@ -749,8 +729,6 @@ export default {
findKey,
global: _global,
isContextDefined,
ALPHABET,
generateString,
isSpecCompliantForm,
toJSONObject,
isAsyncFn,

View File

@@ -1,6 +1,6 @@
{
"name": "axios",
"version": "1.7.9",
"version": "1.8.2",
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"exports": {
@@ -163,12 +163,12 @@
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
"Jay (https://github.com/jasonsaayman)",
"Emily Morehouse (https://github.com/emilyemorehouse)",
"Justin Beckwith (https://github.com/JustinBeckwith)",
"Rubén Norte (https://github.com/rubennorte)",
"Justin Beckwith (https://github.com/JustinBeckwith)",
"Martti Laine (https://github.com/codeclown)",
"Xianming Zhong (https://github.com/chinesedfan)",
"Remco Haszing (https://github.com/remcohaszing)",
"Rikki Gibson (https://github.com/RikkiGibson)",
"Remco Haszing (https://github.com/remcohaszing)",
"Yasu Flores (https://github.com/yasuf)",
"Ben Carp (https://github.com/carpben)"
],
@@ -217,6 +217,6 @@
]
},
"__npminstall_done": true,
"_from": "axios@1.7.9",
"_resolved": "https://registry.npmmirror.com/axios/-/axios-1.7.9.tgz"
"_from": "axios@1.8.2",
"_resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.2.tgz"
}