Skip to content

Commit

Permalink
Merge branch 'main' into fdroid
Browse files Browse the repository at this point in the history
  • Loading branch information
balzack committed Aug 14, 2023
2 parents 6933e18 + e496c75 commit fda8ee6
Show file tree
Hide file tree
Showing 65 changed files with 788 additions and 87 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![contribute.design](https://contribute.design/api/shield/balzack/databag)](https://contribute.design/balzack/databag)

<div align="center">
<a href="#"><img src="/doc/icon.png" width="8%" style="border-radius:50%"></a>
<a href="#"><img src="/doc/icon_v2.png" width="8%" style="border-radius:50%"></a>
<h3 align="center">Databag</h3>
<p align="center">Communication for the Decentralized Web</p>
</div>
Expand Down Expand Up @@ -89,6 +89,8 @@ Instructions for installing without a container on a Raspberry Pi Zero are [here

Instructions for installing without a container in AWS are [here](/doc/aws.md).

1-click installs in [CapRover](https://caprover.com/), [CasaOS](https://casaos.io), [Unraid](https://unraid.net/), [Runtipi](https://www.runtipi.io/)

## Audio and Video Calls

Databag provides audio and video calling and relies on a STUN/TURN relay server for NAT traversal. Testing was done with both [cuturn](https://github.com/coturn/coturn) and [pion](https://github.com/pion/turn) and should work with any implementation. Instructions for installing a coturn server are provided [here](https://gabrieltanner.org/blog/turn-server/).
Expand Down
4 changes: 2 additions & 2 deletions app/mobile/ios/Databag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.17;
MARKETING_VERSION = 1.19;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -656,7 +656,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.17;
MARKETING_VERSION = 1.19;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
{
"images" : [
{
"filename" : "40.png",
"filename" : "_40 2.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "60.png",
"filename" : "_60.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "58.png",
"filename" : "_58 1.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "87.png",
"filename" : "_87.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "80.png",
"filename" : "_80 1.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "120.png",
"filename" : "_120.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "120 1.png",
"filename" : "_120 1.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "180.png",
"filename" : "_180.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "40 1.png",
"filename" : "_40.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "29 1.png",
"filename" : "_29.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "58 1.png",
"filename" : "_58.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "40 2.png",
"filename" : "_40 1.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "80 1.png",
"filename" : "_80.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "76 1.png",
"filename" : "_76.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "152 1.png",
"filename" : "_152.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "167 1.png",
"filename" : "_167.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "1024.png",
"filename" : "_1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 29 additions & 20 deletions app/mobile/src/context/useUploadContext.hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async function upload(entry, update, complete) {
entry.active = {};
try {
if (file.encrypted) {
const { data, type, mime, size, getEncryptedBlock, position } = file;
const { data, type, mime, size, getEncryptedBlock, position, label, extension } = file;
const thumb = await getThumb(data, type, mime, size, position);
const parts = [];
for (let pos = 0; pos < size; pos += ENCRYPTED_BLOCK_SIZE) {
Expand All @@ -182,17 +182,13 @@ async function upload(entry, update, complete) {
parts.push({ blockIv, partId: part.data.assetId });
}
entry.assets.push({
encrypted: { type, thumb, parts }
encrypted: { type, label, extension, thumb, parts }
});
}
else if (file.type === 'image') {
const formData = new FormData();
if (file.data.startsWith('file:')) {
formData.append("asset", {uri: file.data, name: 'asset', type: 'application/octent-stream'});
}
else {
formData.append("asset", {uri: 'file://' + file.data, name: 'asset', type: 'application/octent-stream'});
}
const uri = file.data.startsWith('file:') ? file.data : `file://${file.data}`;
formData.append("asset", {uri: uri, name: 'asset', type: 'application/octent-stream'});
let transform = encodeURIComponent(JSON.stringify(["ithumb;photo", "ilg;photo"]));
let asset = await axios.post(`${entry.baseUrl}assets${entry.urlParams}&transforms=${transform}`, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
Expand All @@ -212,12 +208,8 @@ async function upload(entry, update, complete) {
}
else if (file.type === 'video') {
const formData = new FormData();
if (file.data.startsWith('file:')) {
formData.append("asset", {uri: file.data, name: 'asset', type: 'application/octent-stream'});
}
else {
formData.append("asset", {uri: 'file://' + file.data, name: 'asset', type: 'application/octent-stream'});
}
const uri = file.data.startsWith('file:') ? file.data : `file://${file.data}`;
formData.append("asset", {uri: uri, name: 'asset', type: 'application/octent-stream'});
let thumb = 'vthumb;video;' + file.position;
let transform = encodeURIComponent(JSON.stringify(["vlq;video", "vhd;video", thumb]));
let asset = await axios.post(`${entry.baseUrl}assets${entry.urlParams}&transforms=${transform}`, formData, {
Expand All @@ -239,12 +231,8 @@ async function upload(entry, update, complete) {
}
else if (file.type === 'audio') {
const formData = new FormData();
if (file.data.startsWith('file:')) {
formData.append("asset", {uri: file.data, name: 'asset', type: 'application/octent-stream'});
}
else {
formData.append("asset", {uri: 'file://' + file.data, name: 'asset', type: 'application/octent-stream'});
}
const uri = file.data.startsWith('file:') ? file.data : `file://${file.data}`;
formData.append("asset", {uri: uri, name: 'asset', type: 'application/octent-stream'});
let transform = encodeURIComponent(JSON.stringify(["acopy;audio"]));
let asset = await axios.post(`${entry.baseUrl}assets${entry.urlParams}&transforms=${transform}`, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
Expand All @@ -262,6 +250,27 @@ async function upload(entry, update, complete) {
}
});
}
else if (file.type === 'binary') {
const formData = new FormData();
const uri = file.data.startsWith('file:') ? file.data : `file://${file.data}`;
formData.append("asset", {uri: uri, name: 'asset', type: 'application/octent-stream'});
let asset = await axios.post(`${entry.baseUrl}blocks${entry.urlParams}&body=multipart`, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
signal: entry.cancel.signal,
onUploadProgress: (ev) => {
const { loaded, total } = ev;
entry.active = { loaded, total }
update();
},
});
entry.assets.push({
binary: {
label: file.label,
extension: file.extension,
data: asset.data.assetId,
}
});
}
entry.active = null;
upload(entry, update, complete);
}
Expand Down
47 changes: 34 additions & 13 deletions app/mobile/src/session/conversation/addTopic/AddTopic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ColorPicker from 'react-native-wheel-color-picker'
import { VideoFile } from './videoFile/VideoFile';
import { AudioFile } from './audioFile/AudioFile';
import { ImageFile } from './imageFile/ImageFile';
import { BinaryFile } from './binaryFile/BinaryFile';

export function AddTopic({ contentKey, shareIntent, setShareIntent }) {

Expand Down Expand Up @@ -80,15 +81,28 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {

const addAudio = async () => {
try {
const audio = await DocumentPicker.pickSingle({
presentationStyle: 'fullScreen',
copyTo: 'cachesDirectory',
type: DocumentPicker.types.audio,
})
actions.addAudio(audio.fileCopyUri, audio.name.replace(/\.[^/.]+$/, ""));
} catch (err) {
console.log(err);
}
const audio = await DocumentPicker.pickSingle({
presentationStyle: 'fullScreen',
copyTo: 'cachesDirectory',
type: DocumentPicker.types.audio,
})
actions.addAudio(audio.fileCopyUri, audio.name.replace(/\.[^/.]+$/, ""));
} catch (err) {
console.log(err);
}
}

const addBinary = async () => {
try {
const binary = await DocumentPicker.pickSingle({
presentationStyle: 'fullScreen',
copyTo: 'cachesDirectory',
type: DocumentPicker.types.allFiles,
})
actions.addBinary(binary.fileCopyUri, binary.name);
} catch (err) {
console.log(err);
}
}

const remove = (item) => {
Expand Down Expand Up @@ -123,7 +137,13 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
if (item.type === 'audio') {
return (
<AudioFile path={item.data} label={item.label} remove={() => remove(item)}
setLabel={(label) => actions.setAudioLabel(item.key, label)} />
setLabel={(label) => actions.setLabel(item.key, label)} />
)
}
if (item.type === 'binary') {
return (
<BinaryFile path={item.data} label={item.label} extension={item.extension} remove={() => remove(item)}
setLabel={(label) => actions.setLabel(item.key, label)} />
)
}
else {
Expand Down Expand Up @@ -171,9 +191,10 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
<MatIcons name="music-box-outline" size={20} color={Colors.text} />
</TouchableOpacity>
)}
{ (state.enableImage || state.enableVideo || state.enableAudio) && (
<View style={styles.divider} />
)}
<TouchableOpacity style={styles.addButton} onPress={addBinary}>
<MatIcons name="all-inclusive-box-outline" size={20} color={Colors.text} />
</TouchableOpacity>
<View style={styles.divider} />
<TouchableOpacity style={styles.addButton} onPress={actions.showFontSize}>
<MatIcons name="format-size" size={20} color={Colors.text} />
</TouchableOpacity>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Image, Text, View, TextInput, TouchableOpacity } from 'react-native';
import { styles } from './BinaryFile.styled';

export function BinaryFile({ path, remove, extension, label, setLabel }) {
return (
<TouchableOpacity style={styles.binary} onLongPress={remove}>
<TextInput style={ styles.input } value={ label } onChangeText={setLabel}
multiline={true} autoCapitalize={'none'} placeholder="Binary Label" />
<View style={styles.extension}>
<Text style={styles.label}>{ extension }</Text>
</View>
</TouchableOpacity>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { StyleSheet } from 'react-native';
import { Colors } from 'constants/Colors';

export const styles = StyleSheet.create({
binary: {
width: 92,
height: 92,
backgroundColor: '#888888',
borderRadius: 4,
marginRight: 16,
display: 'flex',
alignItems: 'center',
},
input: {
maxHeight: 50,
textAlign: 'center',
padding: 4,
color: 'white',
},
extension: {
flexGrow: 1,
display: 'flex',
alignItems: 'flex-end',
justifyContent: 'flex-end',
},
label: {
color: 'white',
fontSize: 24,
},
})
16 changes: 14 additions & 2 deletions app/mobile/src/session/conversation/addTopic/useAddTopic.hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,19 @@ export function useAddTopic(contentKey) {
asset.type = 'audio';
asset.label = label;
updateState({ assets: [ ...state.assets, asset ] });
},
},
addBinary: async (data, name) => {
assetId.current++;
const asset = await setAsset(data);
asset.key = assetId.current;
asset.type = 'binary';
asset.extension = name.split('.').pop().toUpperCase();
asset.label = name.slice(0, -1 * (asset.extension.length + 1));

console.log(asset);

updateState({ assets: [ ...state.assets, asset ] });
},
setVideoPosition: (key, position) => {
updateState({ assets: state.assets.map((item) => {
if(item.key === key) {
Expand All @@ -172,7 +184,7 @@ export function useAddTopic(contentKey) {
})
});
},
setAudioLabel: (key, label) => {
setLabel: (key, label) => {
updateState({ assets: state.assets.map((item) => {
if(item.key === key) {
return { ...item, label };
Expand Down
Loading

0 comments on commit fda8ee6

Please sign in to comment.