2022-03-07 14:36:23 +00:00
|
|
|
//--- Modules/Imports ---//
|
|
|
|
import { Http } from '@capacitor-community/http';
|
|
|
|
|
|
|
|
const module = {
|
|
|
|
|
2022-03-07 18:53:14 +00:00
|
|
|
//--- Get GitHub Commits ---//
|
2022-03-10 14:59:50 +00:00
|
|
|
commits: new Promise((resolve, reject) => {
|
|
|
|
|
2022-03-07 14:36:23 +00:00
|
|
|
Http.request({
|
|
|
|
method: 'GET',
|
|
|
|
url: "https://api.github.com/repos/Frontesque/VueTube/commits",
|
|
|
|
params: { }
|
|
|
|
})
|
|
|
|
.then((res) => {
|
2022-03-10 14:59:50 +00:00
|
|
|
resolve(res.data)
|
2022-03-07 14:36:23 +00:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
2022-03-10 14:59:50 +00:00
|
|
|
reject(err)
|
2022-03-07 14:36:23 +00:00
|
|
|
});
|
2022-03-10 14:59:50 +00:00
|
|
|
|
2022-03-11 16:39:52 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
getRuns(item, callback) {
|
|
|
|
|
|
|
|
let url = `https://api.github.com/repos/Frontesque/VueTube/commits/${item.sha}/check-runs`;
|
|
|
|
|
|
|
|
Http.request({
|
|
|
|
method: 'GET',
|
|
|
|
url: url,
|
|
|
|
params: { }
|
|
|
|
})
|
|
|
|
.then((res) => {
|
|
|
|
callback(res.data)
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
callback(err)
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2022-03-07 14:36:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--- Start ---//
|
|
|
|
export default ({ app }, inject) => {
|
|
|
|
inject('vuetube', module)
|
|
|
|
}
|