attach oembed to post
This commit is contained in:
parent
f305310bd7
commit
e3b4109d7b
1 changed files with 24 additions and 2 deletions
|
@ -350,6 +350,13 @@ export class StreamPage {
|
||||||
</button>
|
</button>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
<ion-list>
|
||||||
|
<ion-item>
|
||||||
|
<ion-thumbnail item-start>
|
||||||
|
</ion-thumbnail>
|
||||||
|
<p>filename</p>
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
`
|
`
|
||||||
|
@ -418,10 +425,12 @@ export class NewPostModal {
|
||||||
|
|
||||||
this.options['raw'] = this.raw;
|
this.options['raw'] = this.raw;
|
||||||
pnut.createPost(this.ptext, this.options).then(res => {
|
pnut.createPost(this.ptext, this.options).then(res => {
|
||||||
console.log(res);
|
console.log('-success-');
|
||||||
|
console.log(JSON.stringify(res));
|
||||||
this.presentToast("Status posted.");
|
this.presentToast("Status posted.");
|
||||||
this.events.publish('stream:reload', {});
|
this.events.publish('stream:reload', {});
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
console.log('-error posting-');
|
||||||
console.log(JSON.stringify(err));
|
console.log(JSON.stringify(err));
|
||||||
});
|
});
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
|
@ -491,8 +500,21 @@ export class NewPostModal {
|
||||||
|
|
||||||
fileTransfer.upload(this.fpath, 'https://api.pnut.io/v0/files', options).then((response) => {
|
fileTransfer.upload(this.fpath, 'https://api.pnut.io/v0/files', options).then((response) => {
|
||||||
console.log('-file created-');
|
console.log('-file created-');
|
||||||
console.log(JSON.stringify(response));
|
console.log(response.response);
|
||||||
console.log('-file created-');
|
console.log('-file created-');
|
||||||
|
let rdata = JSON.parse(response.response);
|
||||||
|
let oembed = {
|
||||||
|
'+io.pnut.core.file': {
|
||||||
|
file_id: rdata.data.id,
|
||||||
|
file_token: rdata.data.file_token,
|
||||||
|
format: 'oembed'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(JSON.stringify(oembed));
|
||||||
|
this.raw.push({
|
||||||
|
type: "io.pnut.core.oembed",
|
||||||
|
value: oembed
|
||||||
|
});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log('-create file error-');
|
console.log('-create file error-');
|
||||||
console.log(JSON.stringify(err));
|
console.log(JSON.stringify(err));
|
||||||
|
|
Reference in a new issue