Marginal success on uploading and showing videos.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4060 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
72952e0c39
commit
f9b4ab91c0
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&gxOJaVf/HdjVJVC9NvZ9n3/825OD1xMMHdF/dFQwe24=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&TxhFekB9ov7tf/fmkAg7x5797i27oLidhgxEfDKC0T0=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&maN8DUFrmRxW5nsVyOAMk5k1ekcz/pfzvSS99ac3jo8=.sha256","tf-app.js":"&7hclNu41CIoNk1JlXHiYmDPDyDIICZfMickJYtnF5eQ=.sha256","tf-message.js":"&M2Vbh8SJi0iik7mkzwdVod/mRXy6MWjkUZtoBs5bmcw=.sha256","tf-user.js":"&bXTedgBudTQLXEBPY9R8OLfQ/ZLpo8YRU9Oq/wuGG3Y=.sha256","tf-utils.js":"&6RQUuxB3PkOhYEJr9+89Ptx7uijczjn0r035yCcQOQQ=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&ZGWHQZPTUl4QU5++WkGwGbyj+hxhQrTg9nLmZCrl/1g=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&pqYLDE/13PyEt2ceeFqvnwZ8NqWfPfpDBt4vP8SeHbs=.sha256","tf-styles.js":"&LFeL/vWgrv4N8q/mBrQAnhbaOI+dXNJYvH9bn1bXSqQ=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&ESt2vMG19sH5j6ungKua/ZuvIGslyuWyb3juXdOCecg=.sha256","tf-tab-news.js":"&/0fVDyHge4x+mIVvohMTUR+deoM96NdQ7nq5HbiVfUI=.sha256","tf-tab-connections.js":"&Ftt5RnkrhndV2lwC7XXUZX8JiUODqPjqEVgSTJQD6JU=.sha256","tf-news.js":"&/Ij0SaBTohV2myuA1gQAPlgmyq/AmmvYIhSCm3wfmow=.sha256","tribute.css":"&9FogMzZHKXCfGb7mlh7z+/wiNZzBsOB/tKoh6MfYJno=.sha256","tribute.esm.js":"&P1wKqCfYULpR/ahSB98JP8xaxfikuZwwtT6I/SAo7/Y=.sha256","commonmark-hashtag.js":"&H+V1OLA9GDdzycKclz276zAtSZLpT3rlNVa4+qQmp4o=.sha256"}}
|
{"type":"tildefriends-app","files":{"app.js":"&gxOJaVf/HdjVJVC9NvZ9n3/825OD1xMMHdF/dFQwe24=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&TxhFekB9ov7tf/fmkAg7x5797i27oLidhgxEfDKC0T0=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&maN8DUFrmRxW5nsVyOAMk5k1ekcz/pfzvSS99ac3jo8=.sha256","tf-app.js":"&7hclNu41CIoNk1JlXHiYmDPDyDIICZfMickJYtnF5eQ=.sha256","tf-message.js":"&U/1mCtY+9C3A8Oq/vShLjXMTjrIW71dqQXqdmBT+jWc=.sha256","tf-user.js":"&bXTedgBudTQLXEBPY9R8OLfQ/ZLpo8YRU9Oq/wuGG3Y=.sha256","tf-utils.js":"&6RQUuxB3PkOhYEJr9+89Ptx7uijczjn0r035yCcQOQQ=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&M7hZ2oQroxutgu/RCC8wHNwTED7eAjDfqrbe5Oa3Xoc=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&pqYLDE/13PyEt2ceeFqvnwZ8NqWfPfpDBt4vP8SeHbs=.sha256","tf-styles.js":"&LFeL/vWgrv4N8q/mBrQAnhbaOI+dXNJYvH9bn1bXSqQ=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&ESt2vMG19sH5j6ungKua/ZuvIGslyuWyb3juXdOCecg=.sha256","tf-tab-news.js":"&/0fVDyHge4x+mIVvohMTUR+deoM96NdQ7nq5HbiVfUI=.sha256","tf-tab-connections.js":"&Ftt5RnkrhndV2lwC7XXUZX8JiUODqPjqEVgSTJQD6JU=.sha256","tf-news.js":"&/Ij0SaBTohV2myuA1gQAPlgmyq/AmmvYIhSCm3wfmow=.sha256","tribute.css":"&9FogMzZHKXCfGb7mlh7z+/wiNZzBsOB/tKoh6MfYJno=.sha256","tribute.esm.js":"&P1wKqCfYULpR/ahSB98JP8xaxfikuZwwtT6I/SAo7/Y=.sha256","commonmark-hashtag.js":"&H+V1OLA9GDdzycKclz276zAtSZLpT3rlNVa4+qQmp4o=.sha256"}}
|
@ -83,26 +83,32 @@ class TfComposeElement extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
add_file(file) {
|
async add_file(file) {
|
||||||
let self = this;
|
try {
|
||||||
file.arrayBuffer().then(function(buffer) {
|
let self = this;
|
||||||
return self.convert_to_webp(buffer, file.type);
|
let buffer = await file.arrayBuffer();
|
||||||
}).then(function(bin) {
|
let type = file.type;
|
||||||
return Promise.all([tfrpc.rpc.store_blob(bin), bin]);
|
if (type.startsWith('image/')) {
|
||||||
}).then(function([id, bin]) {
|
buffer = await self.convert_to_webp(buffer, file.type);
|
||||||
|
type = 'image/webp';
|
||||||
|
} else {
|
||||||
|
buffer = Array.from(new Uint8Array(buffer));
|
||||||
|
}
|
||||||
|
let id = await tfrpc.rpc.store_blob(buffer);
|
||||||
|
let name = type.split('/')[0] + ':' + file.name;
|
||||||
self.mentions[id] = {
|
self.mentions[id] = {
|
||||||
link: id,
|
link: id,
|
||||||
name: file.name,
|
name: name,
|
||||||
type: 'image/webp',
|
type: type,
|
||||||
size: bin.length,
|
size: buffer.length ?? buffer.byteLength,
|
||||||
};
|
};
|
||||||
self.mentions = Object.assign({}, self.mentions);
|
self.mentions = Object.assign({}, self.mentions);
|
||||||
let edit = self.renderRoot.getElementById('edit');
|
let edit = self.renderRoot.getElementById('edit');
|
||||||
edit.value += `\n![${file.name}](${id})`;
|
edit.value += `\n![${name}](${id})`;
|
||||||
self.changed();
|
self.changed();
|
||||||
}).catch(function(e) {
|
} catch(e) {
|
||||||
alert(e?.message);
|
alert(e?.message);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paste(event) {
|
paste(event) {
|
||||||
|
@ -140,6 +140,13 @@ class TfMessageElement extends LitElement {
|
|||||||
<source src=${'/' + mention.link + '/view'}></source>
|
<source src=${'/' + mention.link + '/view'}></source>
|
||||||
</audio>
|
</audio>
|
||||||
`;
|
`;
|
||||||
|
} else if (mention.link?.startsWith('&') &&
|
||||||
|
mention.name?.startsWith('video:')) {
|
||||||
|
return html`
|
||||||
|
<video controls style="max-height: 240px">
|
||||||
|
<source src=${'/' + mention.link + '/view'}></source>
|
||||||
|
</video>
|
||||||
|
`;
|
||||||
} else if (mention.link?.startsWith('&') &&
|
} else if (mention.link?.startsWith('&') &&
|
||||||
mention?.type === 'application/tildefriends') {
|
mention?.type === 'application/tildefriends') {
|
||||||
return html` <a href=${`/${mention.link}/`}>😎 ${mention.name}</a>`;
|
return html` <a href=${`/${mention.link}/`}>😎 ${mention.name}</a>`;
|
||||||
@ -156,7 +163,10 @@ class TfMessageElement extends LitElement {
|
|||||||
|
|
||||||
render_mentions() {
|
render_mentions() {
|
||||||
let mentions = this.message?.content?.mentions || [];
|
let mentions = this.message?.content?.mentions || [];
|
||||||
mentions = mentions.filter(x => x.name?.startsWith('audio:') || this.message?.content?.text?.indexOf(x.link) === -1);
|
mentions = mentions.filter(x =>
|
||||||
|
x.name?.startsWith('audio:') ||
|
||||||
|
x.name?.startsWith('video:') ||
|
||||||
|
this.message?.content?.text?.indexOf(x.link) === -1);
|
||||||
if (mentions.length) {
|
if (mentions.length) {
|
||||||
let self = this;
|
let self = this;
|
||||||
return html`
|
return html`
|
||||||
|
Loading…
Reference in New Issue
Block a user