Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MergerSite - Zite retains old merger_type permission after modifying wrapperPermissionAdd. #2637

Open
Folaht opened this issue Oct 12, 2020 · 9 comments

Comments

@Folaht
Copy link

@Folaht Folaht commented Oct 12, 2020

Step 1: Please describe your environment

  • ZeroNet version: 0.7.2
  • Operating system: Manjaro
  • Web browser: Firefox
  • Tor status: disabled
  • Opened port: yes
  • Special configuration: no

Step 2: Describe the problem:

I cloned GitCenter.
I downloaded GitCenter and then rewrote it to my liking in order to start my own GitCenter, called ZeroSafe.
My site however is still looking for GitCenter sites.
I've noticed that this is due to this function:

zeroPage.cmd("wrapperPermissionAdd", ["Merger:ZeroSafe"])

This adds a permission, but does not set it.
So whenever I change it, it adds another permission
and when I went a little digging I could not find any command that removes or empties the permissions.
I can't manually remove the in sites.json either and I have no idea where these permissions are stored.

Steps to reproduce:

  1. Open a couple of Gitcenter projects.
  2. Recreate Gitcenter, name it Newcenter.
  3. Edit the following in your Newcenter site:
-- zeroPage.cmd("wrapperPermissionAdd", ["Merger:GitCenter"])
++ zeroPage.cmd("wrapperPermissionAdd", ["Merger:NewCenter"])

Observed Results:

error

Internal error: Exception('Merger site (NewCenter) does not have permission for merged site: 
18r929Hq8hE5Pi9Zf7ovMQVyn3WcGfxMgu (GitCenter)'): Merger site (NewCenter) does not have permission for merged site: 
18r929Hq8hE5Pi9Zf7ovMQVyn3WcGfxMgu (GitCenter)
UiWebsocket.py line 80 > 238 > MergerSite/MergerSitePlugin.py line 168 > 136 > 43

sites.json

permissions: { ..."Gitcenter", "NewCenter"...
}

Expected Results:

Absention of GitCenter permissions.

@JabbaDesilijicTiure
Copy link
Contributor

@JabbaDesilijicTiure JabbaDesilijicTiure commented Oct 12, 2020

Download GitCenter https://github.com/imachug/gitcenter and rewrite it how you like. You should not clone it in my opinion. You can start your own GitCenter in less than 1 hour...

@imachug
Copy link
Contributor

@imachug imachug commented Oct 12, 2020

@Folaht You get this error because the repository 18r929Hq8hE5Pi9Zf7ovMQVyn3WcGfxMgu, which is a so-called merged site, has "merged_type": "GitCenter" field in its content.json, i.e. only sites that have Merger:GitCenter permission can access it. You have two options:

  1. Don't change anything in your cloned GitCenter, i.e. use Merger:GitCenter permission. As a bonus, this allows interoperability between the fork and the original.
  2. Fork 18r929Hq8hE5Pi9Zf7ovMQVyn3WcGfxMgu as well and change it's content.json.

FWIW, I'd follow the first way.

@Folaht
Copy link
Author

@Folaht Folaht commented Oct 12, 2020

Okay, perhaps I have not clarified this correctly.

I cloned GitCenter, because I want to build a seperate GitCenter for Safe Network projects.

Thus the projects I plan to host there will be exclusively Safe Network (non-Zeronet) projects
until the Safe Network is launched with it's own GitCenter.

I do not want to merge with Gitcenter and do not want to see Gitcenter's projects on my site in the index search.
I exclusively want to see Safe Network Projects when one searches on the index page.

18r929Hq8hE5Pi9Zf7ovMQVyn3WcGfxMgu is not a Safe Network project.
It's a GitCenter project.

When I log what the MergerSitePlugin is doing,
it is apparently collecting all mergersites and merged sites and then do a comparison.

[2020-10-12 00:03:20,427] WARNING MergerSite merged_db: {
 '18r929Hq8hE5Pi9Zf7ovMQVyn3WcGfxMgu': 'GitCenter', 
 '1GLtW41usashxjPu2DPf5oAjkfJmzCzwep': 'ZeroSafe', 
 '1MoonP8t4rk9QamBUPh5Aspkwa1Xhf5ux2': 'ZeroMe', 
 '1P4w4Rvh4vS9r6G5xTiSh8qEW87EKZtnJB': 'GitCenter', 
 '1RepoXU8bQE9m7ssNwL4nnxBnZVejHCc6': 'GitCenter', 
 '1UDbADib99KE9d3qZ87NqJF2QLTHmMkoV': 'ZeroMe', 
 '1iNDExENNBsfHc6SKmy1HaeasHhm3RPcL': 'GitCenter', 
 '1indexPGZVWV1je4UKaJMUaq7qfANJFKE': 'ZeroSafe', 
 '1repoxUzv9wqeNqm3V9hzPEa17UgFew2a': 'ZeroSafe'
}
[2020-10-12 00:03:20,428] WARNING MergerSite merger_db: 
{
 '1GitLiXB6t5r8vuU2zC6a8GYj9ME6HMQ4t': ['GitCenter'], 
 '1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH': ['ZeroMe'], 
 '1SafeQmarbvJizjmx4TNf4DfkqzV9rLPE': ['GitCenter', 'SafeNetwork', 'ZeroSafe']
}

Nowhere do I define that my main site 1SafeQmarbvJizjmx4TNf4DfkqzV9rLPE
is part of 'GitCenter', nor of 'SafeNetwork'.

This is stored at sites.json that I do not know where it gets it's data from.
I'm assuming this is coming from a Zeronet database that I do not have access to.

@imachug
Copy link
Contributor

@imachug imachug commented Oct 12, 2020

What exact revision/commit of ZeroNet are you running? I'm not sure what MergerSite/MergerSitePlugin.py line 169 refers to

@Folaht
Copy link
Author

@Folaht Folaht commented Oct 12, 2020

The latest, but I edited it to put a logger in.
I'll reset the source code.
It's line 168 > 136 > 43

@Folaht
Copy link
Author

@Folaht Folaht commented Oct 15, 2020

Alright. I believe there's at least a hacky solution to this without altering zeronet's source code.
Just add a "merged_site" on the content.json of one's site in order to remove the "merger_site" permission you want to get rid of, siteSign it, remove the "merged_site" line and siteSign it again.

@imachug
Copy link
Contributor

@imachug imachug commented Oct 15, 2020

Okay, so the problem is apparently that removing merged_type from content.json doesn't actually make the site non-merged. Could you please maybe rename the issue and update the body to state that that's the root problem please @Folaht?

@JabbaDesilijicTiure
Copy link
Contributor

@JabbaDesilijicTiure JabbaDesilijicTiure commented Oct 16, 2020

@Folaht you could just copy the sites content to a new site you create with siteCreate, delete the old site and problem solved. This stupid merger thing is irritating me for a while already.

@Folaht Folaht changed the title MergerSite - Cloned a zite. Now I'm stuck with the zite permission of the old zite. MergerSite - Zite retains merger_type. Oct 19, 2020
@Folaht Folaht changed the title MergerSite - Zite retains merger_type. MergerSite - Zite retains merger_type after modifying wrapperPermissionAdd. Oct 19, 2020
@Folaht Folaht changed the title MergerSite - Zite retains merger_type after modifying wrapperPermissionAdd. MergerSite - Zite retains old merger_type permission after modifying wrapperPermissionAdd. Oct 19, 2020
@Folaht
Copy link
Author

@Folaht Folaht commented Oct 19, 2020

@Folaht you could just copy the sites content to a new site you create with siteCreate, delete the old site and problem solved. This stupid merger thing is irritating me for a while already.

Thanks, but that is not necessary.
I already provided a hacky solution in my previous post what one can do without having to resort to bulldozing your site and creating a new one from scratch, so people don't have to be punished for deciding to change the merger name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.