-
Notifications
You must be signed in to change notification settings - Fork 24
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
Update index.php - json option #132
base: main
Are you sure you want to change the base?
Conversation
Would it possible to generate a simple json reply that holds the port information? I've added an example it this pull for this. Would be useful for detecting latest version etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still reviewing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea.
I am not sure of the potential for abuse, but I'm inclined to this we might want this in a API with logins etc.
header('Content-Type: application/json'); | ||
if (!empty($result)) { | ||
$response = get_object_vars($myPort) | ||
echo json_encode($response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line fails to get json back. If I dump $response, it looks like this:
array(73) {
["dbh"]=>
resource(2) of type (pgsql link)
["id"]=>
string(5) "20643"
["element_id"]=>
string(6) "272629"
["category_id"]=>
string(1) "8"
["short_description"]=>
string(48) "Open source Remote Desktop Protocol (RDP) server"
["long_description"]=>
string(481) "Based on the work of rdesktop, xrdp uses the remote desktop protocol to
present a GUI to the user.
The goal of this project is to provide a fully functional Linux terminal
server, capable of accepting connections from rdesktop and Microsoft's own
terminal server / remote desktop clients.
Unlike Windows NT/2000/2003 server, xrdp will not display a Windows desktop
but an X window desktop to the user.
Xrdp uses Xvnc or X11rdp to manage the X session.
WWW: http://www.xrdp.org/"
["version"]=>
string(6) "0.9.12"
["revision"]=>
string(1) "0"
["epoch"]=>
string(1) "1"
["maintainer"]=>
string(16) "[email protected]"
["homepage"]=>
string(20) "http://www.xrdp.org/"
["master_sites"]=>
string(68) "https://codeload.github.com/neutrinolabs/xrdp/tar.gz/v0.9.12?dummy=/"
["extract_suffix"]=>
NULL
["package_exists"]=>
NULL
["depends_build"]=>
string(445) "/usr/local/bin/nasm:devel/nasm pkgconf>=1.3.0_1:devel/pkgconf autoconf>=2.69:devel/autoconf automake>=1.16.1:devel/automake libtoolize:devel/libtool /usr/local/libdata/pkgconfig/ice.pc:x11/libICE /usr/local/libdata/pkgconfig/pixman-1.pc:x11/pixman /usr/local/libdata/pkgconfig/sm.pc:x11/libSM /usr/local/libdata/pkgconfig/x11.pc:x11/libX11 /usr/local/libdata/pkgconfig/xfixes.pc:x11/libXfixes /usr/local/libdata/pkgconfig/xrandr.pc:x11/libXrandr"
["depends_run"]=>
string(459) "xterm:x11/xterm /usr/local/lib/xorg/modules/libxorgxrdp.so:x11-drivers/xorgxrdp /usr/local/lib/pulse-13.0/modules/module-xrdp-sink.so:audio/pulseaudio-module-xrdp /usr/local/libdata/pkgconfig/ice.pc:x11/libICE /usr/local/libdata/pkgconfig/pixman-1.pc:x11/pixman /usr/local/libdata/pkgconfig/sm.pc:x11/libSM /usr/local/libdata/pkgconfig/x11.pc:x11/libX11 /usr/local/libdata/pkgconfig/xfixes.pc:x11/libXfixes /usr/local/libdata/pkgconfig/xrandr.pc:x11/libXrandr"
["depends_lib"]=>
string(80) "libfdk-aac.so:audio/fdk-aac libopus.so:audio/opus libjpeg.so:graphics/jpeg-turbo"
["last_commit_id"]=>
string(6) "781307"
["found_in_index"]=>
NULL
["forbidden"]=>
NULL
["broken"]=>
NULL
["deprecated"]=>
NULL
["ignore"]=>
NULL
["date_added"]=>
string(20) "04 May 2007 01:13:19"
["categories"]=>
string(3) "net"
["master_port"]=>
NULL
["latest_link"]=>
NULL
["no_latest_link"]=>
NULL
["no_package"]=>
NULL
["package_name"]=>
string(4) "xrdp"
["restricted"]=>
NULL
["no_cdrom"]=>
NULL
["expiration_date"]=>
NULL
["is_interactive"]=>
NULL
["only_for_archs"]=>
NULL
["not_for_archs"]=>
NULL
["status"]=>
string(1) "A"
["showconfig"]=>
string(484) "===> The following configuration options are available for xrdp-0.9.12,1:
DEBUG=off: Build with debugging support
FUSE=off: Enable drive redirection via FUSE (experimental)
IPV6=on: IPv6 protocol support
====> Options available for the group AUDIO_CODEC
FDKAAC=on: Enable Fraunhofer FDK AAC for audio redirection
MP3LAME=off: Enable MP3 Lame for audio redirection
OPUS=on: Enable Opus for audio redirection
===> Use 'make config' to modify these settings"
["license"]=>
string(8) "APACHE20"
["fetch_depends"]=>
NULL
["extract_depends"]=>
NULL
["patch_depends"]=>
NULL
["uses"]=>
string(72) "autoreconf:build compiler:c11 jpeg localbase libtool pkgconfig ssl xorg"
["pkgmessage"]=>
NULL
["distinfo"]=>
string(570) "TIMESTAMP = 1577722873
SHA256 (xrdp/neutrinolabs-xrdp-v0.9.12_GH0.tar.gz) = 74ca5ff341a4428dba2ab409752adda9cfb788c298d8e0388dd6a4221e70ebaa
SIZE (xrdp/neutrinolabs-xrdp-v0.9.12_GH0.tar.gz) = 679189
SHA256 (xrdp/neutrinolabs-librfxcodec-v0.1.5_GH0.tar.gz) = 5710a65a9f877aca5b5bca9f2fb83b5904b59d465ab5c10bcf4ffc2b3416d0c8
SIZE (xrdp/neutrinolabs-librfxcodec-v0.1.5_GH0.tar.gz) = 48387
SHA256 (xrdp/neutrinolabs-libpainter-v0.1.1_GH0.tar.gz) = 6caee8444fbd72677ac5e125c7ac99490688474975451668e751a9d9187ee5e6
SIZE (xrdp/neutrinolabs-libpainter-v0.1.1_GH0.tar.gz) = 13929"
["license_restricted"]=>
NULL
["manual_package_build"]=>
NULL
["license_perms"]=>
NULL
["conflicts"]=>
string(16) "xrdp-devel[0-9]*"
["conflicts_build"]=>
NULL
["conflicts_install"]=>
NULL
["conflicts_matches"]=>
bool(false)
["generate_plist"]=>
NULL
["category"]=>
string(3) "net"
["port"]=>
string(4) "xrdp"
["needs_refresh"]=>
NULL
["updated"]=>
NULL
["onwatchlist"]=>
string(1) "0"
["vulnerable_current"]=>
NULL
["vulnerable_past"]=>
NULL
["pkg_plist_library_matches"]=>
NULL
["update_description"]=>
NULL
["message_id"]=>
NULL
["encoding_losses"]=>
NULL
["last_commit_date"]=>
string(22) "2020-01-08 19:36:47+00"
["svn_revision"]=>
string(6) "522457"
["LocalResult"]=>
NULL
["committer"]=>
NULL
["svn_hostname"]=>
string(18) "svnweb.freebsd.org"
["path_to_repo"]=>
string(6) "/ports"
["element_pathname"]=>
string(20) "/ports/head/net/xrdp"
["quarterly_revision"]=>
string(8) "0.9.12,1"
["category_looking_at"]=>
NULL
}
$result = $myPort->Fetch($category, $port); | ||
header('Content-Type: application/json'); | ||
if (!empty($result)) { | ||
$response = get_object_vars($myPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a trailing ; here
@dlangille I was planning to open an issue to ask for this but it made more sense to write it in code to show it. It could use some more love. Regarding the json_encode. For the abuse part. What if we cache the response and only refresh after x hours? Would be nice if it can be open to hook it up with a shield service like shield.io. We can also close this pull and rework the idea a bit. Maybe run it on a subdomain so we can put something like cloudflare in front? Let me know what you think. We can also take this offline and have chat or skype session if you like. |
We have this installed:
|
It’s loaded in the php.ini that php-fpm or apache is using as well? |
Is there a db schema somewhere so I can setup some kind of dev tomorrow? |
Good question. If this was |
It's there. It's active.
|
If you can upload a temp (secret filename) file with a phpinfo(); in there it should show you where you can find it. |
Oh!
|
Cmd line it can use a different config then fpm but will check my code tomorrow. Really need some sleep now ;) |
The error is: |
Yet |
This fixed it:
|
Try it at https://dev.freshports.org/ but please don't post any URLS here. |
This is what I have now:
|
That reminds of of this older issue which died. It's about badges |
No, but I should create one, that is a good idea. I may be able to repurpose an existing one which is getting much use just now. Please send me a public ssh key and preferred login name. |
|
It's in your mail. Preferred login name: ruud |
Did you get logged in? |
@ruudboon How's it going? What's up? |
I'm hoping to hear back from him about #132 soon
@ruudboon What's up? Anything I can help with? |
Still happy to proceed on this. |
Would it possible to generate a simple json reply that holds the port information? I've added an example it this pull for this.
Would be useful for detecting latest version etc.