appscms-tools-theme 0.8.8 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/share/socialshare.html +4 -3
- data/assets/js/googledrive.js +74 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33c221c34fd9946100b5a6e912f8030fb955c2a7fe97d205b5cb6060cfb6c804
|
4
|
+
data.tar.gz: c85f15b2649fefe0e1645484b889bd1d2c804c398d6c00504ca5aafd27b84a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 305a03e907b6ad3d1362c341dc3d1c6ade6c74947d922f5768e62bca624b1528a34e0055937f6a44f73d8bc1b62fd85140fac8bd9da488a0eda26698e6962a62
|
7
|
+
data.tar.gz: 592f0a11a2aec4624bd4b4c7c2cd4c62031418a5737189e4455c1dde7ba8dab0b36095b3dc2a30e7fe3121a18b13b13ae717b91a9c294071c90e3666e9236c4e
|
data/assets/js/googledrive.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const
|
1
|
+
---
|
2
|
+
---
|
3
|
+
const developerKey = '{{site.developerKey}}'
|
4
|
+
const clientId ='{{site.clientId}}'
|
5
|
+
const appId = '{{site.appId}}'
|
5
6
|
const scope = [
|
6
7
|
'https://www.googleapis.com/auth/drive.file',
|
7
8
|
'https://www.googleapis.com/auth/drive.appdata',
|
@@ -35,7 +36,7 @@ const handleAuthResult = (authResult) => {
|
|
35
36
|
const createPicker = () => {
|
36
37
|
if (pickerApiLoaded && oauthToken) {
|
37
38
|
const view = new google.picker.View(google.picker.ViewId.DOCS)
|
38
|
-
view.setMimeTypes(
|
39
|
+
view.setMimeTypes(mimeTypes)
|
39
40
|
const picker = new google.picker.PickerBuilder()
|
40
41
|
.enableFeature(google.picker.Feature.NAV_HIDDEN)
|
41
42
|
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
|
@@ -51,20 +52,83 @@ const createPicker = () => {
|
|
51
52
|
}
|
52
53
|
const pickerCallback = async (data) => {
|
53
54
|
if (data.action == google.picker.Action.PICKED) {
|
55
|
+
showLoader()
|
54
56
|
const res = await fetch(
|
55
|
-
`https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?
|
57
|
+
`https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
|
56
58
|
{
|
57
59
|
headers: {
|
58
60
|
Authorization: `Bearer ${oauthToken}`,
|
59
|
-
Accept: 'application/json',
|
60
61
|
},
|
61
62
|
}
|
62
|
-
).then((res) => res.
|
63
|
-
const response = await fetch(res.downloadUrl).then((res) => res.blob())
|
63
|
+
).then((res) => res.blob())
|
64
64
|
let metadata = {
|
65
65
|
type: data.docs[0].mimeType,
|
66
66
|
}
|
67
|
-
let file = new File([
|
67
|
+
let file = new File([res], data.docs[0].name, metadata)
|
68
|
+
closeLoader()
|
68
69
|
getFile(file)
|
69
70
|
}
|
70
71
|
}
|
72
|
+
function chooseFromDropbox() {
|
73
|
+
Dropbox.choose({
|
74
|
+
success: async (files) => {
|
75
|
+
if (files.length < 0) {
|
76
|
+
return
|
77
|
+
}
|
78
|
+
var file = files[0]
|
79
|
+
const url = new URL(file.link)
|
80
|
+
const response = await fetch(url).then((res) => res.blob())
|
81
|
+
let metadata = {
|
82
|
+
type: response.type,
|
83
|
+
}
|
84
|
+
let newFile = new File([response], file.name, metadata)
|
85
|
+
getDropBoxFile(newFile)
|
86
|
+
},
|
87
|
+
cancel: function () {},
|
88
|
+
linkType: 'direct',
|
89
|
+
multiselect: false,
|
90
|
+
extensions: ['.jpg'],
|
91
|
+
folderselect: false,
|
92
|
+
})
|
93
|
+
}
|
94
|
+
|
95
|
+
const fileupload=(file)=>{
|
96
|
+
gapi.load('auth', {'callback': onAuthLoad});
|
97
|
+
}
|
98
|
+
const onAuthLoad=()=> {
|
99
|
+
window.gapi.auth.authorize(
|
100
|
+
{
|
101
|
+
'client_id': clientId,
|
102
|
+
'scope': scope,
|
103
|
+
'immediate': false
|
104
|
+
},
|
105
|
+
handleAuth);
|
106
|
+
}
|
107
|
+
const handleAuth=(authResult)=> {
|
108
|
+
if (authResult && !authResult.error) {
|
109
|
+
showuploadloading()
|
110
|
+
var formData = new FormData();
|
111
|
+
const fileToUpload = file
|
112
|
+
var metadata = {
|
113
|
+
name: fileToUpload.name,
|
114
|
+
mimeType: fileToUpload.type
|
115
|
+
};
|
116
|
+
formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
|
117
|
+
formData.append( "file", fileToUpload );
|
118
|
+
fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
|
119
|
+
method: "POST",
|
120
|
+
headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
|
121
|
+
body: formData
|
122
|
+
}).then( function( response ){
|
123
|
+
stopuploadloading()
|
124
|
+
return response.json();
|
125
|
+
|
126
|
+
}).then( function( value ){
|
127
|
+
stopuploadloading()
|
128
|
+
showmessage()
|
129
|
+
});
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appscms-tools-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vivek-appscms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|