Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-05-10 11:27:01

Melonking
Member
Registered: 2022-05-10
Posts: 21
Website

Connecting a publishing client aka using MarsEdit?

Hello forum!
I’m exploring my options for setting up a simple blog site and I’m hoping to use the desktop program MarsEdit, which claims to support Metaweblog and AtomPub as open standard apis.

I seem to get a half impression that Textpattern supports one or some of these? But I cant find any clear documentation on it and I’m a bit lost for answers. I can see a few people on this forum have mentioned MarsEdit, but its starting to look like support for it might be very flaky?

I contacted the MarsEdit developer and he kindly replied quickly but he seemed to think I needed a plugin called XMLRPC, and recommended I use WordPress instead which is something I hoped to avoid because Iv used it in the past and did not like it much, Textpattern seems to be less bloated and I like how the demo works, its exactly the level of simplicity I want.

Anyway, any help or guides would be much appreciated. My key questions are:
Is Textpattern the right choice for me?
Are there any other platforms that would be a better choice if me?
How do I connect MarsEdit to Textpattern?
Is support for MarsEdit and other clients stable, or is it going to improve in the future?


The world will tremble

Offline

#2 2022-05-10 11:30:20

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 3,931
GitHub

Re: Connecting a publishing client aka using MarsEdit?

Hi Melonking -welcome!

Short answer: MarsEdit is an interesting one, since it used to work just fine, but I have a vague memory that some functionality wasn’t supported…and I don’t know anyone around here on the regulars list who’s using it. I’ll give this thread a signal boost on Twitter and see if that sheds any light.

Edit: Textpattern has XML-RPC stuff baked in and off by default (easily turned on via preferences), but it’s not been touched in a long time…so it may work just fine, it may not. I realise that’s not much help!

Last edited by gaekwad (2022-05-10 11:32:24)

Offline

#3 2022-05-10 13:30:54

Melonking
Member
Registered: 2022-05-10
Posts: 21
Website

Re: Connecting a publishing client aka using MarsEdit?

Iv done a little more testing using the demo site;

  1. I turned on XML-RPC in the admin section of the preferences.
  2. I setup MarsEdit using the following settings: * System API: MetaWeblog (I also tried Movable Type, it seems to kinda work too) * Endpoint: http://release-demo.textpattern.co/rpc/ * Blog ID: articles (must always be a section name apparently)

The results; it is partly connecting, MarsEdit can see the template articles on the demo, and it can also see the template categories on the demo. However it gives an unhelpful error 500 when you try and actually post something:

Network message sent: 2022-05-10 13:25:46 +0000
API Endpoint URL: http://release-demo.textpattern.co/rpc/
HTTP Method: POST
Method name: metaWeblog.newPost
Request content:
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
	<methodName>metaWeblog.newPost</methodName>
	<params>
		<param>
			<value><string>articles</string></value>
			</param>
		<param>
			<value><string>[password]</string></value>
			</param>
		<param>
			<value><string>[password]</string></value>
			</param>
		<param>
			<value>
			<struct>
			<member>
			<name>flNotOnHomePage</name>
			<value><boolean>0</boolean></value>
			</member>
			<member>
			<name>title</name>
			<value><string>Test</string></value>
			</member>
			<member>
			<name>categories</name>
			<value>
			<array>
			<data>
			<value><string>Meaningful labor</string></value>
			</data>
			</array>
			</value>
			</member>
			<member>
			<name>description</name>
			<value><string>&lt;p&gt;Hello world&lt;/p&gt;</string></value>
			</member>
			</struct>
			</value>
			</param>
		<param>
			<value><boolean>1</boolean></value>
			</param>
		</params>
	</methodCall>
Network reply received: 2022-05-10 13:25:46 +0000
API Endpoint URL: http://release-demo.textpattern.co/rpc/
Method name: metaWeblog.newPost
Status code: 500
Succeeded: NO
Networking error: --Download Error--
--Fault Error--
Fault code: 0
Fault string:
Response content:
<!-- random-length HTML comment: Vy7yaPfb2bzT8o4n6GFWmQP0ZOcEmy77n2tDHOd7nQRl4JMyORK0fXq3lG7L52Iiuzj0DCxrQCQIMd6auGQOd5HCBEL66TcoICcKCOzRQFZaiW0RaFf2Ak29mE4gVWKeWnmXzboFeBgDVUSwZvoXVgX7kRd4llW8M8TBX7H16l2S5KET5qqOKBJtQmn2M9yY7HYUCdJ8ECO7MSOG63UH4e0JEdBOcxnX49p6cy2g0HbBXqHUjZZb1Pk6slKIYvfQuKKM8BqxIGwdw3vVQKuIZVEF4MNR6qhq0q1xrfizlUQXLCqbKbjiunnoyz3ufbYUHPFyvnlW5zsGzYhAxHihsJKg8DOccnuh2zTla26VsobhA6fyDDTuLbQJddj5GTd6Iuiine1TGS0GPU2QVKAglPqCqN8whZspJOMuqDDwU23hMtvh3uEd9sfp5bZa0FG8UQsATuvlmoIwV2RPmTsjBNM5nlVdqZZ8pG770sgaUnMpfb2Hvkqww2pZb90FWOECU97Ipdi9GsmjJdq4DUpxKSKlR9roNtohsjnXALUF -->

The world will tremble

Offline

#4 2022-05-10 13:58:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: Connecting a publishing client aka using MarsEdit?

Thanks for testing. We do have a few people using MarsEdit for posting to Textpattern. However this may be on older versions of PHP.

There’s a question mark whether the xmlrpc library is php-8 ready. I suspect not. That might account for the error 500 but we’ll need to do some digging to find out exactly what the issue is.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2022-05-10 14:13:34

Melonking
Member
Registered: 2022-05-10
Posts: 21
Website

Re: Connecting a publishing client aka using MarsEdit?

Interesting! My personal server is using PHP 7.4.3 so it might still work if I run in there?

I guess my question then is, should I? Is XMLRPC something that will be maintained, or are you planning to add a replacement api? I suppose in the short term its not such an issue, but Id hate to get all setup with a new platform only to find its no longer updatable in a year or two.

Last edited by Melonking (2022-05-10 14:14:47)


The world will tremble

Offline

#6 2022-05-10 15:12:21

redsweater
Member
From: Boston, MA
Registered: 2007-05-26
Posts: 12
Website Twitter

Re: Connecting a publishing client aka using MarsEdit?

Hi folks – glad to see some progress being made here. Since the 500 error almost always represents some crash in the PHP process on the server end, it might be worth reviewing (after first enabling, if needed) the PHP logs for the server. It will proably shed some light on where things are failing in TextPattern, even if it doesn’t exactly clarify how to work around it.

Daniel

P.S. amused to see the forum identify me as a “New Member” alongside my 2007 registration date! :)

Last edited by redsweater (2022-05-10 15:12:56)

Offline

#7 2022-05-10 17:10:29

Melonking
Member
Registered: 2022-05-10
Posts: 21
Website

Re: Connecting a publishing client aka using MarsEdit?

Thanks for your post red!

OK more testing has been done!
I setup Textpattern (4.8.8) on my server running on PHP 7.4.3 and basic posting works. No error 500! So that’s progress.

However uploading images does not work, when I try and upload an image with my post I get this error. To my untrained eye the image upload api is missing or broken?


Network message sent: 2022-05-10 17:06:02 +0000
API Endpoint URL: https://thoughts.melonking.net/rpc/
HTTP Method: POST
Method name: metaWeblog.newMediaObject
Request content:
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
	<methodName>metaWeblog.newMediaObject</methodName>
	<params>
		<param>
			<value><string>articles</string></value>
			</param>
		<param>
			<value><string>melonking</string></value>
			</param>
		<param>
			<value><string>[password]</string></value>
			</param>
		<param>
			<value>
			<struct>
			<member>
			<name>name</name>
			<value><string>Screenshot 2022-05-04 at 21.58.24.png</string></value>
			</member>
			<member>
			<name>bits</name>
			<value><base64>LOTS OF IMAGE CODE AAAHHHH</base64></value>
			</member>
			<member>
			<name>type</name>
			<value><string>image/png</string></value>
			</member>
			</struct>
			</value>
			</param>
		</params>
	</methodCall>
Network reply received: 2022-05-10 17:05:26 +0000
API Endpoint URL: https://thoughts.melonking.net/rpc/
Method name: metaWeblog.newMediaObject
Status code: 200
Succeeded: NO
Networking error: --Fault Error--
Fault code: -32601
Fault string: server error. requested method "metaWeblog.newMediaObject" not specified.
Response content:
<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value><int>-32601</int></value>
        </member>
        <member>
          <name>faultString</name>
          <value><string>server error. requested method "metaWeblog.newMediaObject" not specified.</string></value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>

Last edited by Melonking (2022-05-10 17:15:03)


The world will tremble

Offline

#8 2022-05-10 17:30:43

redsweater
Member
From: Boston, MA
Registered: 2007-05-26
Posts: 12
Website Twitter

Re: Connecting a publishing client aka using MarsEdit?

Yes, it looks like the newMediaObject implementation was never completed in the TextPattern API support: https://github.com/textpattern/textpattern/blob/52d261210028d754c0e330182a33dfd99f34f94f/rpc/TXP_RPCServer.php#L919

Offline

#9 2022-05-10 17:57:03

Melonking
Member
Registered: 2022-05-10
Posts: 21
Website

Re: Connecting a publishing client aka using MarsEdit?

Ooph that’s a dealbreaker if it cant be fixed.

If I understand correctly (Sorry for totally butchering this Iv not used PHP in 80 years) but I need to do something like this in the TXP_RPCServer.php ?

function mt_newMediaObject($params)
{
	list($postid, $username, $password, $file) = $params;
	$txp = new TXP_Wrapper($username, $password);
	if (!$txp->loggedin) {
		return new IXR_Error(100, gTxt('bad_login'));
	}
	$imagefolder = '/images';
	$imagename = $file->name
	$imagedata = 'data:' + $file->type + ';base64,' + $file->bits
	file_put_contents($imagefolder + '/' + $imagename, file_get_contents($imagedata));
	return WEBSITE_URL + $imagefolder + '/' + $imagename;
}

Edit: I see there is a database entry that needs to happen too, this might require the skills of someone who knows the platform more.

Last edited by Melonking (2022-05-10 18:07:29)


The world will tremble

Offline

#10 2022-05-10 18:26:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: Connecting a publishing client aka using MarsEdit?

Wow. Nice sleuthing. If you’re willing to patch it, we’ll include the code in the next release to support this feature.

Implementation wise, it might be better to piggyback one of our internal functions like image_data() to populate the pic content and metadata. That way, when we refactor the internals, it’ll still work.

Take a look at how images are saved when uploaded from the Images panel. Is that the sort of level of detail you require?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#11 2022-05-10 19:23:18

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 3,931
GitHub

Re: Connecting a publishing client aka using MarsEdit?

redsweater wrote #333229:

P.S. amused to see the forum identify me as a “New Member” alongside my 2007 registration date! :)

You don’t call, you don’t write…was it something we said? ;)

PS: I’ve fixed that New Member thing.

Offline

#12 2022-05-10 19:42:56

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 3,931
GitHub

Re: Connecting a publishing client aka using MarsEdit?

Extracts for Nginx error log: gist.github.com/petecooper/dab36071f708a832bca76a2b92db6e83

Still working on the PHP error logs.

Offline

Board footer

Powered by FluxBB