Skip to content

Conversation

@infinyte-solutions
Copy link
Contributor

What changed

Refactored removeFromURLs() to remove the plugin URL pattern using a targeted regex and in-place editing, instead of rewriting the entire file and dropping any line containing pluginName.

Why

The old approach could remove unrelated lines containing the plugin name and sometimes left malformed path( entries after partial edits.

How

  • Uses a compiled regex to find the path(...pluginName...) entry.
  • Edits the file in-place and removes only the first matching line.
  • Returns True/False depending on whether a removal happened.
  • Generates a .bak backup during write.

Test

Ran removeFromURLs('') and verified:

  • the corresponding path('/', include('.urls')), line was removed
  • file remains syntactically valid
  • function returns True when removed, False when not found

- Replace full file rewrite with in-place edit (fileinput) to remove one matching URL pattern.

- Use regex match to target only the plugin path/include line instead of removing any line containing the plugin name.

- Return boolean flag indicating whether a line was removed.

- Create .bak backup to reduce risk during edits.
@master3395
Copy link
Collaborator

Plugin system is being re-written in 2.5.5-dev to support buttons and more.
I will look into this, if this is affected in 2.5.5-dev.
https://github.com/usmannasir/cyberpanel/tree/v2.5.5-dev

@infinyte-solutions
Copy link
Contributor Author

@master3395 @usmannasir Thanks for the update. We can contribute on the v2.5.5-dev branch as well—happy to help review or implement any needed changes for the new plugin system (buttons, etc.). Once we have a fix, we can open a PR against that branch.

@master3395
Copy link
Collaborator

@master3395 @usmannasir Thanks for the update. We can contribute on the v2.5.5-dev branch as well—happy to help review or implement any needed changes for the new plugin system (buttons, etc.). Once we have a fix, we can open a PR against that branch.

Sounds good.
So far i have 1 bug, that i need to fix, before i can push more to 2.5.5-dev
I managed to break the angularjs, so no stats in the base and createWordpress.
But other than that, everything works so far.
image

But the new plugin system is coming along nicely :)
And also a nice notification dismissed badge.
image

I made the repository load from my own repo for now, until @usmannasir makes his own :)
https://github.com/master3395/cyberpanel-plugins

I will also show the "Author" of the plugin, in the store also.

image image image image

@master3395
Copy link
Collaborator

Fixed the angularjs, and also added author to the store :)
c234265

@Josuearv
Copy link

@master3395 Do you need any more help with this?

@master3395
Copy link
Collaborator

@master3395 Do you need any more help with this?

So far, i do not think so.
Everything is almost ready before the test on several OS.

I do have another feature I'm working on that i still need to debug before going live.

Clicking "Ban ip" from the base "Recent SSH Logs" will add it to the new firewall-banned IP list.
It will use the same setup that the command in that section used before firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=117.5.149.191 drop" && firewall-cmd --reload

So people can either use SSH to do that command, and it will show up in the firewall tab, or click the ban button in the base.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants