Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit c2edde4

Browse files
authored
Merge pull request #458 from kodadot/subsocial
subsocial
2 parents 6fc23d2 + 55799ae commit c2edde4

38 files changed

+1701
-62
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,5 @@ typings/
7878
.yarn-integrity
7979

8080
# dotenv environment variables file
81-
.env
81+
.env
82+
.vscode/

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"@polkadot/util": "^6.9.1",
2828
"@polkadot/util-crypto": "^6.9.1",
2929
"@polkadot/vue-identicon": "^0.81.1",
30+
"@subsocial/api": "^0.5.8",
31+
"@subsocial/types": "^0.5.8",
32+
"@subsocial/utils": "^0.4.39",
3033
"@textile/hub": "^6.1.2",
3134
"@types/file-saver": "^2.0.2",
3235
"@vue-polkadot/vue-api": "^0.0.34",

src-functions/pinPost.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import axios from "axios"
2+
3+
exports.handler = async (event, context) => {
4+
5+
6+
// const location = event.queryStringParameters.location || "home";
7+
const BASE_URL = 'https://staging.subsocial.network/offchain/v1/ipfs/add';
8+
const object = event.body;
9+
10+
try {
11+
const { status, data } = await axios.post(BASE_URL, object, {
12+
headers: {
13+
'Content-Type': 'application/json',
14+
},
15+
});
16+
console.log('[SUBSOCIAL] Pin JSON', status, data);
17+
18+
if (status < 400) {
19+
return {
20+
statusCode: status,
21+
body: data,
22+
};
23+
}
24+
25+
26+
} catch (e) {
27+
console.log('Error', e.message)
28+
return {
29+
statusCode: 500,
30+
body: e.message,
31+
};
32+
}
33+
34+
return {
35+
statusCode: status,
36+
body: "",
37+
};
38+
39+
40+
};
41+

src-functions/requestFaucet.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import axios from "axios"
2+
3+
exports.handler = async (event, context) => {
4+
5+
6+
const address = event.queryStringParameters.address;
7+
const email = event.queryStringParameters.email;
8+
9+
if (!email || !address) {
10+
return {
11+
statusCode: 403,
12+
body: `Cannot search without query`,
13+
};
14+
}
15+
16+
const BASE_URL = `https://app.subsocial.network/offchain/v1/offchain/faucet/confirm`;
17+
18+
const object = {
19+
account: address,
20+
email
21+
};
22+
23+
try {
24+
const { status, data } = await axios.post(BASE_URL, object, {
25+
headers: {
26+
'Content-Type': 'application/json',
27+
},
28+
});
29+
console.log('[SUBSOCIAL] Faucet', status);
30+
31+
return {
32+
statusCode: status,
33+
body: JSON.stringify(data),
34+
};
35+
36+
37+
} catch (e) {
38+
console.log('Error', e.message)
39+
return {
40+
statusCode: 500,
41+
body: e.message,
42+
};
43+
}
44+
45+
};
46+

src-functions/searchPost.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import axios from "axios"
2+
3+
exports.handler = async (event, context) => {
4+
5+
6+
const query = event.queryStringParameters.query;
7+
8+
if (!query) {
9+
return {
10+
statusCode: 403,
11+
body: `Cannot search without query`,
12+
};
13+
}
14+
15+
const BASE_URL = `https://app.subsocial.network/offchain/v1/offchain/search?indexes=posts&q=${query}&offset=0&limit=20`;
16+
17+
try {
18+
const { status, data } = await axios.get(BASE_URL, {
19+
headers: {
20+
'Content-Type': 'application/json',
21+
},
22+
});
23+
console.log('[SUBSOCIAL] Search', status);
24+
25+
return {
26+
statusCode: status,
27+
body: JSON.stringify(data),
28+
};
29+
30+
31+
} catch (e) {
32+
console.log('Error', e.message)
33+
return {
34+
statusCode: 500,
35+
body: e.message,
36+
};
37+
}
38+
39+
};
40+

src/App.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import Navbar from './components/Navbar.vue';
2222
import Footer from './components/Footer.vue';
2323
import isShareMode from '@/utils/isShareMode'
2424
import coingecko from '@/coingecko'
25+
import correctFormat from '@/utils/ss58Format'
2526
2627
@Component<Dashboard>({
2728
metaInfo() {
@@ -54,7 +55,7 @@ export default class Dashboard extends Vue {
5455
public async loadKeyring(): Promise<void> {
5556
const isDevelopment = process.env.VUE_APP_KEYRING === 'true'
5657
keyring.loadAll({
57-
ss58Format: isDevelopment ? 0 : this.ss58Format || 42,
58+
ss58Format: correctFormat(this.ss58Format),
5859
type: 'sr25519',
5960
isDevelopment,
6061
});

src/assets/subsocial.svg

Lines changed: 9 additions & 0 deletions
Loading

src/components/rmrk/Create/AttributeTagInput.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ export default class extends Vue {
4040
@Prop() public value!: Attribute[];
4141
@Prop({ default: 3 }) public max!: string | number;
4242
@Prop({ default: 'Select tags or create your own' }) public placeholder!: string;
43+
@Prop(Boolean) public simple!: boolean
4344
4445
get tags() {
45-
return this.value ? this.value.map(valueOf) : []
46+
return this.simple ? (this.value || []) as any[] as string[] : (this.value || []).map(valueOf)
4647
}
4748
4849
set tags(value: string[]) {
@@ -51,7 +52,7 @@ export default class extends Vue {
5152
5253
@Emit('input')
5354
handleInput(value: string[]) {
54-
return value.map(v => ({ value: v }))
55+
return this.simple ? value : value.map(v => ({ value: v }))
5556
}
5657
}
5758
</script>

src/components/rmrk/Gallery/EmotionList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ export default class extends Vue {
6060
}
6161
6262
#emoji-box {
63-
border: 2px solid $primary;
63+
border: 2px solid $primary;
6464
}
6565
</style>

src/components/rmrk/Gallery/GalleryItem.vue

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@
104104
</template>
105105
</div>
106106
</div>
107+
<hr class="comment-divider" />
108+
<BaseCommentSection :nft="nft" :meta="meta" />
107109
</div>
110+
108111
</div>
109112
</template>
110113

@@ -117,12 +120,12 @@ import { NFT, NFTMetadata, Emotion, Emote } from '../service/scheme';
117120
import { sanitizeIpfsUrl, resolveMedia } from '../utils';
118121
import { emptyObject } from '@/utils/empty';
119122
120-
import AvailableActions from './AvailableActions.vue';
123+
// import AvailableActions from './AvailableActions.vue';
121124
import { notificationTypes, showNotification } from '@/utils/notification';
122-
import Money from '@/components/shared/format/Money.vue';
123-
import Sharing from '@/components/rmrk/Gallery/Item/Sharing.vue';
124-
import Facts from '@/components/rmrk/Gallery/Item/Facts.vue';
125-
import Name from '@/components/rmrk/Gallery/Item/Name.vue';
125+
// import Money from '@/components/shared/format/Money.vue';
126+
// import/ Sharing from '@/components/rmrk/Gallery/Item/Sharing.vue';
127+
// import Facts from '@/components/rmrk/Gallery/Item/Facts.vue';
128+
// import Name from '@/components/rmrk/Gallery/Item/Name.vue';
126129
127130
import isShareMode from '@/utils/isShareMode';
128131
import nftById from '@/queries/nftById.graphql'
@@ -152,15 +155,16 @@ import axios from 'axios';
152155
},
153156
components: {
154157
Auth: () => import('@/components/shared/Auth.vue'),
155-
AvailableActions,
156-
Facts,
158+
AvailableActions: () => import('./AvailableActions.vue'),
159+
Facts: () => import('@/components/rmrk/Gallery/Item/Facts.vue'),
157160
// MarkdownItVueLight: MarkdownItVueLight as VueConstructor<Vue>,
158-
Money,
159-
Name,
160-
Sharing,
161+
Money: () => import('@/components/shared/format/Money.vue'),
162+
Name: () => import('@/components/rmrk/Gallery/Item/Name.vue'),
163+
Sharing: () => import('@/components/rmrk/Gallery/Item/Sharing.vue'),
161164
Appreciation: () => import('./Appreciation.vue'),
162165
MediaResolver: () => import('../Media/MediaResolver.vue'),
163-
PackSaver: () => import('../Pack/PackSaver.vue')
166+
PackSaver: () => import('../Pack/PackSaver.vue'),
167+
BaseCommentSection: () => import('@/components/subsocial/BaseCommentSection.vue')
164168
}
165169
})
166170
export default class GalleryItem extends Vue {
@@ -290,6 +294,11 @@ export default class GalleryItem extends Vue {
290294
<style lang="scss">
291295
@import "@/styles/variables";
292296
297+
hr.comment-divider {
298+
border-top: 1px solid lightpink;
299+
border-bottom: 1px solid lightpink;
300+
}
301+
293302
.gallery-item {
294303
.nft-title {
295304
margin-bottom: 24px;

0 commit comments

Comments
 (0)