vue-intergrall-plugins 0.0.505 → 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.
- package/dist/vue-intergrall-plugins.esm.js +6837 -3836
- package/dist/vue-intergrall-plugins.min.js +1 -1
- package/dist/vue-intergrall-plugins.ssr.js +5841 -2421
- package/package.json +25 -22
- package/src/lib-components/Messages/LinkPreview.vue +134 -109
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",
|
|
@@ -20,38 +20,40 @@
|
|
|
20
20
|
"build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@babel/core": "^7.
|
|
24
|
-
"@babel/preset-env": "^7.
|
|
23
|
+
"@babel/core": "^7.23.9",
|
|
24
|
+
"@babel/preset-env": "^7.23.9",
|
|
25
25
|
"@rollup/plugin-alias": "^3.1.2",
|
|
26
26
|
"@rollup/plugin-babel": "^5.3.0",
|
|
27
27
|
"@rollup/plugin-commonjs": "^14.0.0",
|
|
28
28
|
"@rollup/plugin-json": "^4.1.0",
|
|
29
29
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
30
30
|
"@rollup/plugin-replace": "^2.4.2",
|
|
31
|
-
"@vue/cli-plugin-babel": "^
|
|
32
|
-
"@vue/cli-service": "^
|
|
33
|
-
"autoprefixer": "^10.
|
|
31
|
+
"@vue/cli-plugin-babel": "^5.0.8",
|
|
32
|
+
"@vue/cli-service": "^5.0.8",
|
|
33
|
+
"autoprefixer": "^10.4.17",
|
|
34
|
+
"browserify": "^17.0.0",
|
|
35
|
+
"browserify-fs": "^1.0.0",
|
|
34
36
|
"cross-env": "^7.0.3",
|
|
35
|
-
"cssnano": "^
|
|
36
|
-
"minimist": "^1.2.
|
|
37
|
-
"rimraf": "^
|
|
37
|
+
"cssnano": "^6.0.3",
|
|
38
|
+
"minimist": "^1.2.8",
|
|
39
|
+
"rimraf": "^5.0.5",
|
|
38
40
|
"rollup": "^2.58.0",
|
|
41
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
39
42
|
"rollup-plugin-terser": "^7.0.2",
|
|
40
43
|
"rollup-plugin-vue": "^5.1.9",
|
|
41
|
-
"vue": "^2.
|
|
42
|
-
"vue-template-compiler": "^2.
|
|
44
|
+
"vue": "^2.7.16",
|
|
45
|
+
"vue-template-compiler": "^2.7.16"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
|
-
"@fortawesome/fontawesome-free": "^5.
|
|
46
|
-
"@fortawesome/fontawesome-svg-core": "^
|
|
47
|
-
"@fortawesome/free-solid-svg-icons": "^5.
|
|
48
|
-
"@fortawesome/vue-fontawesome": "^2.0.
|
|
49
|
-
"@popperjs/core": "^2.11.
|
|
50
|
-
"core-js": "^3.
|
|
51
|
-
"
|
|
52
|
-
"vue": "^2.6.14",
|
|
48
|
+
"@fortawesome/fontawesome-free": "^6.5.1",
|
|
49
|
+
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
|
50
|
+
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
51
|
+
"@fortawesome/vue-fontawesome": "^2.0.10",
|
|
52
|
+
"@popperjs/core": "^2.11.8",
|
|
53
|
+
"core-js": "^3.35.1",
|
|
54
|
+
"vue": "^2.7.16",
|
|
53
55
|
"vue-clickaway": "^2.2.2",
|
|
54
|
-
"vue-select": "^3.
|
|
56
|
+
"vue-select": "^3.20.0",
|
|
55
57
|
"vue-tippy": "^4.12.0",
|
|
56
58
|
"vue-toasted": "^1.1.28",
|
|
57
59
|
"vue2-google-maps": "^0.10.7"
|
|
@@ -60,7 +62,8 @@
|
|
|
60
62
|
"node": ">=12"
|
|
61
63
|
},
|
|
62
64
|
"dependencies": {
|
|
63
|
-
"axios": "^
|
|
64
|
-
"
|
|
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>
|