vue-intergrall-plugins 0.0.506 → 0.0.507
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15908,7 +15908,7 @@ var InteratividadeBotoes = __vue_component__$b;var script$6 = {
|
|
|
15908
15908
|
encodedURL = Buffer(url).toString("base64");
|
|
15909
15909
|
_context.next = 7;
|
|
15910
15910
|
return _this2.$httpRequest({
|
|
15911
|
-
method:
|
|
15911
|
+
method: "get",
|
|
15912
15912
|
url: "".concat(baseURL, "/preview?url=").concat(encodedURL).concat(dev)
|
|
15913
15913
|
// headers: {
|
|
15914
15914
|
// Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VGWnBQeEV1UHc5UXdvN21HU2tWNEl4VHN0blM3MHNyZUJTTWt3d3hiNDRhd3dDcWwxd09jIiwibWFuYWdlciI6Ik1LVXRhd3dpbTRsNXd3WW1LMWFJYXd3aW00bDV3d3d3eGI0NGF3d0s0a2pveHBPMnl6TFZ3dXBud3d4YjQ0YXd3cmxNNHRqZ3FKTExsTjMiLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjczIl0sImF1dGgiOiJNS1VncmxDdkdRbElGbXZVTERCSGplV0wyOXFVUHdyOVlSMVMyeXdJanlLOUNteCIsImlhdCI6MTY0ODQ3MzYxNSwiZXhwIjoxNjQ4NTYwMDE1fQ.KSG_6_9NfQhk5br7hnXzeLyVZuT69XLaEYF9XkdgmmQ"
|
|
@@ -15984,25 +15984,25 @@ var __vue_render__$6 = function __vue_render__() {
|
|
|
15984
15984
|
return _vm.openUrl();
|
|
15985
15985
|
}
|
|
15986
15986
|
}
|
|
15987
|
-
}, [_vm._ssrNode((_vm.linkPreview.imageSource ? "<div class=\"link-preview-image\"" + _vm._ssrStyle(null, _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : '', null) + " data-v-
|
|
15987
|
+
}, [_vm._ssrNode((_vm.linkPreview.imageSource ? "<div class=\"link-preview-image\"" + _vm._ssrStyle(null, _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : '', null) + " data-v-188257a4><img" + _vm._ssrAttr("src", _vm.linkPreview.imageSource) + " alt=\"Imagem referente ao link\" data-v-188257a4></div>" : "<!---->") + " " + (_vm.linkPreview.author ? "<div" + _vm._ssrClass("link-preview-author", {
|
|
15988
15988
|
'mb-0': _vm.linkPreview.description
|
|
15989
|
-
}) + " data-v-
|
|
15989
|
+
}) + " data-v-188257a4><h1 data-v-188257a4>" + _vm._ssrEscape(_vm._s(_vm.linkPreview.author)) + "</h1></div>" : "<!---->") + " " + (_vm.linkPreview.description ? "<div class=\"link-preview-infos\" data-v-188257a4>" + (_vm.linkPreview.description ? "<p data-v-188257a4>" + _vm._ssrEscape(_vm._s(_vm.linkPreview.description)) + "</p>" : "<!---->") + "</div>" : "<!---->"))]) : _vm._e();
|
|
15990
15990
|
};
|
|
15991
15991
|
var __vue_staticRenderFns__$6 = [];
|
|
15992
15992
|
|
|
15993
15993
|
/* style */
|
|
15994
15994
|
var __vue_inject_styles__$6 = function __vue_inject_styles__(inject) {
|
|
15995
15995
|
if (!inject) return;
|
|
15996
|
-
inject("data-v-
|
|
15997
|
-
source: ".link-preview[data-v-
|
|
15996
|
+
inject("data-v-188257a4_0", {
|
|
15997
|
+
source: ".link-preview[data-v-188257a4]{display:flex;flex-direction:column;background-color:#eee;color:#333;cursor:pointer;margin:5px 0;border-radius:5px;opacity:.95;transition:opacity .3s ease-in-out;font-size:13.6px}.link-preview-image[data-v-188257a4]{display:flex;justify-content:center;align-items:center;padding:1px;border-top-left-radius:5px;border-top-right-radius:5px}.link-preview-author[data-v-188257a4]{margin:5px;font-size:.615em;font-weight:700}.link-preview-author.mb-0[data-v-188257a4]{margin-bottom:0}.link-preview-author h1[data-v-188257a4]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link-preview-image img[data-v-188257a4]{min-width:100px;max-width:200px;border-top-left-radius:5px;border-top-right-radius:5px}.link-preview-infos[data-v-188257a4]{background-color:#2626261a;padding:5px;margin:5px;font-size:.83em;border-radius:5px}.link-preview[data-v-188257a4]:hover{opacity:1}.link-preview:hover .link-preview-infos p[data-v-188257a4]{text-decoration:underline}",
|
|
15998
15998
|
map: undefined,
|
|
15999
15999
|
media: undefined
|
|
16000
16000
|
});
|
|
16001
16001
|
};
|
|
16002
16002
|
/* scoped */
|
|
16003
|
-
var __vue_scope_id__$6 = "data-v-
|
|
16003
|
+
var __vue_scope_id__$6 = "data-v-188257a4";
|
|
16004
16004
|
/* module identifier */
|
|
16005
|
-
var __vue_module_identifier__$6 = "data-v-
|
|
16005
|
+
var __vue_module_identifier__$6 = "data-v-188257a4";
|
|
16006
16006
|
/* functional template */
|
|
16007
16007
|
var __vue_is_functional_template__$6 = false;
|
|
16008
16008
|
/* style inject shadow dom */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intergrall-plugins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.507",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/vue-intergrall-plugins.ssr.js",
|
|
6
6
|
"browser": "dist/vue-intergrall-plugins.esm.js",
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
"@vue/cli-plugin-babel": "^5.0.8",
|
|
32
32
|
"@vue/cli-service": "^5.0.8",
|
|
33
33
|
"autoprefixer": "^10.4.17",
|
|
34
|
+
"browserify": "^17.0.0",
|
|
35
|
+
"browserify-fs": "^1.0.0",
|
|
34
36
|
"cross-env": "^7.0.3",
|
|
35
37
|
"cssnano": "^6.0.3",
|
|
36
38
|
"minimist": "^1.2.8",
|
|
@@ -49,7 +51,6 @@
|
|
|
49
51
|
"@fortawesome/vue-fontawesome": "^2.0.10",
|
|
50
52
|
"@popperjs/core": "^2.11.8",
|
|
51
53
|
"core-js": "^3.35.1",
|
|
52
|
-
"postcss": "^8.4.33",
|
|
53
54
|
"vue": "^2.7.16",
|
|
54
55
|
"vue-clickaway": "^2.2.2",
|
|
55
56
|
"vue-select": "^3.20.0",
|
|
@@ -61,6 +62,8 @@
|
|
|
61
62
|
"node": ">=12"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"axios": "^1.6.7"
|
|
65
|
+
"axios": "^1.6.7",
|
|
66
|
+
"stream": "^0.0.2",
|
|
67
|
+
"util": "^0.12.5"
|
|
65
68
|
}
|
|
66
|
-
}
|
|
69
|
+
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="linkPreview.isValid"
|
|
4
|
-
class="link-preview"
|
|
5
|
-
@click="openUrl()"
|
|
2
|
+
<div
|
|
3
|
+
v-if="linkPreview.isValid"
|
|
4
|
+
class="link-preview"
|
|
5
|
+
@click="openUrl()"
|
|
6
6
|
:title="`Abrir ${returnURL()} em uma nova guia`"
|
|
7
7
|
>
|
|
8
|
-
<div
|
|
9
|
-
v-if="linkPreview.imageSource"
|
|
8
|
+
<div
|
|
9
|
+
v-if="linkPreview.imageSource"
|
|
10
10
|
:style="linkPreview.colorTheme ? `background-color: ${linkPreview.colorTheme}` : ''"
|
|
11
11
|
class="link-preview-image"
|
|
12
12
|
>
|
|
13
13
|
<img :src="linkPreview.imageSource" alt="Imagem referente ao link" />
|
|
14
14
|
</div>
|
|
15
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
class="link-preview-author"
|
|
17
|
+
:class="{ 'mb-0': linkPreview.description }"
|
|
18
|
+
v-if="linkPreview.author"
|
|
19
|
+
>
|
|
16
20
|
<h1 v-text="linkPreview.author"></h1>
|
|
17
21
|
</div>
|
|
18
22
|
<div v-if="linkPreview.description" class="link-preview-infos">
|
|
@@ -22,14 +26,14 @@
|
|
|
22
26
|
</template>
|
|
23
27
|
|
|
24
28
|
<script>
|
|
25
|
-
import { dev, baseURL } from
|
|
29
|
+
import { dev, baseURL } from "@/services/smartChannelAxios";
|
|
26
30
|
|
|
27
31
|
export default {
|
|
28
32
|
props: {
|
|
29
33
|
message: {
|
|
30
34
|
type: String,
|
|
31
|
-
default: ""
|
|
32
|
-
}
|
|
35
|
+
default: "",
|
|
36
|
+
},
|
|
33
37
|
},
|
|
34
38
|
data() {
|
|
35
39
|
return {
|
|
@@ -38,127 +42,148 @@ export default {
|
|
|
38
42
|
description: "",
|
|
39
43
|
imageSource: "",
|
|
40
44
|
colorTheme: "",
|
|
41
|
-
isValid: false
|
|
42
|
-
}
|
|
43
|
-
}
|
|
45
|
+
isValid: false,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
44
48
|
},
|
|
45
49
|
mounted() {
|
|
46
|
-
this.$nextTick(() => {
|
|
50
|
+
this.$nextTick(() => {
|
|
51
|
+
this.gerarPreview();
|
|
52
|
+
});
|
|
47
53
|
},
|
|
48
54
|
methods: {
|
|
49
55
|
returnURL() {
|
|
50
|
-
if(!this.message) return ""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
if (!this.message) return "";
|
|
57
|
+
const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
|
|
58
|
+
if (isSticker) return "";
|
|
59
|
+
const regex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/g;
|
|
60
|
+
const url = regex.exec(this.message);
|
|
61
|
+
if (!url || !url[0]) {
|
|
62
|
+
console.warn("URL invalida para gerar preview");
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
65
|
+
const finalUrl = url[0].replace(/["'*]/g, "");
|
|
66
|
+
if (
|
|
67
|
+
/((https?|ftp):\/\/.)?(www\.)?(?:([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})|(linux07|linux03))\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(
|
|
68
|
+
finalUrl
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
return finalUrl;
|
|
72
|
+
return false;
|
|
62
73
|
},
|
|
63
74
|
async gerarPreview() {
|
|
64
75
|
try {
|
|
65
|
-
const url = this.returnURL()
|
|
66
|
-
if(!url) return
|
|
67
|
-
const encodedURL = Buffer(url).toString("base64")
|
|
68
|
-
const response = await this.$httpRequest(
|
|
69
|
-
|
|
70
|
-
method: 'get',
|
|
76
|
+
const url = this.returnURL();
|
|
77
|
+
if (!url) return;
|
|
78
|
+
const encodedURL = Buffer(url).toString("base64");
|
|
79
|
+
const response = await this.$httpRequest({
|
|
80
|
+
method: "get",
|
|
71
81
|
url: `${baseURL}/preview?url=${encodedURL}${dev}`,
|
|
72
82
|
// headers: {
|
|
73
83
|
// Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VGWnBQeEV1UHc5UXdvN21HU2tWNEl4VHN0blM3MHNyZUJTTWt3d3hiNDRhd3dDcWwxd09jIiwibWFuYWdlciI6Ik1LVXRhd3dpbTRsNXd3WW1LMWFJYXd3aW00bDV3d3d3eGI0NGF3d0s0a2pveHBPMnl6TFZ3dXBud3d4YjQ0YXd3cmxNNHRqZ3FKTExsTjMiLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjczIl0sImF1dGgiOiJNS1VncmxDdkdRbElGbXZVTERCSGplV0wyOXFVUHdyOVlSMVMyeXdJanlLOUNteCIsImlhdCI6MTY0ODQ3MzYxNSwiZXhwIjoxNjQ4NTYwMDE1fQ.KSG_6_9NfQhk5br7hnXzeLyVZuT69XLaEYF9XkdgmmQ"
|
|
74
84
|
// }
|
|
75
|
-
})
|
|
76
|
-
if(typeof response != "object" || typeof response.data != "object")
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
|
|
80
|
-
if(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if(
|
|
85
|
+
});
|
|
86
|
+
if (typeof response != "object" || typeof response.data != "object")
|
|
87
|
+
throw "Retorno incorreto";
|
|
88
|
+
const { data } = response;
|
|
89
|
+
const { st_ret, msg_ret, raspagem } = data;
|
|
90
|
+
if (st_ret != "OK") throw `${st_ret} - ${msg_ret}`;
|
|
91
|
+
if (!raspagem)
|
|
92
|
+
throw `${st_ret} - ${msg_ret} | (Raspagem nao encontrada no retorno)`;
|
|
93
|
+
const { description, og, theme_color } = raspagem;
|
|
94
|
+
if (description) this.linkPreview.description = description;
|
|
95
|
+
if (raspagem.author) this.linkPreview.author = raspagem.author;
|
|
96
|
+
if (og) {
|
|
97
|
+
const { image, site_name, title, author } = og;
|
|
98
|
+
if (image)
|
|
99
|
+
this.linkPreview.imageSource = image.url
|
|
100
|
+
? image.url
|
|
101
|
+
: image.url == ""
|
|
102
|
+
? ""
|
|
103
|
+
: image;
|
|
104
|
+
if (author || site_name || title)
|
|
105
|
+
this.linkPreview.author = title
|
|
106
|
+
? title
|
|
107
|
+
: author
|
|
108
|
+
? author
|
|
109
|
+
: site_name
|
|
110
|
+
? site_name
|
|
111
|
+
: "";
|
|
112
|
+
if (og.description) this.linkPreview.description = og.description;
|
|
89
113
|
}
|
|
90
|
-
if(theme_color) this.linkPreview.colorTheme = theme_color
|
|
114
|
+
if (theme_color) this.linkPreview.colorTheme = theme_color;
|
|
91
115
|
|
|
92
|
-
if(this.linkPreview.description || this.linkPreview.imageSource)
|
|
93
|
-
|
|
94
|
-
|
|
116
|
+
if (this.linkPreview.description || this.linkPreview.imageSource)
|
|
117
|
+
this.linkPreview.isValid = true;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.error("Erro ao gerar o preview do link: ", e);
|
|
95
120
|
}
|
|
96
121
|
},
|
|
97
122
|
openUrl() {
|
|
98
|
-
const url = this.returnURL()
|
|
99
|
-
if(!url) return
|
|
100
|
-
window.open(url, "_blank")
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
123
|
+
const url = this.returnURL();
|
|
124
|
+
if (!url) return;
|
|
125
|
+
window.open(url, "_blank");
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
};
|
|
104
129
|
</script>
|
|
105
130
|
|
|
106
131
|
<style scoped>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
.link-preview {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
background-color: #eee;
|
|
136
|
+
color: #333;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
margin: 5px 0;
|
|
139
|
+
border-radius: 5px;
|
|
140
|
+
opacity: 0.95;
|
|
141
|
+
transition: opacity 300ms ease-in-out;
|
|
142
|
+
font-size: 13.6px;
|
|
143
|
+
}
|
|
119
144
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
145
|
+
.link-preview-image {
|
|
146
|
+
display: flex;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
align-items: center;
|
|
149
|
+
padding: 1px;
|
|
150
|
+
border-top-left-radius: 5px;
|
|
151
|
+
border-top-right-radius: 5px;
|
|
152
|
+
}
|
|
128
153
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
154
|
+
.link-preview-author {
|
|
155
|
+
margin: 5px;
|
|
156
|
+
font-size: 0.615em;
|
|
157
|
+
font-weight: bold;
|
|
158
|
+
}
|
|
159
|
+
.link-preview-author.mb-0 {
|
|
160
|
+
margin-bottom: 0;
|
|
161
|
+
}
|
|
162
|
+
.link-preview-author h1 {
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
text-overflow: ellipsis;
|
|
165
|
+
white-space: nowrap;
|
|
166
|
+
}
|
|
142
167
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
168
|
+
.link-preview-image img {
|
|
169
|
+
min-width: 100px;
|
|
170
|
+
max-width: 200px;
|
|
171
|
+
border-top-left-radius: 5px;
|
|
172
|
+
border-top-right-radius: 5px;
|
|
173
|
+
}
|
|
149
174
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
175
|
+
.link-preview-infos {
|
|
176
|
+
background-color: #2626261a;
|
|
177
|
+
padding: 5px;
|
|
178
|
+
margin: 5px;
|
|
179
|
+
font-size: 0.83em;
|
|
180
|
+
border-radius: 5px;
|
|
181
|
+
}
|
|
157
182
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
</style>
|
|
183
|
+
.link-preview:hover {
|
|
184
|
+
opacity: 1;
|
|
185
|
+
}
|
|
186
|
+
.link-preview:hover .link-preview-infos p {
|
|
187
|
+
text-decoration: underline;
|
|
188
|
+
}
|
|
189
|
+
</style>
|