新增https自定义证书功能
Signed-off-by: jinzhao <jinzhao@kaihong.com>
This commit is contained in:
parent
1153390393
commit
c75bb9226a
|
@ -76,7 +76,9 @@ struct SingleImage {
|
|||
placeholderSrc: $r("app.media.loading"),
|
||||
errorholderSrc: $r("app.media.failed"),
|
||||
objectFit: ImageFit.Contain,
|
||||
progressListener:(progress:number)=>{console.info("ImageKnife:: call back progress = " + progress)}
|
||||
progressListener:(progress:number)=>{console.info("ImageKnife:: call back progress = " + progress)},
|
||||
// 通过https协议进行连接时,默认使用系统预设CA证书。若希望使用自定义证书进行https连接,则需要将自定义证书上传至应用沙箱目录中,并在caPath中指定该证书所在的应用沙箱路径
|
||||
// caPath: "/data/storage/el1/bundle/ca.pem",
|
||||
}
|
||||
}).width(100).height(100)
|
||||
Text($r('app.string.Custom_network_download'))
|
||||
|
|
|
@ -254,7 +254,8 @@ export class ImageKnifeDispatcher {
|
|||
fileCacheFolder: ImageKnife.getInstance().getFileCache()?.getCacheFolder(),
|
||||
isAnimator:isAnimator,
|
||||
moduleName: moduleName == "" ? undefined : moduleName,
|
||||
resName: resName == "" ? undefined : resName
|
||||
resName: resName == "" ? undefined : resName,
|
||||
caPath: currentRequest.imageKnifeOption.caPath,
|
||||
}
|
||||
|
||||
if(request.customGetImage == undefined) {
|
||||
|
|
|
@ -454,6 +454,7 @@ export class ImageKnifeLoader {
|
|||
readTimeout: 0,
|
||||
// usingProtocol:http.HttpProtocol.HTTP1_1
|
||||
// header: new Header('application/json')
|
||||
caPath: request.caPath === undefined ? undefined : request.caPath,
|
||||
});
|
||||
|
||||
promise.then((data: number) => {
|
||||
|
|
|
@ -146,5 +146,6 @@ export interface RequestJobRequest {
|
|||
isAnimator?: boolean,
|
||||
moduleName?:string,
|
||||
resName?: string
|
||||
caPath?: string,
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ export class AnimatorOption {
|
|||
onRepeat?:()=>void
|
||||
}
|
||||
|
||||
interface ImageOption {
|
||||
// 自定义证书路径
|
||||
caPath?: string,
|
||||
}
|
||||
@Observed
|
||||
export class ImageKnifeOption {
|
||||
// 主图资源
|
||||
|
@ -74,8 +78,10 @@ export class ImageKnifeOption {
|
|||
onLoadListener?: OnLoadCallBack | undefined;
|
||||
onComplete?:(event:EventImage | undefined) => void
|
||||
drawingColorFilter?: ColorFilter | drawing.ColorFilter
|
||||
constructor() {
|
||||
|
||||
// 自定义证书路径
|
||||
caPath?: string
|
||||
constructor(option?:ImageOption) {
|
||||
this.caPath = option?.caPath
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue