-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
125 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Added support for uploading custom Arweave manifest files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
lib/services/arweave/graphql/queries/LicenseDataBundled.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:ardrive/utils/logger.dart'; | ||
import 'package:ardrive_io/ardrive_io.dart'; | ||
|
||
/// Checks if a file is an Arweave manifest file by examining its content type and contents. | ||
/// | ||
/// Returns true if the file has JSON content type and contains the string "arweave/paths", | ||
/// which indicates it follows the Arweave path manifest specification. | ||
Future<bool> isCustomManifest(IOFile file) async { | ||
if (file.contentType == 'application/json') { | ||
/// Read the first 100 bytes of the file | ||
final first100Bytes = file.openReadStream(0, 100); | ||
try { | ||
if (file.contentType == 'application/json') { | ||
final fileLength = await file.length; | ||
|
||
await for (var bytes in first100Bytes) { | ||
// verify if file contains "arweave/paths"f | ||
if (utf8.decode(bytes).contains('arweave/paths')) { | ||
int bytesToRead = 100; | ||
|
||
if (fileLength < bytesToRead) { | ||
bytesToRead = fileLength; | ||
} | ||
|
||
/// Read the first 100 bytes of the file | ||
final first100Bytes = file.openReadStream(0, bytesToRead); | ||
|
||
String content = ''; | ||
|
||
await for (var bytes in first100Bytes) { | ||
content += utf8.decode(bytes); | ||
} | ||
|
||
/// verify if file contains "arweave/paths" | ||
if (content.contains('arweave/paths')) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} catch (e) { | ||
logger.e('Error checking if file is a custom manifest', e); | ||
return false; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.