Skip to content
Snippets Groups Projects
Commit 0ab5ed8d authored by Alexey Lunin's avatar Alexey Lunin
Browse files

Merge master

parents 5496ca4a 134eb4f2
No related branches found
No related tags found
1 merge request!49Applied prettier to the VCL project
......@@ -4,4 +4,6 @@ bin/
Gopkg.lock
vendor/
temp/
yarn-error.log
\ No newline at end of file
yarn-error.log
/.project
cmake-build-debug/
This diff is collapsed.
const axios = require("axios");
const axios = require('axios');
function WopiAPI() {}
WopiAPI.prototype.getPassports = function(fileID) {
const {
publicKey,
uuid,
token,
deviceHash
} = window.viamApi.getConfig().headers;
WopiAPI.prototype.getPassports = function (resourceID, contentType) {
const { publicKey, uuid, token, deviceHash } = window.viamApi.getConfig().headers;
const requestConfig = {
url: `${window.WOPI_URL}getPassports`,
method: "POST",
method: 'POST',
headers: {
publicKey,
uuid,
token,
deviceHash,
fileID: encodeURI(fileID)
resourceID: encodeURI(resourceID),
contentType: encodeURI(contentType)
}
};
return axios(requestConfig);
};
WopiAPI.prototype.putDocument = function(path, accessToken, file) {
const {
publicKey,
uuid,
token,
deviceHash
} = window.viamApi.getConfig().headers;
path = path[0] === "/" ? path : `/${path}`;
path = encodeURI(path);
WopiAPI.prototype.putDocument = function (resourceID, accessToken, file) {
const { publicKey, uuid, token, deviceHash } = window.viamApi.getConfig().headers;
resourceID = encodeURI(resourceID);
const requestConfig = {
url: `${window.WOPI_URL}files${path}/contents`,
method: "POST",
url: `${window.WOPI_URL}files/${resourceID}/contents`,
method: 'POST',
headers: {
publicKey,
uuid,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
export const stringToUtf8ByteArray = (str) => {
if (typeof str !== 'string') {
str = str.toString();
}
const res = Buffer.from(str, 'utf-8');
return res;
}
export const utf8ByteArrayToString = (ba) => {
if (!Buffer.isBuffer(ba)) {
ba = Buffer.from(ba);
}
const res = ba.toString('utf-8');
return res;
}
export const stringToUtf8Base64 = (str) => {
if (!Buffer.isBuffer(str)) {
if (typeof str !== 'string') {
str = str.toString();
}
str = Buffer.from(str, 'utf-8');
}
const res = str.toString('base64');
return res;
}
export const utf8Base64ToString = (strBase64) => {
if (!Buffer.isBuffer(strBase64)) {
if (typeof strBase64 !== 'string') {
strBase64 = strBase64.toString();
}
strBase64 = Buffer.from(strBase64, 'base64');
}
const res = strBase64.toString('utf-8');
return res;
}
export const base64ToByteArray = (strBase64) => {
if (typeof strBase64 !== 'string') {
strBase64 = strBase64.toString();
}
const res = Buffer.from(strBase64, 'base64');
return res;
}
export const byteArrayToBase64 = (ba) => {
if (!Buffer.isBuffer(ba)) {
ba = Buffer.from(ba);
}
const res = ba.toString('base64');
return res;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment