Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vereign Client Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
Vereign Client Library
Commits
c7293e24
Commit
c7293e24
authored
5 years ago
by
Alexey Lunin
Browse files
Options
Downloads
Patches
Plain Diff
Added TextEncoder polyfill. The native TextEncoder is not supported in IE
parent
4580c37c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!83
Exchange 2016 support
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
javascript/src/iframe/viamapi-iframe.js
+1
-6
1 addition, 6 deletions
javascript/src/iframe/viamapi-iframe.js
javascript/src/lib/textencoder.polyfill.js
+58
-0
58 additions, 0 deletions
javascript/src/lib/textencoder.polyfill.js
with
59 additions
and
6 deletions
javascript/src/iframe/viamapi-iframe.js
+
1
−
6
View file @
c7293e24
import
'
../lib/textencoder.polyfill
'
;
import
{
import
{
parseSMIME
,
parseSMIME
,
prepareVCardParts
prepareVCardParts
...
@@ -43,7 +44,6 @@ const penpalMethods = require("../../temp/penpal-methods").default;
...
@@ -43,7 +44,6 @@ const penpalMethods = require("../../temp/penpal-methods").default;
const
WopiAPI
=
require
(
"
./wopiapi-iframe
"
);
const
WopiAPI
=
require
(
"
./wopiapi-iframe
"
);
const
CollaboraAPI
=
require
(
"
./collaboraapi-iframe
"
);
const
CollaboraAPI
=
require
(
"
./collaboraapi-iframe
"
);
const
ViamAPI
=
require
(
"
../../temp/viamapi
"
);
const
ViamAPI
=
require
(
"
../../temp/viamapi
"
);
const
asmCrypto
=
require
(
'
asmcrypto.js
'
);
const
identityColors
=
[
"
#994392
"
,
"
#cb0767
"
,
"
#e51d31
"
,
"
#ec671b
"
,
"
#fab610
"
];
const
identityColors
=
[
"
#994392
"
,
"
#cb0767
"
,
"
#e51d31
"
,
"
#ec671b
"
,
"
#fab610
"
];
...
@@ -527,11 +527,6 @@ const connection = Penpal.connectToParent({
...
@@ -527,11 +527,6 @@ const connection = Penpal.connectToParent({
},
},
...
penpalMethods
,
...
penpalMethods
,
createIdentity
(
pinCode
)
{
createIdentity
(
pinCode
)
{
console
.
log
(
"
Our awesome log from create identity
"
);
console
.
log
({
asmCrypto
});
const
sha1
=
new
asmCrypto
.
Sha1
();
console
.
log
({
sha1
});
return
new
Penpal
.
Promise
(
result
=>
{
return
new
Penpal
.
Promise
(
result
=>
{
createPassportCertificate
(
makeid
()).
then
(
function
(
keys
)
{
createPassportCertificate
(
makeid
()).
then
(
function
(
keys
)
{
const
newIdentity
=
new
Identity
();
const
newIdentity
=
new
Identity
();
...
...
This diff is collapsed.
Click to expand it.
javascript/src/lib/textencoder.polyfill.js
0 → 100644
+
58
−
0
View file @
c7293e24
if
(
typeof
window
.
TextEncoder
===
"
undefined
"
)
{
window
.
TextEncoder
=
function
TextEncoder
(){};
TextEncoder
.
prototype
.
encode
=
function
encode
(
str
)
{
"
use strict
"
;
var
Len
=
str
.
length
,
resPos
=
-
1
;
// The Uint8Array's length must be at least 3x the length of the string because an invalid UTF-16
// takes up the equivelent space of 3 UTF-8 characters to encode it properly. However, Array's
// have an auto expanding length and 1.5x should be just the right balance for most uses.
var
resArr
=
typeof
Uint8Array
===
"
undefined
"
?
new
Array
(
Len
*
1.5
)
:
new
Uint8Array
(
Len
*
3
);
for
(
var
point
=
0
,
nextcode
=
0
,
i
=
0
;
i
!==
Len
;
)
{
point
=
str
.
charCodeAt
(
i
),
i
+=
1
;
if
(
point
>=
0xD800
&&
point
<=
0xDBFF
)
{
if
(
i
===
Len
)
{
resArr
[
resPos
+=
1
]
=
0xef
/*0b11101111*/
;
resArr
[
resPos
+=
1
]
=
0xbf
/*0b10111111*/
;
resArr
[
resPos
+=
1
]
=
0xbd
/*0b10111101*/
;
break
;
}
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
nextcode
=
str
.
charCodeAt
(
i
);
if
(
nextcode
>=
0xDC00
&&
nextcode
<=
0xDFFF
)
{
point
=
(
point
-
0xD800
)
*
0x400
+
nextcode
-
0xDC00
+
0x10000
;
i
+=
1
;
if
(
point
>
0xffff
)
{
resArr
[
resPos
+=
1
]
=
(
0x1e
/*0b11110*/
<<
3
)
|
(
point
>>>
18
);
resArr
[
resPos
+=
1
]
=
(
0x2
/*0b10*/
<<
6
)
|
((
point
>>>
12
)
&
0x3f
/*0b00111111*/
);
resArr
[
resPos
+=
1
]
=
(
0x2
/*0b10*/
<<
6
)
|
((
point
>>>
6
)
&
0x3f
/*0b00111111*/
);
resArr
[
resPos
+=
1
]
=
(
0x2
/*0b10*/
<<
6
)
|
(
point
&
0x3f
/*0b00111111*/
);
continue
;
}
}
else
{
resArr
[
resPos
+=
1
]
=
0xef
/*0b11101111*/
;
resArr
[
resPos
+=
1
]
=
0xbf
/*0b10111111*/
;
resArr
[
resPos
+=
1
]
=
0xbd
/*0b10111101*/
;
continue
;
}
}
if
(
point
<=
0x007f
)
{
resArr
[
resPos
+=
1
]
=
(
0x0
/*0b0*/
<<
7
)
|
point
;
}
else
if
(
point
<=
0x07ff
)
{
resArr
[
resPos
+=
1
]
=
(
0x6
/*0b110*/
<<
5
)
|
(
point
>>>
6
);
resArr
[
resPos
+=
1
]
=
(
0x2
/*0b10*/
<<
6
)
|
(
point
&
0x3f
/*0b00111111*/
);
}
else
{
resArr
[
resPos
+=
1
]
=
(
0xe
/*0b1110*/
<<
4
)
|
(
point
>>>
12
);
resArr
[
resPos
+=
1
]
=
(
0x2
/*0b10*/
<<
6
)
|
((
point
>>>
6
)
&
0x3f
/*0b00111111*/
);
resArr
[
resPos
+=
1
]
=
(
0x2
/*0b10*/
<<
6
)
|
(
point
&
0x3f
/*0b00111111*/
);
}
}
if
(
typeof
Uint8Array
!==
"
undefined
"
)
return
resArr
.
subarray
(
0
,
resPos
+
1
);
// else // IE 6-9
resArr
.
length
=
resPos
+
1
;
// trim off extra weight
return
resArr
;
};
TextEncoder
.
prototype
.
toString
=
function
(){
return
"
[object TextEncoder]
"
};
try
{
// Object.defineProperty only works on DOM prototypes in IE8
Object
.
defineProperty
(
TextEncoder
.
prototype
,
"
encoding
"
,{
get
:
function
(){
if
(
TextEncoder
.
prototype
.
isPrototypeOf
(
this
))
return
"
utf-8
"
;
else
throw
TypeError
(
"
Illegal invocation
"
);}
});
}
catch
(
e
)
{
/*IE6-8 fallback*/
TextEncoder
.
prototype
.
encoding
=
"
utf-8
"
;
}
if
(
typeof
Symbol
!==
"
undefined
"
)
TextEncoder
.
prototype
[
Symbol
.
toStringTag
]
=
"
TextEncoder
"
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment