mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-04-10 04:39:16 +02:00
create mutelist if it doesnt exist for a user
This commit is contained in:
parent
a0a2f1e881
commit
032b82caab
2
.idea/dvm.iml
generated
2
.idea/dvm.iml
generated
@ -7,7 +7,7 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv_package_test" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv_package_test2" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (dvm) (3)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.11 (dvm)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -3,5 +3,5 @@
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.10 (dvm)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (dvm) (3)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (dvm)" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -6,32 +6,40 @@ Reusable backend functions can be defined in backends (e.g. API calls)
|
||||
|
||||
Current List of Tasks:
|
||||
|
||||
| Module | Kind | Description | Backend |
|
||||
|--------------------------------|--------|------------------------------------------------------------|------------------|
|
||||
| TextExtractionPDF | 5000 | Extracts Text from a PDF file | local |
|
||||
| SpeechToTextGoogle | 5000 | Extracts Speech from Media files via Google Services | googleAPI |
|
||||
| SpeechToTextWhisperX | 5000 | Extracts Speech from Media files via local WhisperX | nserver |
|
||||
| ImageInterrogator | 5000 | Extracts Prompts from Images | nserver |
|
||||
| TextSummarizationHuggingChat | 5001 | Summarizes given Input | huggingface |
|
||||
| TranslationGoogle | 5002 | Translates Inputs to another language | googleAPI |
|
||||
| TranslationLibre | 5002 | Translates Inputs to another language | libreAPI |
|
||||
| TextGenerationLLMLite | 5050 | Chat with LLM backends like Ollama, ChatGPT etc | local/api/openai |
|
||||
| TextGenerationHuggingChat | 5050 | Chat with LLM backend on Huggingface | huggingface |
|
||||
| TextGenerationLLMUnleashedChat | 5050 | Chat with unleashed.chat LLMs | unleashed api |
|
||||
| ImageGenerationSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | nserver |
|
||||
| ImageGenerationSDXLIMG2IMG | 5100 | Generates an Image from an Image with Stable Diffusion XL | nserver |
|
||||
| ImageGenerationReplicateSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | replicate |
|
||||
| ImageGenerationMLX | 5100 | Generates an Image with Stable Diffusion 2.1 on M1/2/3 Mac | mlx |
|
||||
| ImageGenerationDALLE | 5100 | Generates an Image with OpenAI's Dall-E | openAI |
|
||||
| ImageUpscale | 5100 | Upscales an Image | nserver |
|
||||
| MediaConverter | 5200 | Converts a link of a media file and uploads it | openAI |
|
||||
| VideoGenerationReplicateSVD | 5202 | Generates a Video from an Image | replicate |
|
||||
| VideoGenerationSVD | 5202 | Generates a Video from an Image | nserver |
|
||||
| TextToSpeech | 5250 | Generate Audio from a prompt | local |
|
||||
| TrendingNotesNostrBand | 5300 | Show trending notes on nostr.band | nostr.band api |
|
||||
| DiscoverInactiveFollows | 5301 | Find inactive Nostr users | local |
|
||||
| AdvancedSearch | 5302 | Search Content on relays (nostr.band) | local/nostr.band |
|
||||
| AdvancedSearchWine | 5302 | Search Content on nostr.wine | api/nostr.wine |
|
||||
| Module | Kind | Description | Backend |
|
||||
|--------------------------------------|------|------------------------------------------------------------|------------------|
|
||||
| TextExtractionPDF | 5000 | Extracts Text from a PDF file | local |
|
||||
| SpeechToTextGoogle | 5000 | Extracts Speech from Media files via Google Services | googleAPI |
|
||||
| SpeechToTextWhisperX | 5000 | Extracts Speech from Media files via local WhisperX | nserver |
|
||||
| ImageInterrogator | 5000 | Extracts Prompts from Images | nserver |
|
||||
| TextSummarizationHuggingChat | 5001 | Summarizes given Input | huggingface |
|
||||
| **TextSummarizationUnleasedChat** | 5001 | Summarizes given Input | unleashed api |
|
||||
| TranslationGoogle | 5002 | Translates Inputs to another language | googleAPI |
|
||||
| TranslationLibre | 5002 | Translates Inputs to another language | libreAPI |
|
||||
| TextGenerationLLMLite | 5050 | Chat with LLM backends like Ollama, ChatGPT etc | local/api/openai |
|
||||
| TextGenerationHuggingChat | 5050 | Chat with LLM backend on Huggingface | huggingface |
|
||||
| TextGenerationLLMUnleashedChat | 5050 | Chat with unleashed.chat LLMs | unleashed api |
|
||||
| ImageGenerationSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | nserver |
|
||||
| ImageGenerationSDXLIMG2IMG | 5100 | Generates an Image from an Image with Stable Diffusion XL | nserver |
|
||||
| ImageGenerationReplicateSDXL | 5100 | Generates an Image from Prompt with Stable Diffusion XL | replicate |
|
||||
| ImageGenerationMLX | 5100 | Generates an Image with Stable Diffusion 2.1 on M1/2/3 Mac | mlx |
|
||||
| ImageGenerationDALLE | 5100 | Generates an Image with OpenAI's Dall-E | openAI |
|
||||
| ImageUpscale | 5100 | Upscales an Image | nserver |
|
||||
| MediaConverter | 5200 | Converts a link of a media file and uploads it | openAI |
|
||||
| VideoGenerationReplicateSVD | 5202 | Generates a Video from an Image | replicate |
|
||||
| VideoGenerationSVD | 5202 | Generates a Video from an Image | nserver |
|
||||
| TextToSpeech | 5250 | Generate Audio from a prompt | local |
|
||||
| TrendingNotesNostrBand | 5300 | Show trending notes on nostr.band | nostr.band api |
|
||||
| **Discover Currently Popular Notes** | 5300 | Show trending notes in the last 2 hours | local/db |
|
||||
| **Discover CPN Followers** | 5300 | Show trending notes by people you follow | local/db |
|
||||
| DiscoverInactiveFollows | 5301 | Find inactive Nostr users | local |
|
||||
| **DiscoverNonFollows** | 5301 | Find Nostr users not following back | local |
|
||||
| **Discover Bot Farms** | 5301 | Find Bots, so you can mute them | local |
|
||||
| **Discover Censor WOT** | 5301 | Find users that have been reported by your follows/WOT | local |
|
||||
| AdvancedSearch | 5302 | Search Content on relays (nostr.band) | local/nostr.band |
|
||||
| AdvancedSearchWine | 5302 | Search Content on nostr.wine | api/nostr.wine |
|
||||
| **Search Users** | 5303 | Search Users based on search terms | local/db |
|
||||
| **Subscriptions** | 5906 | Manage Subscriptions for other DVMS | local |
|
||||
|
||||
Kinds with (inoff) are suggestions and not merged yet and might change in the future.
|
||||
Backends might require to add an API key to the .env file or run an external server/framework the dvm will communicate with.
|
@ -889,9 +889,14 @@ async function mute_all(results){
|
||||
let mute_filter = new Filter().author(publicKey).kind(10000)
|
||||
let mutes = await client.getEventsOf([mute_filter], Duration.fromSecs(5))
|
||||
console.log(mutes.length)
|
||||
|
||||
|
||||
let list = new Event()
|
||||
|
||||
if (mutes.length > 0) {
|
||||
let list = mutes[0]
|
||||
let id = list.id.toHex()
|
||||
list = mutes[0]
|
||||
|
||||
|
||||
try {
|
||||
let eventasjson = JSON.parse(list.asJson())
|
||||
let content = await (await signer).nip04Decrypt(store.state.pubkey, list.content)
|
||||
@ -938,14 +943,35 @@ async function mute_all(results){
|
||||
console.log("Inner " + error)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch(error){
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
else{
|
||||
// TODO make new mute list
|
||||
}
|
||||
|
||||
else{
|
||||
let jsonObject = []
|
||||
for (let result of results){
|
||||
jsonObject.push(["p", result.authorid])
|
||||
store.state.mutes.push(result.authorid)
|
||||
}
|
||||
|
||||
|
||||
let newcontent = JSON.stringify(jsonObject)
|
||||
let content = await (await signer).nip04Encrypt(store.state.pubkey, newcontent)
|
||||
let tags = []
|
||||
let newList = new EventBuilder(10000, content, tags).toUnsignedEvent(store.state.pubkey)
|
||||
try{
|
||||
let signedMuteList = await signer.signEvent(newList)
|
||||
//console.log(signedMuteList.asJson())
|
||||
let id = await client.sendEvent(signedMuteList)
|
||||
console.log(id)
|
||||
}
|
||||
catch (error){
|
||||
console.log("Inner " + error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -998,7 +1024,8 @@ async function mute(result) {
|
||||
try{
|
||||
let signedMuteList = await signer.signEvent(newList)
|
||||
//console.log(signedMuteList.asJson())
|
||||
await client.sendEvent(signedMuteList)
|
||||
let id = await client.sendEvent(signedMuteList)
|
||||
console.log(id)
|
||||
}
|
||||
catch (error){
|
||||
console.log("Inner " + error)
|
||||
@ -1010,7 +1037,26 @@ async function mute(result) {
|
||||
}
|
||||
}
|
||||
else{
|
||||
// TODO make new mute list
|
||||
let jsonObject = []
|
||||
|
||||
jsonObject.push(["p", result.authorid])
|
||||
store.state.mutes.push(result.authorid)
|
||||
|
||||
|
||||
|
||||
let newcontent = JSON.stringify(jsonObject)
|
||||
let content = await (await signer).nip04Encrypt(store.state.pubkey, newcontent)
|
||||
let tags = []
|
||||
let newList = new EventBuilder(10000, content, tags).toUnsignedEvent(store.state.pubkey)
|
||||
try{
|
||||
let signedMuteList = await signer.signEvent(newList)
|
||||
//console.log(signedMuteList.asJson())
|
||||
let id = await client.sendEvent(signedMuteList)
|
||||
console.log(id)
|
||||
}
|
||||
catch (error){
|
||||
console.log("Inner " + error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,7 +217,7 @@ let nip89dvms = []
|
||||
|
||||
let logger = false
|
||||
|
||||
|
||||
let logoutcounter = 0
|
||||
|
||||
|
||||
export default {
|
||||
@ -321,7 +321,7 @@ export default {
|
||||
|
||||
if (e.detail.type === "login") {
|
||||
//await this.state.client.shutdown()G;
|
||||
// await this.sign_in_nostr_login(false)
|
||||
//await this.sign_in_nostr_login(false)
|
||||
let pubkeyinfo = localStorage.getItem('__nostrlogin_nip46')
|
||||
console.log(JSON.parse(pubkeyinfo).pubkey)
|
||||
//await this.get_user_info(JSON.parse(pubkeyinfo).pubkey)
|
||||
@ -329,10 +329,13 @@ export default {
|
||||
console.log("Logged in")
|
||||
}
|
||||
|
||||
if (e.detail.type === "logout") {
|
||||
/*await this.sign_out()
|
||||
if (e.detail.type === "logout" && logoutcounter === 0) {
|
||||
logoutcounter = logoutcounter + 1
|
||||
}
|
||||
else if (e.detail.type === "logout" && logoutcounter > 0) {
|
||||
// await this.sign_out()
|
||||
//await this.state.client.shutdown()G;
|
||||
await this.sign_in_anon() */
|
||||
//await this.sign_in_anon()
|
||||
console.log("Logged out")
|
||||
}
|
||||
},
|
||||
@ -936,53 +939,79 @@ export default {
|
||||
let mute_filter = new Filter().author(publicKey).kind(10000)
|
||||
let mutes = await dbclient.getEventsOf([mute_filter], Duration.fromSecs(5))
|
||||
let mutelist = []
|
||||
store.commit('set_mutes', mutelist)
|
||||
if(mutes.length > 0){
|
||||
|
||||
for (let list of mutes){
|
||||
|
||||
try {
|
||||
for (let tag of list.tags) {
|
||||
if (tag.asVec()[0] === "p") {
|
||||
//console.log(tag.asVec()[1])
|
||||
mutelist.push(tag.asVec()[1])
|
||||
|
||||
for (let tag of list.tags){
|
||||
if (tag.asVec()[0] === "p"){
|
||||
//console.log(tag.asVec()[1])
|
||||
mutelist.push(tag.asVec()[1])
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(error){
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log("Public mutes: " + mutelist.length)
|
||||
|
||||
//private mutes
|
||||
try {
|
||||
console.log("HELLO")
|
||||
let content = ""
|
||||
//console.log(store.state.pubkey.toHex())
|
||||
//console.log(list.content)
|
||||
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
||||
/* if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
||||
content = await amberSignerService.nip04Decrypt(store.state.pubkey.toHex(), list.content)
|
||||
|
||||
}
|
||||
else{
|
||||
*/
|
||||
|
||||
try{
|
||||
console.log("HELLO2")
|
||||
|
||||
content = await this.signer.nip04Decrypt(store.state.pubkey, list.content)
|
||||
console.log("HELL3")
|
||||
|
||||
console.log(content)
|
||||
}
|
||||
}
|
||||
|
||||
catch(error){
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
|
||||
let json = JSON.parse(content)
|
||||
for (let entry of json) {
|
||||
if (entry[0] === "p") {
|
||||
console.log(entry[1])
|
||||
//console.log(entry[1])
|
||||
mutelist.push(entry[1])
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(error){
|
||||
//console.log(error)
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
console.log("Overall mutes: " + mutelist.length)
|
||||
}
|
||||
store.commit('set_mutes', mutelist)
|
||||
}
|
||||
else{
|
||||
console.log("No mute list found")
|
||||
}
|
||||
|
||||
|
||||
await dbclient.reconcile(filter, opts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user