Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Oh, wait, that was Randal...nevermind... -- Larry Wall in <199709261754.KAA23761@wall.org>


devel / comp.infosystems.gemini / Re: Firefox text/gemini

SubjectAuthor
* Firefox text/gemininews
`* Re: Firefox text/geminithreeoh6000
 `* Re: Firefox text/gemininews
  `* Re: Firefox text/geminiJason McBrayer
   +* Re: Firefox text/gemininews
   |`- Re: Firefox text/geminiCyrus Valkonen
   `- Re: Firefox text/geminiChristian Seibold

1
Firefox text/gemini

<1646501357.bystand@zzo38computer.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=203&group=comp.infosystems.gemini#203

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!P703Hxu1m1uplaQVJzdzug.user.46.165.242.75.POSTED!not-for-mail
From: news@zzo38computer.org.invalid
Newsgroups: comp.infosystems.gemini
Subject: Firefox text/gemini
Date: Sat, 05 Mar 2022 09:42:23 -0800
Organization: Aioe.org NNTP Server
Message-ID: <1646501357.bystand@zzo38computer.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="62631"; posting-host="P703Hxu1m1uplaQVJzdzug.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: bystand/1.3.0pre
X-Notice: Filtered by postfilter v. 0.9.2
 by: news@zzo38computer.org.invalid - Sat, 5 Mar 2022 17:42 UTC

I made implementation of the Gemini file format in Firefox; however, I had not
implemented the Gemini protocol yet. It will still work with data: URIs, and
with local files and Gempub (if you associate the .gmi extension with the Gemini
format in the mimeTypes.rdf), and I guess also HTTP(S) (although I have not
tested its use with HTTP(S) so far).

I used the userChrome.js and added the following:

(function() {
var Conv=function() {
this.state=0;
this.in="";
this.out="<"+"HTML application=\"gemini-text\">";
};
var tohtml=function(s) {
return s.replace(/[<>'"&]/g,function(x){return "&#"+x.charCodeAt(0)+";";});
};
Conv.prototype.add=function(s) {
this.in+=s;
var i=this.in.indexOf("\n");
while(i>=0) {
this.addLine(this.in.slice(0,i));
this.in=this.in.slice(i+1);
i=this.in.indexOf("\n");
}
};
Conv.prototype.addLine=function(s) {
var i,z;
if(this.state==0) {
this.state=1;
if(s[0]=="#") this.out+="<"+"title>"+tohtml(s.slice(1))+"</title>\n";
}
if(this.state==3 && s) this.state=1;
if(this.state==1) {
if(s.slice(0,3)=="```") {
this.state=2;
this.out+="<pre>";
} else if(s[0]=="#") {
for(i=1;i<6 && s[i]==="#";i++);
this.out+="<h"+i+">"+tohtml(s.slice(i).trim())+"</h"+i+">";
this.state=3;
} else if(s[0]=="=" && s[1]==">") {
s=s.slice(2).trim();
i=s.indexOf(" ");
if(i>=0) z=s.slice(0,i),s=s.slice(i).trim(); else z=s;
this.out+="<"+"a href=\""+tohtml(z)+"\">"+tohtml(s)+"</a><br>\n";
} else {
this.out+=tohtml(s)+"<br>\n";
}
} else if(this.state==2) {
if(s.slice(0,3)=="```") {
this.state=1;
this.out+="</pre>\n";
} else {
this.out+=tohtml(s)+"\n";
}
}
};
Conv.prototype.read=function() {
var x=this.out;
this.out="";
return x;
};
var G=function(){};
var o=G.prototype={
classDescription: "_geminiFileFormat",
classID: Components.ID("{aac00a22-9c4c-11ec-a2da-002618745416}"),
contractID: "@mozilla.org/streamconv;1?from=text/gemini&to=*/*",
convert: function(stream,fromtype,totype,context) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
asyncConvertData: function(fromtype,totype,listener,context) {
listener.QueryInterface(Ci.nsIStreamListener);
this.listener=listener;
this.offset=0;
this.pipe=Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
this.pipe.init(false,false,0,0,null);
this.conv=new Conv();
},
getConvertedType: function(type,channel) {
if(type.indexOf(";")!=-1) return "text/html"+type.slice(type.indexOf(";"));
return "text/html";
},
onDataAvailable: function(request,context,stream,offset,count) {
let s=NetUtil.readInputStreamToString(stream,count,{});
this.conv.add(s);
let d=this.conv.read();
this.pipe.outputStream.write(d,d.length);
this.listener.onDataAvailable(request,context,this.pipe.inputStream,this.offset,d.length);
this.offset+=d.length;
},
onStartRequest: function(request,context) {
request.QueryInterface(Ci.nsIChannel);
request.contentType="text/html";
this.listener.onStartRequest(request,context);
},
onStopRequest: function(request,context,status) {
if(this.conv.in) {
this.conv.add("\n");
let d=this.conv.read();
this.pipe.outputStream.write(d,d.length);
this.listener.onDataAvailable(request,context,this.pipe.inputStream,this.offset,d.length);
}
this.listener.onStopRequest(request,context,status);
delete this.listener;
delete this.pipe;
delete this.conv;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamConverter,Ci.nsIStreamListener,Ci.nsIRequestObserver]),
};
var r=Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
r.registerFactory(o.classID,o.classDescription,o.contractID,XPCOMUtils._getFactory(G));
})();

You must also add the appropriate entries into the mimeTypes.rdf file.

There may (probably) be some mistakes; please tell me if you had found any mistakes.

--
Don't laugh at the moon when it is day time in France.

Re: Firefox text/gemini

<d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=233&group=comp.infosystems.gemini#233

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: threeoh6000@news.eternal-september.org (threeoh6000)
Newsgroups: comp.infosystems.gemini
Subject: Re: Firefox text/gemini
Date: Fri, 15 Apr 2022 18:40:25 +0100
Organization: A noiseless patient Spider
Lines: 121
Message-ID: <d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org>
References: <1646501357.bystand@zzo38computer.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="84997d8af14b885f1d534d757feb0aa3";
logging-data="20018"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181lilDZxmJgUs2oYEkd3LRIrAoZxNrbQg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Cancel-Lock: sha1:HAY+whSI1hgGQhQxu4u1lfszYBM=
In-Reply-To: <1646501357.bystand@zzo38computer.org>
Content-Language: en-US
 by: threeoh6000 - Fri, 15 Apr 2022 17:40 UTC

On 05/03/2022 17:42, news@zzo38computer.org.invalid wrote:
> I made implementation of the Gemini file format in Firefox; however, I had not
> implemented the Gemini protocol yet. It will still work with data: URIs, and
> with local files and Gempub (if you associate the .gmi extension with the Gemini
> format in the mimeTypes.rdf), and I guess also HTTP(S) (although I have not
> tested its use with HTTP(S) so far).
>
> I used the userChrome.js and added the following:
>
> (function() {
> var Conv=function() {
> this.state=0;
> this.in="";
> this.out="<"+"HTML application=\"gemini-text\">";
> };
> var tohtml=function(s) {
> return s.replace(/[<>'"&]/g,function(x){return "&#"+x.charCodeAt(0)+";";});
> };
> Conv.prototype.add=function(s) {
> this.in+=s;
> var i=this.in.indexOf("\n");
> while(i>=0) {
> this.addLine(this.in.slice(0,i));
> this.in=this.in.slice(i+1);
> i=this.in.indexOf("\n");
> }
> };
> Conv.prototype.addLine=function(s) {
> var i,z;
> if(this.state==0) {
> this.state=1;
> if(s[0]=="#") this.out+="<"+"title>"+tohtml(s.slice(1))+"</title>\n";
> }
> if(this.state==3 && s) this.state=1;
> if(this.state==1) {
> if(s.slice(0,3)=="```") {
> this.state=2;
> this.out+="<pre>";
> } else if(s[0]=="#") {
> for(i=1;i<6 && s[i]==="#";i++);
> this.out+="<h"+i+">"+tohtml(s.slice(i).trim())+"</h"+i+">";
> this.state=3;
> } else if(s[0]=="=" && s[1]==">") {
> s=s.slice(2).trim();
> i=s.indexOf(" ");
> if(i>=0) z=s.slice(0,i),s=s.slice(i).trim(); else z=s;
> this.out+="<"+"a href=\""+tohtml(z)+"\">"+tohtml(s)+"</a><br>\n";
> } else {
> this.out+=tohtml(s)+"<br>\n";
> }
> } else if(this.state==2) {
> if(s.slice(0,3)=="```") {
> this.state=1;
> this.out+="</pre>\n";
> } else {
> this.out+=tohtml(s)+"\n";
> }
> }
> };
> Conv.prototype.read=function() {
> var x=this.out;
> this.out="";
> return x;
> };
> var G=function(){};
> var o=G.prototype={
> classDescription: "_geminiFileFormat",
> classID: Components.ID("{aac00a22-9c4c-11ec-a2da-002618745416}"),
> contractID: "@mozilla.org/streamconv;1?from=text/gemini&to=*/*",
> convert: function(stream,fromtype,totype,context) {
> throw Cr.NS_ERROR_NOT_IMPLEMENTED;
> },
> asyncConvertData: function(fromtype,totype,listener,context) {
> listener.QueryInterface(Ci.nsIStreamListener);
> this.listener=listener;
> this.offset=0;
> this.pipe=Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
> this.pipe.init(false,false,0,0,null);
> this.conv=new Conv();
> },
> getConvertedType: function(type,channel) {
> if(type.indexOf(";")!=-1) return "text/html"+type.slice(type.indexOf(";"));
> return "text/html";
> },
> onDataAvailable: function(request,context,stream,offset,count) {
> let s=NetUtil.readInputStreamToString(stream,count,{});
> this.conv.add(s);
> let d=this.conv.read();
> this.pipe.outputStream.write(d,d.length);
> this.listener.onDataAvailable(request,context,this.pipe.inputStream,this.offset,d.length);
> this.offset+=d.length;
> },
> onStartRequest: function(request,context) {
> request.QueryInterface(Ci.nsIChannel);
> request.contentType="text/html";
> this.listener.onStartRequest(request,context);
> },
> onStopRequest: function(request,context,status) {
> if(this.conv.in) {
> this.conv.add("\n");
> let d=this.conv.read();
> this.pipe.outputStream.write(d,d.length);
> this.listener.onDataAvailable(request,context,this.pipe.inputStream,this.offset,d.length);
> }
> this.listener.onStopRequest(request,context,status);
> delete this.listener;
> delete this.pipe;
> delete this.conv;
> },
> QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamConverter,Ci.nsIStreamListener,Ci.nsIRequestObserver]),
> };
> var r=Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
> r.registerFactory(o.classID,o.classDescription,o.contractID,XPCOMUtils._getFactory(G));
> })();
>
> You must also add the appropriate entries into the mimeTypes.rdf file.
>
> There may (probably) be some mistakes; please tell me if you had found any mistakes.
>

Are you using XPCOM with this because that's was retired ages ago AFAIK.

Re: Firefox text/gemini

<1650220873.bystand@zzo38computer.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=234&group=comp.infosystems.gemini#234

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!P703Hxu1m1uplaQVJzdzug.user.46.165.242.75.POSTED!not-for-mail
From: news@zzo38computer.org.invalid
Newsgroups: comp.infosystems.gemini
Subject: Re: Firefox text/gemini
Date: Wed, 20 Apr 2022 07:54:05 -0700
Organization: Aioe.org NNTP Server
Message-ID: <1650220873.bystand@zzo38computer.org>
References: <1646501357.bystand@zzo38computer.org> <d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org>
Mime-Version: 1.0
Injection-Info: gioia.aioe.org; logging-data="53165"; posting-host="P703Hxu1m1uplaQVJzdzug.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: bystand/1.3.0pre
X-Notice: Filtered by postfilter v. 0.9.2
 by: news@zzo38computer.org.invalid - Wed, 20 Apr 2022 14:54 UTC

threeoh6000 <threeoh6000@news.eternal-september.org> wrote:
> Are you using XPCOM with this because that's was retired ages ago AFAIK.

Yes, but I am using a old version of Firefox. (WebExtensions does not seem
to do everything that I want it to do. Do you know if it does?)

--
Don't laugh at the moon when it is day time in France.

Re: Firefox text/gemini

<87zgkfshyt.fsf@cassilda.carcosa.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=235&group=comp.infosystems.gemini#235

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jmcbray@carcosa.net (Jason McBrayer)
Newsgroups: comp.infosystems.gemini
Subject: Re: Firefox text/gemini
Date: Wed, 20 Apr 2022 14:55:06 -0400
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <87zgkfshyt.fsf@cassilda.carcosa.net>
References: <1646501357.bystand@zzo38computer.org>
<d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org>
<1650220873.bystand@zzo38computer.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="8d7f3d3493d40a45583c57185c9d73ff";
logging-data="22687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pjRU3Y59LK4PYkPvH849c"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cancel-Lock: sha1:UfyidFJrGDgHcXRvnlSi9V9TMGo=
sha1:cuVvPBQaPgqXnQEJSm90aHn5Y8Y=
 by: Jason McBrayer - Wed, 20 Apr 2022 18:55 UTC

news@zzo38computer.org.invalid writes:

> threeoh6000 <threeoh6000@news.eternal-september.org> wrote:
>> Are you using XPCOM with this because that's was retired ages ago AFAIK.

> Yes, but I am using a old version of Firefox. (WebExtensions does not seem
> to do everything that I want it to do. Do you know if it does?)

You can't write a WebExtension that's a Gemini client, because JS
doesn't have access to raw sockets. For this same reason, the current
version of the OverBite extension for Gopher isn't a complete solution
in itself; it rewrites URLs which are then served by the Floodgap
Gopher-to-HTTP proxy.

--
Jason McBrayer | “Strange is the night where black stars rise,
jmcbray@carcosa.net | and strange moons circle through the skies,
| but stranger still is lost Carcosa.”
| ― Robert W. Chambers,The King in Yellow

Re: Firefox text/gemini

<1650501560.bystand@zzo38computer.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=236&group=comp.infosystems.gemini#236

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!P703Hxu1m1uplaQVJzdzug.user.46.165.242.75.POSTED!not-for-mail
From: news@zzo38computer.org.invalid
Newsgroups: comp.infosystems.gemini
Subject: Re: Firefox text/gemini
Date: Wed, 20 Apr 2022 17:44:45 -0700
Organization: Aioe.org NNTP Server
Message-ID: <1650501560.bystand@zzo38computer.org>
References: <1646501357.bystand@zzo38computer.org> <d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org> <1650220873.bystand@zzo38computer.org> <87zgkfshyt.fsf@cassilda.carcosa.net>
Mime-Version: 1.0
Injection-Info: gioia.aioe.org; logging-data="16157"; posting-host="P703Hxu1m1uplaQVJzdzug.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: bystand/1.3.0pre
X-Notice: Filtered by postfilter v. 0.9.2
 by: news@zzo38computer.org.invalid - Thu, 21 Apr 2022 00:44 UTC

Jason McBrayer <jmcbray@carcosa.net> wrote:
> You can't write a WebExtension that's a Gemini client, because JS
> doesn't have access to raw sockets. For this same reason, the current
> version of the OverBite extension for Gopher isn't a complete solution
> in itself; it rewrites URLs which are then served by the Floodgap
> Gopher-to-HTTP proxy.

Then that is a problem with WebExtensions. (Another thing that I would
want to do, but that it doesn't do, is to be able to write extensions
in C.)

However, my code does not implement the Gemini protocol (although I
want to do that too, and it can probably be done directly in XPCOM
without needing a proxy); it only implements the Gemini file format
(which can be used with local files and Gempub, and any HTTP(S) servers
that serve text/gemini files, but I don't know if any do so).

I don't know if WebExtensions can implement file formats, and I also don't
know if any HTTP(S) server serves Gemini files. (Do you know?)

(Note: You can load ZIP archives (including EPUB) in Firefox by prefixing
the URL with "jar:" and adding "!/" on the end. This is a feature that I
use, but intend in future to make it automatically redirect to a jar: URL
if loading any ZIP file (including any whose MIME type has "+zip").)

--
Don't laugh at the moon when it is day time in France.

Re: Firefox text/gemini

<t686fq$at6$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=248&group=comp.infosystems.gemini#248

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!WSV8syAakEemEq+JaTIJSg.user.46.165.242.75.POSTED!not-for-mail
From: cyrus.valkonen@gmail.com (Cyrus Valkonen)
Newsgroups: comp.infosystems.gemini
Subject: Re: Firefox text/gemini
Date: Fri, 20 May 2022 15:52:57 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t686fq$at6$1@gioia.aioe.org>
References: <1646501357.bystand@zzo38computer.org>
<d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org>
<1650220873.bystand@zzo38computer.org> <87zgkfshyt.fsf@cassilda.carcosa.net>
<1650501560.bystand@zzo38computer.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="11174"; posting-host="WSV8syAakEemEq+JaTIJSg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Cyrus Valkonen - Fri, 20 May 2022 13:52 UTC

It seems this is the way to go for Firefox:

https://bugzilla.mozilla.org/show_bug.cgi?id=1247628#c55

On 4/21/22 02:44, news@zzo38computer.org.invalid wrote:
> Jason McBrayer <jmcbray@carcosa.net> wrote:
>> You can't write a WebExtension that's a Gemini client, because JS
>> doesn't have access to raw sockets. For this same reason, the current
>> version of the OverBite extension for Gopher isn't a complete solution
>> in itself; it rewrites URLs which are then served by the Floodgap
>> Gopher-to-HTTP proxy.

Re: Firefox text/gemini

<ta3cus$jj0$2@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=288&group=comp.infosystems.gemini#288

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!O7AS2VhqNgaCQzOyGMpRNQ.user.46.165.242.75.POSTED!not-for-mail
From: krixano@mailbox.org (Christian Seibold)
Newsgroups: comp.infosystems.gemini
Subject: Re: Firefox text/gemini
Date: Wed, 6 Jul 2022 02:17:49 -0500
Organization: Aioe.org NNTP Server
Message-ID: <ta3cus$jj0$2@gioia.aioe.org>
References: <1646501357.bystand@zzo38computer.org>
<d9208dbe-fcea-9618-3d7a-44ca3e423c03@news.eternal-september.org>
<1650220873.bystand@zzo38computer.org> <87zgkfshyt.fsf@cassilda.carcosa.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="20064"; posting-host="O7AS2VhqNgaCQzOyGMpRNQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Christian Seibold - Wed, 6 Jul 2022 07:17 UTC

On 4/20/2022 1:55 PM, Jason McBrayer wrote:
> news@zzo38computer.org.invalid writes:
>
>> threeoh6000 <threeoh6000@news.eternal-september.org> wrote:
>>> Are you using XPCOM with this because that's was retired ages ago AFAIK.
>
>> Yes, but I am using a old version of Firefox. (WebExtensions does not seem
>> to do everything that I want it to do. Do you know if it does?)
>
> You can't write a WebExtension that's a Gemini client, because JS
> doesn't have access to raw sockets. For this same reason, the current
> version of the OverBite extension for Gopher isn't a complete solution
> in itself; it rewrites URLs which are then served by the Floodgap
> Gopher-to-HTTP proxy.
>

JavaScript is starting to add things for sockets now, and Mozilla had
this thing a while ago where they were trying to implement dweb
(distributed web) protocols into Firefox. I'm not sure if they continued
this though, or how far along JS Sockets are.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor