Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e301884
added new API to upload a zip file for encoded video
sag333ar Dec 30, 2024
80f6470
fixed typos
sag333ar Dec 30, 2024
1460844
another typo fixed
sag333ar Dec 30, 2024
4f3530e
another typo fixed
sag333ar Dec 30, 2024
c1f1b58
file renamed to zip
sag333ar Dec 30, 2024
6ff0bc1
removed await
sag333ar Dec 30, 2024
48e322f
updated code to rename file
sag333ar Dec 30, 2024
7731988
if tusId uploads URL, delete it
sag333ar Dec 31, 2024
9e33bbd
updated to let
sag333ar Dec 31, 2024
eed2902
showing error details
sag333ar Dec 31, 2024
33d8c76
showing error details
sag333ar Dec 31, 2024
13ffc85
folder creation updates
sag333ar Dec 31, 2024
25b55e8
updated with new implementation
sag333ar Dec 31, 2024
02c305b
new pinning logic
sag333ar Dec 31, 2024
3756582
done pinning logic
sag333ar Dec 31, 2024
28fc0a8
added more logs
sag333ar Dec 31, 2024
3fced64
add?recursive=true&wrap-with-directory=true - trying this
sag333ar Dec 31, 2024
e5e8894
updated pinning logic
sag333ar Dec 31, 2024
7740088
typo fixed
sag333ar Dec 31, 2024
18f92c0
fixed issues
sag333ar Dec 31, 2024
0519577
bugs fixed
sag333ar Dec 31, 2024
2bde86c
removed unwanted ipfs-only-hash related code
sag333ar Dec 31, 2024
f3dde4d
fixed data of CID
sag333ar Dec 31, 2024
a163309
added parsing for post request response
sag333ar Dec 31, 2024
3734bf4
correct parsing added
sag333ar Dec 31, 2024
339aaaf
completed mobile based video encoding
sag333ar Jan 2, 2025
a883871
minor typo fixed
sag333ar Jan 2, 2025
ee3d64f
updated benes
sag333ar Jan 2, 2025
29b5c7e
updated posting authority related code to publish automatically
sag333ar Jan 2, 2025
dda5424
typo fixed
sag333ar Jan 2, 2025
2aac42c
just change the status to published
sag333ar Jan 2, 2025
298b5c6
fixed a minor bug for file name
sag333ar Jan 2, 2025
5a93f1d
updated thumbnail logic
sag333ar Jan 2, 2025
37d88c1
updated extraction path
sag333ar Jan 2, 2025
8b96a3e
avoid renaming
sag333ar Jan 2, 2025
6e3aaab
extraction path updates
sag333ar Jan 2, 2025
0c6025b
fixed __dirname
sag333ar Jan 2, 2025
3756e1f
fixed __dirname
sag333ar Jan 2, 2025
3f32356
fixed issue
sag333ar Jan 2, 2025
ca1411f
files one by one pinning
sag333ar Jan 3, 2025
d54b168
removed those unwanted files
sag333ar Jan 3, 2025
26c73be
updated gitignore
sag333ar Jan 3, 2025
43284e5
fixed encoding issues
sag333ar Jan 3, 2025
3ec8959
fixed error message
sag333ar Jan 3, 2025
6ef6096
removed error lines
sag333ar Jan 4, 2025
2829e2c
moved IPFS pinning to a separate service
sag333ar Jan 4, 2025
b759281
added try catch
sag333ar Jan 4, 2025
60a9814
commented code to delete folder
sag333ar Jan 4, 2025
ea4aa9b
updated package
sag333ar Jan 4, 2025
1291698
possibly eliminating encoding isssues
sag333ar Jan 4, 2025
a4a702b
updated logic for folder
sag333ar Jan 4, 2025
cf0e9ea
enabling autopublish feature
sag333ar Jan 4, 2025
73c0664
improvements for IPFS pinning
sag333ar Jan 4, 2025
f6beb17
added APIs to report content & report Author
sag333ar Jan 9, 2025
f4ebe12
update dependency install style
sag333ar Jan 9, 2025
7feefe9
temp removed that line
sag333ar Jan 9, 2025
cf5b600
added back that line
sag333ar Jan 9, 2025
0d79f67
removed test file. thinking of adding cluster helper
sag333ar Jan 9, 2025
b906f0a
anyone can get reported posts & reported authors
sag333ar Jan 9, 2025
2f70b59
updated middleware with request user
sag333ar Jan 9, 2025
6d5f2c6
typo fixed
sag333ar Jan 9, 2025
91ea83e
error reporting improved. reports don't have duplicates
sag333ar Jan 9, 2025
796e9b6
removed adding of beneficiaries when not needed
sag333ar Jan 15, 2025
4a78374
added a new status - publish later
sag333ar Jan 16, 2025
d8190a8
supporting scheduled video
sag333ar Feb 21, 2025
be165ad
integrated login with signature and proof
sag333ar May 9, 2025
6a0270c
showing date for scheduled video
sag333ar May 24, 2025
f28a132
added vote & comment APIs
sag333ar Jul 8, 2025
1954aa2
video details is sending entire video object instead of just video st…
sag333ar Jul 14, 2025
f59b71d
enabled OPTIONS API call for TUS uploads from any end-point
sag333ar Sep 25, 2025
740223b
enabled OPTIONS API call for TUS uploads from any end-point
sag333ar Sep 25, 2025
057b14b
reverted changes
sag333ar Sep 25, 2025
f6c98ee
allowing mobile apps to schedule and publish a video for decentralize…
sag333ar Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ uploads
.env
adminsdk.json
hive-test-script.js
connect.sh
connect.sh
routes/mobile/extracted
53 changes: 52 additions & 1 deletion mongoDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const VideoSchema = new mongoose.Schema({
description: String,
status: {
type: String,
enum: ["uploaded", "encoding", "saving", "published", "deleted", "encoding_failed", "encoding_queued", "encoding_halted_time", "encoding_queued_vod", "scheduled", "encoding_ipfs", "encoding_preparing", "publish_manual", "self_deleted", "beneficiary_check_failed"],
enum: ["uploaded", "encoding", "saving", "published", "deleted", "encoding_failed", "encoding_queued", "encoding_halted_time", "encoding_queued_vod", "scheduled", "encoding_ipfs", "encoding_preparing", "publish_manual", "self_deleted", "beneficiary_check_failed", "ipfs_pinning", "ipfs_pinning_failed", "publish_later"],
default: 'uploaded',
required: true
},
Expand Down Expand Up @@ -351,6 +351,53 @@ const PodcastSchema = new mongoose.Schema({
podcast_languages: Array
});

const ReportedDataSchema = new mongoose.Schema({
name: {
type: String,
required: true,
index: true,
},
permlink: {
type: String,
required: true,
index: true,
},
reportedBy: {
type: String,
required: true,
},
reason: {
type: String,
required: true,
},
createdAt: {
type: Date,
required: true,
default: new Date(),
}
});

const ReportedUserSchema = new mongoose.Schema({
name: {
type: String,
required: true,
index: true,
},
reportedBy: {
type: String,
required: true,
},
reason: {
type: String,
required: true,
},
createdAt: {
type: Date,
required: true,
default: new Date(),
}
});

const VideoBoost = mongoose.model("VideoBoost", VideoBoostSchema);
const ChatBotToken = mongoose.model("ChatBotToken", ChatBotTokenSchema);
const HiveAccountChallenge = mongoose.model("HiveAccountChallenge", HiveAccountChallengeSchema);
Expand Down Expand Up @@ -380,6 +427,8 @@ const InboxVerification = mongoose.model('InboxVerification', InboxVerificationS
const Donation = mongoose.model('Donation', DonationSchema);
const DonationAccountTypes = mongoose.model('DonationAccountTypes', DonationAccountTypesSchema)
const Podcast = mongoose.model('Podcast', PodcastSchema)
const ReportedData = mongoose.model("ReportedData", ReportedDataSchema);
const ReportedUser = mongoose.model("ReportedUser", ReportedUserSchema);

async function updateBalance(user) {
const tx = await Transaction.aggregate([
Expand Down Expand Up @@ -480,4 +529,6 @@ export default {
Donation,
DonationAccountTypes,
Podcast,
ReportedData,
ReportedUser,
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
"@hiveio/dhive": "^1.2.0",
"@hiveio/hive-js": "^2.0.4",
"@mux/mux-node": "^2.8.1",
"@nftstorage/ipfs-cluster": "github:3speaknetwork/ipfs-cluster",
"@nftstorage/ipfs-cluster": "https://github.com/spknetwork/ipfs-cluster.git",
"@sentry/node": "^5.30.0",
"@web-std/fetch": "^3.0.3",
"@web-std/file": "^1.1.4",
"@web-std/form-data": "^3.0.2",
"adm-zip": "^0.5.16",
"amqplib": "^0.6.0",
"aws-sdk": "^2.1133.0",
"axios": "^0.20.0",
"base58-js": "^1.0.4",
"buffer": "^6.0.3",
"connect-mongo": "^2.0.3",
"cookie-parser": "^1.4.6",
"crypto-price": "0.0.6",
"dayjs": "^1.11.13",
"debug": "^2.6.9",
"dids": "^2.4.3",
"dotenv": "^15.0.1",
Expand All @@ -36,6 +39,7 @@
"hivesigner": "^3.2.7",
"http-errors": "^1.6.3",
"ipfs-cluster-api": "0.0.9",
"joi": "^17.13.3",
"jsonwebtoken": "^8.5.1",
"key-did-provider-ed25519": "^1.1.0",
"key-did-resolver": "^1.4.4",
Expand All @@ -59,6 +63,7 @@
"steemconnect": "^2.0.1",
"twig": "^0.10.3",
"unique-slug": "^2.0.2",
"url": "^0.11.4",
"xss": "^1.0.11"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ router.get('/my-videos', middleware.requireLogin, middleware.requireIdentity, as
query.userId = req.session.user.user_id;
}

const statusOptions = ["uploaded", "encoding", "published", "deleted", "encoding_failed", "encoding_queued"];
const statusOptions = ["uploaded", "encoding", "published", "deleted", "encoding_failed", "encoding_queued", "ipfs_pinning_failed", "ipfs_pinning"];
let { status = undefined } = req.query;
if (status !== undefined) {
if (statusOptions.includes(status)) {
Expand Down Expand Up @@ -189,7 +189,7 @@ router.get('/my-videos', middleware.requireLogin, middleware.requireIdentity, as
video.visible_status = `Finalizing`
} else if (job.status === "assigned") {
video.visible_status = `Assigned to encoding node`
} else if (job.status === "failed" || job.status === "encoding_failed") {
} else if (job.status === "failed" || job.status === "encoding_failed" || job.status ==="ipfs_pinning_failed") {
video.visible_status = `Encoding Failed. If you want this video to be published please upload it again.`
} else {
video.visible_status = job.status
Expand Down Expand Up @@ -218,7 +218,7 @@ router.get('/my-videos', middleware.requireLogin, middleware.requireIdentity, as
video.visible_status = 'Deleted'
} else if (video.status === "published") {
video.visible_status = "Published"
} else if (video.status === 'encoding_failed') {
} else if (video.status === 'encoding_failed' || video.status === 'ipfs_pinning_failed') {
video.visible_status = "Encoding Failed. If you want this video to be published please upload it again."
} else if (video.status === "encoding_queued") {
video.visible_status = "Queued for encoding<br><b class=\"text-danger\">Please do not attempt to re-upload unless the status reads \"Encoding Failed\"</b>"
Expand Down
37 changes: 37 additions & 0 deletions routes/ipfs-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import config from "../config/index.js";
import { Cluster } from '@nftstorage/ipfs-cluster';
import fs from 'fs';

import fetch from '@web-std/fetch'
import { FormData } from '@web-std/form-data'
import { File, Blob } from '@web-std/file'

Object.assign(global, { fetch, File, Blob, FormData })

let cluster;
if (process.env.ENV === "dev") {
cluster = new Cluster(process.env.IPFS_CLUSTER_URL, {
headers: {
Authorization: process.env.IPFS_CLUSTER_AUTH
},
});
} else {
cluster = new Cluster("http://localhost:9094", {});
}

async function addFileAndGetCID(filePath) {
try {
const fileContent = fs.readFileSync(filePath);
const fileName = filePath.split('/').pop();

const result = await cluster.add({
path: fileName,
content: fileContent,
});
const cid = result.cid['/'];
console.log(`File added to IPFS with CID: ${cid}`);
return cid;
} catch (error) {
console.error('Error adding file to IPFS:', error);
}
}
8 changes: 5 additions & 3 deletions routes/mobile/middleware-mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ async function requireMobileLogin(req, res, next) {
});
await cCreator.save();
}
req.user = user;
next();
} else {
const reason =
Expand Down Expand Up @@ -108,7 +109,8 @@ async function hasValidPostBeneficiariesAndPayout(author, permlink) {
}
const fromMobile =
video !== null && video !== undefined ? video.fromMobile : true;
const sagar = beneficiaries.filter((o) => o.account === "sagarkothari88");
const mobileAppDevName = "sagarkothari88";
const sagar = beneficiaries.filter((o) => o.account === mobileAppDevName);
const spkBeneficiary = beneficiaries.filter(
(o) => o.account === "spk.beneficiary"
);
Expand All @@ -117,8 +119,8 @@ async function hasValidPostBeneficiariesAndPayout(author, permlink) {
fromMobile !== null &&
fromMobile === true
) {
if (sagar.length === 0 || spkBeneficiary.length === 0) return false;
const sagarBenWeight = sagar[0].weight;
if ((sagar.length === 0 && video.owner !== mobileAppDevName) || spkBeneficiary.length === 0) return false;
const sagarBenWeight = video.owner === mobileAppDevName ? 100 : sagar[0].weight;
const spkBeneficiaryWeight = spkBeneficiary[0].weight;
if (
sagarBenWeight === undefined ||
Expand Down
Loading