Skip to content

Commit

Permalink
fix: situations when original server was archived (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanhesl authored Oct 13, 2023
1 parent 84ab94c commit 3058dcb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/peertube.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,12 +911,26 @@ PeerTubePocketnet = function (app) {
return request('proceedResumableUploadVideo', data, optionsPrepared)
.then((r) => {

// Fix for the situations when original server was archived, and url info is invalid
let trueHost;
if (r.status === 200) {
trueHost = self.parselink(
(deep(r, 'data.video.videoCreated.url') || '').replace(
'https://',
PEERTUBE_ID
)
).host;
} else {
trueHost = '';
}


const handleResume = () => Promise.resolve({
responseType: 'resume_upload',
});
const handleLastChunk = () => Promise.resolve({
responseType: 'upload_end',
videoLink: self.composeLink(optionsPrepared.host, r.data.video.uuid, r.data.video.isAudio),
videoLink: self.composeLink(trueHost || optionsPrepared.host, r.data.video.uuid, r.data.video.isAudio),
});
const handleNotFound = () => Promise.resolve({
responseType: 'not_found',
Expand Down
4 changes: 4 additions & 0 deletions proxy16/peertube/roy.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ var Roy = function (parent) {
return instance
.request(method, data, p)
.then((r) => {
if (r.data && r.data.status === 404) {
error = r.data;
return Promise.reject(r);
}
if (r.data) {
r.data.from = instance.host;
}
Expand Down
5 changes: 5 additions & 0 deletions proxy16/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,11 @@ var Proxy = function (settings, manage, test, logger, reverseproxy) {
offline: true,
},
{ host: 'peertube.archive.pocketnet.app', cantuploading: true, ip: '178.217.159.221'},
{
host: 'peertube51.pocketnet.app',
ip: '95.217.209.217',
cantuploading: true,
},
],

38: [
Expand Down

0 comments on commit 3058dcb

Please sign in to comment.