1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-01-14 04:35:49 +02:00

Main build (Jenkins)

This commit is contained in:
Vitaly the Alpaca (bot) 2024-11-13 11:41:54 +03:00
parent c725421b24
commit 7191dc3ae7
30 changed files with 6151 additions and 5677 deletions

View File

@ -3,7 +3,7 @@
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";

View File

@ -3,7 +3,7 @@
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";

View File

@ -31,7 +31,7 @@ import TabItem from '@theme/TabItem';
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";

View File

@ -31,7 +31,7 @@ import TabItem from '@theme/TabItem';
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";

View File

@ -80,4 +80,86 @@ Method at API documentation: [Creating a counter](https://yandex.ru/dev/metrika/
```json title="Result"
{
"counter": {
"id": 98905589,
"status": "Active",
"owner_login": "bayselonarrend",
"code_status": "CS_ERR_UNKNOWN",
"activity_status": "low",
"type": "simple",
"favorite": 0,
"hide_address": 0,
"pro": 0,
"permission": "own",
"webvisor": {
"arch_enabled": 0,
"arch_type": "none",
"load_player_type": "proxy",
"wv_version": 2,
"allow_wv2": true,
"wv_forms": 1
},
"code_options": {
"async": 0,
"informer": {
"enabled": 1,
"type": "ext",
"size": 2,
"indicator": "uniques",
"color_start": "EEEEEEEE",
"color_end": "EFEFEFFE",
"color_text": 0,
"color_arrow": 1
},
"visor": 1,
"track_hash": 1,
"xml_site": 0,
"clickmap": 1,
"in_one_line": 0,
"ecommerce": 1,
"alternative_cdn": 1,
"ecommerce_object": "dataLayer",
"ytm": false
},
"create_time": "2024-11-13T10:44:59+03:00",
"time_zone_name": "Europe/Moscow",
"time_zone_offset": 180,
"partner_id": 0,
"update_time": "2024-11-13 10:45:00",
"code": "<!-- Yandex.Metrika informer -->\n<a href=\"https://metrica.yandex.com/stat/?id=98905589&amp;from=informer\" target=\"_blank\" rel=\"nofollow\">\n <img src=\"//bs.yandex.ru/informer/98905589/2_1_EEEEEEEE_EFEFEFFE_0_uniques\"\n style=\"width:80px; height:31px; border:0;\"\n alt=\"Yandex.Metrica\"\n title=\"Yandex.Metrica: data for today (unique users)\"\n onclick=\"try{Ya.Metrika.informer({i:this,id:98905589,lang:'en'});return false}catch(e){}\"/>\n</a>\n<!-- /Yandex.Metrika informer -->\n\n<!-- Yandex.Metrika counter -->\n<script type=\"text/javascript\">\n (function(m,e,t,r,i,k,a){\n m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};\n m[i].l=1*new Date();\n k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)\n })(window, document,'script','//mc.webvisor.org/metrika/tag_ww.js', 'ym');\n\n ym(98905589, 'init', {accurateTrackBounce:true, trackLinks:true, webvisor:true, trackHash:true, clickmap:true, ecommerce:\"dataLayer\", params: {__ym: {isFromApi: 'yesIsFromApi'}}});\n</script>\n<noscript><div><img src=\"https://mc.yandex.ru/watch/98905589\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div></noscript>\n<!-- /Yandex.Metrika counter -->\n\n\n",
"monitoring": {
"enable_monitoring": 0,
"emails": [],
"sms_allowed": 1,
"enable_sms": 0,
"phones": [],
"phone_ids": [],
"possible_phones": [
"+37544*****91"
],
"possible_phone_ids": [
598854008
]
},
"filter_robots": 2,
"currency": 643,
"currency_code": "RUB",
"visit_threshold": 1800,
"max_goals": 200,
"max_operations": 30,
"max_filters": 30,
"features": [
"webvisor2"
],
"site": "openintegrations.dev",
"site2": {
"site": "openintegrations.dev",
"domain": "openintegrations.dev"
},
"gdpr_agreement_accepted": 1,
"autogoals_enabled": true
}
}
```

View File

@ -38,4 +38,8 @@ Method at API documentation: [Deleting a counter](https://yandex.ru/dev/metrika/
```json title="Result"
{
"success": true
}
```

View File

@ -38,4 +38,86 @@ Method at API documentation: [Counter information](https://yandex.ru/dev/metrika
```json title="Result"
{
"counter": {
"id": 98905589,
"status": "Active",
"owner_login": "bayselonarrend",
"code_status": "CS_ERR_UNKNOWN",
"activity_status": "low",
"type": "simple",
"favorite": 0,
"hide_address": 0,
"pro": 0,
"permission": "own",
"webvisor": {
"arch_enabled": 0,
"arch_type": "none",
"load_player_type": "proxy",
"wv_version": 2,
"allow_wv2": true,
"wv_forms": 1
},
"code_options": {
"async": 0,
"informer": {
"enabled": 1,
"type": "ext",
"size": 2,
"indicator": "uniques",
"color_start": "EEEEEEEE",
"color_end": "EFEFEFFE",
"color_text": 0,
"color_arrow": 1
},
"visor": 1,
"track_hash": 1,
"xml_site": 0,
"clickmap": 1,
"in_one_line": 0,
"ecommerce": 1,
"alternative_cdn": 1,
"ecommerce_object": "dataLayer",
"ytm": false
},
"create_time": "2024-11-13T10:44:59+03:00",
"time_zone_name": "Europe/Moscow",
"time_zone_offset": 180,
"partner_id": 0,
"update_time": "2024-11-13 10:45:00",
"code": "<!-- Yandex.Metrika informer -->\n<a href=\"https://metrica.yandex.com/stat/?id=98905589&amp;from=informer\" target=\"_blank\" rel=\"nofollow\">\n <img src=\"//bs.yandex.ru/informer/98905589/2_1_EEEEEEEE_EFEFEFFE_0_uniques\"\n style=\"width:80px; height:31px; border:0;\"\n alt=\"Yandex.Metrica\"\n title=\"Yandex.Metrica: data for today (unique users)\"\n onclick=\"try{Ya.Metrika.informer({i:this,id:98905589,lang:'en'});return false}catch(e){}\"/>\n</a>\n<!-- /Yandex.Metrika informer -->\n\n<!-- Yandex.Metrika counter -->\n<script type=\"text/javascript\">\n (function(m,e,t,r,i,k,a){\n m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};\n m[i].l=1*new Date();\n k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)\n })(window, document,'script','//mc.webvisor.org/metrika/tag_ww.js', 'ym');\n\n ym(98905589, 'init', {accurateTrackBounce:true, trackLinks:true, webvisor:true, trackHash:true, clickmap:true, ecommerce:\"dataLayer\", params: {__ym: {isFromApi: 'yesIsFromApi'}}});\n</script>\n<noscript><div><img src=\"https://mc.yandex.ru/watch/98905589\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div></noscript>\n<!-- /Yandex.Metrika counter -->\n\n\n",
"monitoring": {
"enable_monitoring": 0,
"emails": [],
"sms_allowed": 1,
"enable_sms": 0,
"phones": [],
"phone_ids": [],
"possible_phones": [
"+37544*****91"
],
"possible_phone_ids": [
598854008
]
},
"filter_robots": 2,
"currency": 643,
"currency_code": "RUB",
"visit_threshold": 1800,
"max_goals": 200,
"max_operations": 30,
"max_filters": 30,
"features": [
"webvisor2"
],
"site": "openintegrations.dev",
"site2": {
"site": "openintegrations.dev",
"domain": "openintegrations.dev"
},
"gdpr_agreement_accepted": 1,
"autogoals_enabled": true
}
}
```

View File

@ -49,4 +49,156 @@ Method at API documentation: [List of available counters](https://yandex.ru/dev/
```json title="Result"
{
"rows": 4,
"counters": [
{
"id": 98905589,
"status": "Active",
"owner_login": "bayselonarrend",
"code_status": "CS_ERR_UNKNOWN",
"activity_status": "low",
"type": "simple",
"favorite": 0,
"hide_address": 0,
"pro": 0,
"permission": "own",
"webvisor": {
"arch_enabled": 0,
"arch_type": "none",
"load_player_type": "proxy",
"wv_version": 2,
"allow_wv2": true,
"wv_forms": 1
},
"code_options": {
"async": 0,
"informer": {
"enabled": 1,
"type": "ext",
"size": 2,
"indicator": "uniques",
"color_start": "EEEEEEEE",
"color_end": "EFEFEFFE",
"color_text": 0,
"color_arrow": 1
},
"visor": 1,
"track_hash": 1,
"xml_site": 0,
"clickmap": 1,
"in_one_line": 0,
"ecommerce": 1,
"alternative_cdn": 1,
"ecommerce_object": "dataLayer",
"ytm": false
},
"create_time": "2024-11-13T10:44:59+03:00",
"time_zone_name": "Europe/Moscow",
"time_zone_offset": 180,
"partner_id": 0,
"site": "openintegrations.dev",
"site2": {
"site": "openintegrations.dev",
"domain": "openintegrations.dev"
},
"gdpr_agreement_accepted": 1
},
{
"id": 97292922,
"status": "Active",
"owner_login": "bayselonarrend",
"code_status": "CS_ERR_UNKNOWN",
"activity_status": "low",
"name": "OpenIntegrations",
"type": "simple",
"favorite": 0,
"hide_address": 0,
"pro": 0,
"permission": "own",
"webvisor": {
"arch_enabled": 0,
"arch_type": "none",
"load_player_type": "proxy",
"wv_version": 2,
"allow_wv2": true,
"wv_forms": 1
},
"code_options": {
"async": 1,
"informer": {
"enabled": 0,
"type": "ext",
"size": 3,
"indicator": "pageviews",
"color_start": "FFFFFFFF",
"color_end": "EFEFEFFF",
"color_text": 0,
"color_arrow": 1
},
"visor": 0,
"track_hash": 0,
"xml_site": 0,
"clickmap": 1,
"in_one_line": 0,
"ecommerce": 0,
"alternative_cdn": 0,
"ecommerce_object": "dataLayer",
"ytm": false
},
"create_time": "2024-05-15T16:55:09+03:00",
"time_zone_name": "Europe/Minsk",
"time_zone_offset": 180,
"partner_id": 0,
"site": "openintegrations.dev",
"site2": {
"site": "openintegrations.dev",
"domain": "openintegrations.dev"
},
"gdpr_agreement_accepted": 0
},
{
"id": 98234044,
"status": "Active",
"owner_login": "bayselonarrend",
"code_status": "CS_ERR_UNKNOWN",
"activity_status": "low",
"name": "OpenYellow",
"type": "simple",
"favorite": 0,
"hide_address": 0,
"pro": 0,
"permission": "own",
"webvisor": {
"arch_enabled": 0,
"arch_type": "none",
"load_player_type": "proxy",
"wv_version": 2,
"allow_wv2": true,
"wv_forms": 1
},
"code_options": {
"async": 1,
"informer": {
"enabled": 0,
"type": "ext",
"size": 3,
"indicator": "pageviews",
"color_start": "FFFFFFFF",
"color_end": "EFEFEFFF",
"color_text": 0,
"color_arrow": 1
},
"visor": 0,
"track_hash": 0,
"xml_site": 0,
"clickmap": 1,
"in_one_line": 0,
"ecommerce": 0,
"alternative_cdn": 0,
"ecommerce_object": "dataLayer",
"ytm": false
},
...
```

View File

@ -38,4 +38,8 @@ Method at API documentation: [Restoring a counter](https://yandex.ru/dev/metrika
```json title="Result"
{
"success": true
}
```

View File

@ -52,4 +52,86 @@ Method at API documentation: [Changing a counter](https://yandex.ru/dev/metrika/
```json title="Result"
{
"counter": {
"id": 98905589,
"status": "Active",
"owner_login": "bayselonarrend",
"code_status": "CS_ERR_UNKNOWN",
"activity_status": "low",
"type": "simple",
"favorite": 0,
"hide_address": 0,
"pro": 0,
"permission": "own",
"webvisor": {
"arch_enabled": 0,
"arch_type": "none",
"load_player_type": "proxy",
"wv_version": 2,
"allow_wv2": true,
"wv_forms": 1
},
"code_options": {
"async": 0,
"informer": {
"enabled": 1,
"type": "ext",
"size": 2,
"indicator": "uniques",
"color_start": "EEEEEEEE",
"color_end": "EFEFEFFE",
"color_text": 0,
"color_arrow": 1
},
"visor": 1,
"track_hash": 1,
"xml_site": 0,
"clickmap": 1,
"in_one_line": 0,
"ecommerce": 1,
"alternative_cdn": 1,
"ecommerce_object": "dataLayer",
"ytm": false
},
"create_time": "2024-11-13T10:44:59+03:00",
"time_zone_name": "Europe/Moscow",
"time_zone_offset": 180,
"partner_id": 0,
"update_time": "2024-11-13 10:45:00",
"code": "<!-- Yandex.Metrika informer -->\n<a href=\"https://metrica.yandex.com/stat/?id=98905589&amp;from=informer\" target=\"_blank\" rel=\"nofollow\">\n <img src=\"//bs.yandex.ru/informer/98905589/2_1_EEEEEEEE_EFEFEFFE_0_uniques\"\n style=\"width:80px; height:31px; border:0;\"\n alt=\"Yandex.Metrica\"\n title=\"Yandex.Metrica: data for today (unique users)\"\n onclick=\"try{Ya.Metrika.informer({i:this,id:98905589,lang:'en'});return false}catch(e){}\"/>\n</a>\n<!-- /Yandex.Metrika informer -->\n\n<!-- Yandex.Metrika counter -->\n<script type=\"text/javascript\">\n (function(m,e,t,r,i,k,a){\n m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};\n m[i].l=1*new Date();\n k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)\n })(window, document,'script','//mc.webvisor.org/metrika/tag_ww.js', 'ym');\n\n ym(98905589, 'init', {accurateTrackBounce:true, trackLinks:true, webvisor:true, trackHash:true, clickmap:true, ecommerce:\"dataLayer\", params: {__ym: {isFromApi: 'yesIsFromApi'}}});\n</script>\n<noscript><div><img src=\"https://mc.yandex.ru/watch/98905589\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div></noscript>\n<!-- /Yandex.Metrika counter -->\n\n\n",
"monitoring": {
"enable_monitoring": 0,
"emails": [],
"sms_allowed": 1,
"enable_sms": 0,
"phones": [],
"phone_ids": [],
"possible_phones": [
"+37544*****91"
],
"possible_phone_ids": [
598854008
]
},
"filter_robots": 1,
"currency": 643,
"currency_code": "RUB",
"visit_threshold": 1800,
"max_goals": 200,
"max_operations": 30,
"max_filters": 30,
"features": [
"webvisor2"
],
"site": "openintegrations.dev",
"site2": {
"site": "openintegrations.dev",
"domain": "openintegrations.dev"
},
"gdpr_agreement_accepted": 1,
"autogoals_enabled": true
}
}
```

View File

@ -3,7 +3,7 @@
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Авторизация = OPI_S3.ПолучитьСтруктуруАвторизации(URL, AccessKey, SecretKey, Region);
Авторизация = OPI_S3.ПолучитьСтруктуруДанных(URL, AccessKey, SecretKey, Region);
Имя = "newbucket2";

View File

@ -3,7 +3,7 @@
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Авторизация = OPI_S3.ПолучитьСтруктуруАвторизации(URL, AccessKey, SecretKey, Region);
Авторизация = OPI_S3.ПолучитьСтруктуруДанных(URL, AccessKey, SecretKey, Region);
Имя = "newbucket2";

View File

@ -31,7 +31,7 @@ import TabItem from '@theme/TabItem';
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Авторизация = OPI_S3.ПолучитьСтруктуруАвторизации(URL, AccessKey, SecretKey, Region);
Авторизация = OPI_S3.ПолучитьСтруктуруДанных(URL, AccessKey, SecretKey, Region);
Имя = "newbucket2";

View File

@ -31,7 +31,7 @@ import TabItem from '@theme/TabItem';
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
Авторизация = OPI_S3.ПолучитьСтруктуруАвторизации(URL, AccessKey, SecretKey, Region);
Авторизация = OPI_S3.ПолучитьСтруктуруДанных(URL, AccessKey, SecretKey, Region);
Имя = "newbucket2";

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@ Function GetToken(Val AppKey, Val AppSecret, Val Code) Export
Address = URLStructure["Address"];
Request = OPI_Tools.CreateRequest(Address, , DataType);
Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret);
Connection = OPI_Tools.CreateConnection(Server, True, AppKey, AppSecret);
ParameterString = OPI_Tools.RequestParametersToString(Parameters);
Data = Right(ParameterString, StrLen(ParameterString) - 1);

View File

@ -88,9 +88,10 @@ Function SendRequestWithoutBody(Val Method, Val BasicData) Export
URLStructure = OPI_Tools.SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Request = OPI_Tools.CreateRequest(Address);
Connection = OPI_Tools.CreateConnection(Server);
Connection = OPI_Tools.CreateConnection(Server, Safe);
AuthorizationHeader = CreateAuthorizationHeader(BasicData, Request, Connection, Method);
Request.Headers.Insert("Authorization", AuthorizationHeader);
@ -362,6 +363,8 @@ Function GetServiceURL(Val Authorization)
URL = Authorization["URL"];
OPI_TypeConversion.GetLine(URL);
If Not StrEndsWith(URL, "/") Then
URL = URL + "/";
EndIf;
@ -387,14 +390,21 @@ EndFunction
#Region Miscellaneous
Function BucketManagment(Val Name, Val Authorization, Val Method)
Function BucketManagment(Val Name, Val BasicData, Val Method)
OPI_TypeConversion.GetLine(Name);
OPI_TypeConversion.GetCollection(BasicData);
URL = GetServiceURL(Authorization);
If TypeOf(BasicData) = Type("Array") Then
Raise "Error of obtaining authorization data from the structure";
EndIf;
URL = GetServiceURL(BasicData);
URL = URL + Name;
Response = SendRequestWithoutBody(Method, Authorization);
BasicData.Insert("URL", URL);
Response = SendRequestWithoutBody(Method, BasicData);
Return Response;

View File

@ -14615,7 +14615,7 @@ Procedure S3_CreateBucket(FunctionParameters)
SecretKey = FunctionParameters["S3_SecretKey"];
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";
@ -14635,7 +14635,7 @@ Procedure S3_DeleteBucket(FunctionParameters)
SecretKey = FunctionParameters["S3_SecretKey"];
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";

View File

@ -391,29 +391,6 @@ Function GetFilePath(Val Path) Export
EndFunction
Function IsOneScript() Export
Try
Response = False;
// BSLLS:UnusedLocalVariable-off
//@skip-check module-unused-local-variable
Check = New OpenSSLSecureConnection();
// BSLLS:UnusedLocalVariable-on
Except
Response = True;
EndTry;
Return Response;
EndFunction
Procedure ParameterToCollection(Parameter, Collection) Export
Value = GetParameter(Parameter);
@ -2199,7 +2176,7 @@ EndProcedure
Procedure WriteCLICall(Val Library, Val Method, Val Options)
If Not IsOneScript() Then
If Not OPI_Tools.IsOneScript() Then
Return;
EndIf;

View File

@ -210,14 +210,24 @@ Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "
EndFunction
Function CreateConnection(Val Server, Val User = "", Val Password = "") Export
Function CreateConnection(Val Server, Val Safe = True, Val User = "", Val Password = "") Export
Try
SSL = New OpenSSLSecureConnection;
Return New HTTPConnection(Server, 443, User, Password, , 3000, SSL);
Except
Return New HTTPConnection(Server, 443, User, Password, , 3000);
EndTry;
If Safe Then
If IsOneScript() Then
Connection = New HTTPConnection(Server, 443, User, Password, , 3000);
Else
SSL = New OpenSSLSecureConnection;
Connection = New HTTPConnection(Server, 443, User, Password, , 3000, SSL);
EndIf;
Else
Connection = New HTTPConnection(Server, 80, User, Password, , 3000, SSL);
EndIf;
Return Connection;
EndFunction
@ -236,8 +246,9 @@ Function ExecuteRequest(Val Request, Val Connection, Val View, Val ResponseFile
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Request.ResourceAddress = Address;
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
@ -369,22 +380,28 @@ EndFunction
Function SplitURL(Val URL) Export
SecureConnection = Not StrStartsWith(URL, "http://");
URL = StrReplace(URL, "https://", "");
URL = StrReplace(URL, "http://" , "");
URL = StrReplace(URL, ":443" , "");
Address = Right(URL, StrLen(URL) - StrFind(URL, "/", SearchDirection.FromBegin) + 1);
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
If StrFind(URL, "/") = 0 Then
Address = "";
Server = URL;
Else
Address = Right(URL, StrLen(URL) - StrFind(URL, "/", SearchDirection.FromBegin) + 1);
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
EndIf;
Try
SSL = New OpenSSLSecureConnection;
Except
If IsOneScript() And SecureConnection Then
Server = "https://" + Server;
EndTry;
EndIf;
ReturnStructure = New Structure;
ReturnStructure.Insert("Server" , Server);
ReturnStructure.Insert("Address" , Address);
ReturnStructure.Insert("Safe" , SecureConnection);
Return ReturnStructure;
@ -644,6 +661,29 @@ Function ISOTimestamp(Val Date) Export
EndFunction
Function IsOneScript() Export
Try
Response = False;
// BSLLS:UnusedLocalVariable-off
//@skip-check module-unused-local-variable
Check = New OpenSSLSecureConnection();
// BSLLS:UnusedLocalVariable-on
Except
Response = True;
EndTry;
Return Response;
EndFunction
Procedure ValueToArray(Value) Export
Value_ = New Array;
@ -794,9 +834,10 @@ Function ExecuteRequestWithBody(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Request = CreateRequestWithBody(Address, Parameters, AdditionalHeaders, JSON);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
Return Response;
@ -813,9 +854,10 @@ Function ExecuteRequestWithBinaryData(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Request = CreateRequest(Address, AdditionalHeaders, DataType);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
If Not Data.Size() = 0 Then
Request.SetBodyFromBinary(Data);
@ -840,9 +882,10 @@ Function ExecuteRequestWithoutBody(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
Safe = URLStructure["Safe"];
Request = CreateRequest(Address, AdditionalHeaders);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
@ -869,10 +912,12 @@ Function ExecuteMultipartRequest(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
RequestBody = GetTempFileName();
Safe = URLStructure["Safe"];
RequestBody = GetTempFileName();
Request = CreateMultipartRequest(Address, Parameters, Files, AdditionalHeaders, RequestBody, ContentType);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
Request = Undefined;
@ -893,10 +938,12 @@ Function ExecuteMultipartRelatedRequest(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
RequestBody = GetTempFileName();
Safe = URLStructure["Safe"];
RequestBody = GetTempFileName();
Request = CreateMultipartRelatedRequest(Address, Files, JSON, AdditionalHeaders, RequestBody);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);

View File

@ -81,7 +81,7 @@ Function GetToken(Val AppKey, Val AppSecret, Val Code) Export
Address = URLStructure["Address"];
Request = OPI_Tools.CreateRequest(Address, , DataType);
Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret);
Connection = OPI_Tools.CreateConnection(Server, True, AppKey, AppSecret);
ParameterString = OPI_Tools.RequestParametersToString(Parameters);
Data = Right(ParameterString, StrLen(ParameterString) - 1);

View File

@ -88,9 +88,10 @@ Function SendRequestWithoutBody(Val Method, Val BasicData) Export
URLStructure = OPI_Tools.SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Request = OPI_Tools.CreateRequest(Address);
Connection = OPI_Tools.CreateConnection(Server);
Connection = OPI_Tools.CreateConnection(Server, Safe);
AuthorizationHeader = CreateAuthorizationHeader(BasicData, Request, Connection, Method);
Request.Headers.Insert("Authorization", AuthorizationHeader);
@ -362,6 +363,8 @@ Function GetServiceURL(Val Authorization)
URL = Authorization["URL"];
OPI_TypeConversion.GetLine(URL);
If Not StrEndsWith(URL, "/") Then
URL = URL + "/";
EndIf;
@ -387,14 +390,21 @@ EndFunction
#Region Miscellaneous
Function BucketManagment(Val Name, Val Authorization, Val Method)
Function BucketManagment(Val Name, Val BasicData, Val Method)
OPI_TypeConversion.GetLine(Name);
OPI_TypeConversion.GetCollection(BasicData);
URL = GetServiceURL(Authorization);
If TypeOf(BasicData) = Type("Array") Then
Raise "Error of obtaining authorization data from the structure";
EndIf;
URL = GetServiceURL(BasicData);
URL = URL + Name;
Response = SendRequestWithoutBody(Method, Authorization);
BasicData.Insert("URL", URL);
Response = SendRequestWithoutBody(Method, BasicData);
Return Response;

View File

@ -391,29 +391,6 @@ Function GetFilePath(Val Path) Export
EndFunction
Function IsOneScript() Export
Try
Response = False;
// BSLLS:UnusedLocalVariable-off
//@skip-check module-unused-local-variable
Check = New OpenSSLSecureConnection();
// BSLLS:UnusedLocalVariable-on
Except
Response = True;
EndTry;
Return Response;
EndFunction
Procedure ParameterToCollection(Parameter, Collection) Export
Value = GetParameter(Parameter);
@ -2199,7 +2176,7 @@ EndProcedure
Procedure WriteCLICall(Val Library, Val Method, Val Options)
If Not IsOneScript() Then
If Not OPI_Tools.IsOneScript() Then
Return;
EndIf;

View File

@ -14615,7 +14615,7 @@ Procedure S3_CreateBucket(FunctionParameters)
SecretKey = FunctionParameters["S3_SecretKey"];
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";
@ -14635,7 +14635,7 @@ Procedure S3_DeleteBucket(FunctionParameters)
SecretKey = FunctionParameters["S3_SecretKey"];
Region = "BTC";
Authorization = OPI_S3.GetAuthStructure(URL, AccessKey, SecretKey, Region);
Authorization = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "newbucket2";

View File

@ -210,14 +210,24 @@ Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "
EndFunction
Function CreateConnection(Val Server, Val User = "", Val Password = "") Export
Function CreateConnection(Val Server, Val Safe = True, Val User = "", Val Password = "") Export
Try
SSL = New OpenSSLSecureConnection;
Return New HTTPConnection(Server, 443, User, Password, , 3000, SSL);
Except
Return New HTTPConnection(Server, 443, User, Password, , 3000);
EndTry;
If Safe Then
If IsOneScript() Then
Connection = New HTTPConnection(Server, 443, User, Password, , 3000);
Else
SSL = New OpenSSLSecureConnection;
Connection = New HTTPConnection(Server, 443, User, Password, , 3000, SSL);
EndIf;
Else
Connection = New HTTPConnection(Server, 80, User, Password, , 3000, SSL);
EndIf;
Return Connection;
EndFunction
@ -236,8 +246,9 @@ Function ExecuteRequest(Val Request, Val Connection, Val View, Val ResponseFile
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Request.ResourceAddress = Address;
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
@ -369,22 +380,28 @@ EndFunction
Function SplitURL(Val URL) Export
SecureConnection = Not StrStartsWith(URL, "http://");
URL = StrReplace(URL, "https://", "");
URL = StrReplace(URL, "http://" , "");
URL = StrReplace(URL, ":443" , "");
Address = Right(URL, StrLen(URL) - StrFind(URL, "/", SearchDirection.FromBegin) + 1);
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
If StrFind(URL, "/") = 0 Then
Address = "";
Server = URL;
Else
Address = Right(URL, StrLen(URL) - StrFind(URL, "/", SearchDirection.FromBegin) + 1);
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
EndIf;
Try
SSL = New OpenSSLSecureConnection;
Except
If IsOneScript() And SecureConnection Then
Server = "https://" + Server;
EndTry;
EndIf;
ReturnStructure = New Structure;
ReturnStructure.Insert("Server" , Server);
ReturnStructure.Insert("Address" , Address);
ReturnStructure.Insert("Safe" , SecureConnection);
Return ReturnStructure;
@ -644,6 +661,29 @@ Function ISOTimestamp(Val Date) Export
EndFunction
Function IsOneScript() Export
Try
Response = False;
// BSLLS:UnusedLocalVariable-off
//@skip-check module-unused-local-variable
Check = New OpenSSLSecureConnection();
// BSLLS:UnusedLocalVariable-on
Except
Response = True;
EndTry;
Return Response;
EndFunction
Procedure ValueToArray(Value) Export
Value_ = New Array;
@ -794,9 +834,10 @@ Function ExecuteRequestWithBody(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Request = CreateRequestWithBody(Address, Parameters, AdditionalHeaders, JSON);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
Return Response;
@ -813,9 +854,10 @@ Function ExecuteRequestWithBinaryData(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Request = CreateRequest(Address, AdditionalHeaders, DataType);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
If Not Data.Size() = 0 Then
Request.SetBodyFromBinaryData(Data);
@ -840,9 +882,10 @@ Function ExecuteRequestWithoutBody(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
Safe = URLStructure["Safe"];
Request = CreateRequest(Address, AdditionalHeaders);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
@ -869,10 +912,12 @@ Function ExecuteMultipartRequest(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
RequestBody = GetTempFileName();
Safe = URLStructure["Safe"];
RequestBody = GetTempFileName();
Request = CreateMultipartRequest(Address, Parameters, Files, AdditionalHeaders, RequestBody, ContentType);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
Request = Undefined;
@ -893,10 +938,12 @@ Function ExecuteMultipartRelatedRequest(Val URL
URLStructure = SplitURL(URL);
Server = URLStructure["Server"];
Address = URLStructure["Address"];
RequestBody = GetTempFileName();
Safe = URLStructure["Safe"];
RequestBody = GetTempFileName();
Request = CreateMultipartRelatedRequest(Address, Files, JSON, AdditionalHeaders, RequestBody);
Connection = CreateConnection(Server);
Connection = CreateConnection(Server, Safe);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);

View File

@ -362,7 +362,7 @@
Функция ПолучитьURLСервиса(Знач Авторизация)
URL = Авторизация["URL"];
OPI_ПреобразованиеТипов.ПолучитьСтроку(URL);
Если Не СтрЗаканчиваетсяНа(URL, "/") Тогда
@ -394,7 +394,7 @@
OPI_ПреобразованиеТипов.ПолучитьСтроку(Имя);
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(ОсновныеДанные);
Если ТипЗнч(ОсновныеДанные) = Тип("Массив") Тогда
ВызватьИсключение "Ошибка получения авторизационных данных из структуры";
КонецЕсли;
@ -403,7 +403,7 @@
URL = URL + Имя;
ОсновныеДанные.Вставить("URL", URL);
Ответ = ОтправитьЗапросБезТела(Метод, ОсновныеДанные);
Возврат Ответ;

View File

@ -1990,9 +1990,9 @@
КонецФункции
Функция ПолучитьОбщийМодуль(Знач Имя)
Модуль = Вычислить(Имя);
Возврат Модуль;
КонецФункции

View File

@ -212,22 +212,22 @@
Функция СоздатьСоединение(Знач Сервер, Знач Защищенное = Истина, Знач Пользователь = "", Знач Пароль = "") Экспорт
Если Защищенное Тогда
Если ЭтоOneScript() Тогда
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000);
Иначе
SSL = Новый ЗащищенноеСоединениеOpenSSL;
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Иначе
Соединение = Новый HTTPСоединение(Сервер, 80, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Возврат Соединение;
Если Защищенное Тогда
Если ЭтоOneScript() Тогда
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000);
Иначе
SSL = Новый ЗащищенноеСоединениеOpenSSL;
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Иначе
Соединение = Новый HTTPСоединение(Сервер, 80, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Возврат Соединение;
КонецФункции
@ -380,8 +380,8 @@
Функция РазбитьURL(Знач URL) Экспорт
ЗащищенноеСоединение = Не СтрНачинаетсяС(URL, "http://");
ЗащищенноеСоединение = Не СтрНачинаетсяС(URL, "http://");
URL = СтрЗаменить(URL, "https://", "");
URL = СтрЗаменить(URL, "http://" , "");
URL = СтрЗаменить(URL, ":443" , "");
@ -394,7 +394,7 @@
Сервер = Лев(URL, СтрНайти(URL, "/", НаправлениеПоиска.СНачала) - 1);
КонецЕсли;
Если ЭтоOneScript() И ЗащищенноеСоединение Тогда
Если ЭтоOneScript() И ЗащищенноеСоединение Тогда
Сервер = "https://" + Сервер;
КонецЕсли;
@ -913,7 +913,7 @@
Сервер = СтруктураURL["Сервер"];
Адрес = СтруктураURL["Адрес"];
Защищенное = СтруктураURL["Защищенное"];
ТелоЗапроса = ПолучитьИмяВременногоФайла();
Запрос = СоздатьЗапросМультипарт(Адрес, Параметры, Файлы, ДопЗаголовки, ТелоЗапроса, ТипКонтента);
@ -939,7 +939,7 @@
Сервер = СтруктураURL["Сервер"];
Адрес = СтруктураURL["Адрес"];
Защищенное = СтруктураURL["Защищенное"];
ТелоЗапроса = ПолучитьИмяВременногоФайла();
Запрос = СоздатьЗапросМультипартРелэйтед(Адрес, Файлы, JSON, ДопЗаголовки, ТелоЗапроса);

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_S3.os
// OneScript: ./OInt/core/Modules/OPI_S3.os
// Lib: S3
// CLI: s3
@ -362,7 +362,7 @@
Функция ПолучитьURLСервиса(Знач Авторизация)
URL = Авторизация["URL"];
OPI_ПреобразованиеТипов.ПолучитьСтроку(URL);
Если Не СтрЗаканчиваетсяНа(URL, "/") Тогда
@ -394,7 +394,7 @@
OPI_ПреобразованиеТипов.ПолучитьСтроку(Имя);
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(ОсновныеДанные);
Если ТипЗнч(ОсновныеДанные) = Тип("Массив") Тогда
ВызватьИсключение "Ошибка получения авторизационных данных из структуры";
КонецЕсли;
@ -403,7 +403,7 @@
URL = URL + Имя;
ОсновныеДанные.Вставить("URL", URL);
Ответ = ОтправитьЗапросБезТела(Метод, ОсновныеДанные);
Возврат Ответ;

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Инструменты.os
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Инструменты.os
// MIT License
@ -212,22 +212,22 @@
Функция СоздатьСоединение(Знач Сервер, Знач Защищенное = Истина, Знач Пользователь = "", Знач Пароль = "") Экспорт
Если Защищенное Тогда
Если ЭтоOneScript() Тогда
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000);
Иначе
SSL = Новый ЗащищенноеСоединениеOpenSSL;
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Иначе
Соединение = Новый HTTPСоединение(Сервер, 80, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Возврат Соединение;
Если Защищенное Тогда
Если ЭтоOneScript() Тогда
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000);
Иначе
SSL = Новый ЗащищенноеСоединениеOpenSSL;
Соединение = Новый HTTPСоединение(Сервер, 443, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Иначе
Соединение = Новый HTTPСоединение(Сервер, 80, Пользователь, Пароль, , 3000, SSL);
КонецЕсли;
Возврат Соединение;
КонецФункции
@ -380,8 +380,8 @@
Функция РазбитьURL(Знач URL) Экспорт
ЗащищенноеСоединение = Не СтрНачинаетсяС(URL, "http://");
ЗащищенноеСоединение = Не СтрНачинаетсяС(URL, "http://");
URL = СтрЗаменить(URL, "https://", "");
URL = СтрЗаменить(URL, "http://" , "");
URL = СтрЗаменить(URL, ":443" , "");
@ -394,7 +394,7 @@
Сервер = Лев(URL, СтрНайти(URL, "/", НаправлениеПоиска.СНачала) - 1);
КонецЕсли;
Если ЭтоOneScript() И ЗащищенноеСоединение Тогда
Если ЭтоOneScript() И ЗащищенноеСоединение Тогда
Сервер = "https://" + Сервер;
КонецЕсли;
@ -913,7 +913,7 @@
Сервер = СтруктураURL["Сервер"];
Адрес = СтруктураURL["Адрес"];
Защищенное = СтруктураURL["Защищенное"];
ТелоЗапроса = ПолучитьИмяВременногоФайла();
Запрос = СоздатьЗапросМультипарт(Адрес, Параметры, Файлы, ДопЗаголовки, ТелоЗапроса, ТипКонтента);
@ -939,7 +939,7 @@
Сервер = СтруктураURL["Сервер"];
Адрес = СтруктураURL["Адрес"];
Защищенное = СтруктураURL["Защищенное"];
ТелоЗапроса = ПолучитьИмяВременногоФайла();
Запрос = СоздатьЗапросМультипартРелэйтед(Адрес, Файлы, JSON, ДопЗаголовки, ТелоЗапроса);