File tree Expand file tree Collapse file tree
electron app/resources/datpart Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- var dev = false ;
1+ var dev = true ;
22
33if ( typeof process === 'object' ) {
44 if ( typeof process . versions === 'object' ) {
@@ -7,6 +7,7 @@ if (typeof process === 'object') {
77const { app, BrowserWindow, Menu, Tray} = require ( 'electron' )
88const path = require ( 'path' )
99const url = require ( 'url' )
10+ const fs = require ( 'fs' ) ;
1011
1112// Keep a global reference of the window object, if you don't, the window will
1213// be closed automatically when the JavaScript object is garbage collected.
@@ -16,6 +17,11 @@ let tray = null
1617var versionNumber = app . getVersion ( ) ;
1718var appName = app . getName ( ) ;
1819var appIcon = __dirname + '/logo_128.png' ;
20+ var appPath = app . getAppPath ( ) ;
21+
22+ if ( fs . existsSync ( appPath + "/dats/" ) ) {
23+ fs . mkdir ( appPath + "/dats/" ) ;
24+ }
1925
2026app . on ( 'ready' , ( ) => {
2127 tray = new Tray ( appIcon )
Original file line number Diff line number Diff line change 33 "productName" : " DatPart" ,
44 "description" : " Load Dat's in your web browser." ,
55 "homepage" : " https://github.com/HughIsaacs2/DatPart" ,
6- "repository" : { "type" : " git" , "url" : " https://github.com/HughIsaacs2/DatPart.git" },
6+ "repository" : {
7+ "type" : " git" ,
8+ "url" : " https://github.com/HughIsaacs2/DatPart.git"
9+ },
710 "version" : " 0.0.5" ,
811 "author" : " Hugh Isaacs II <hughisaacs@acrylicstyle.com>" ,
912 "license" : " MIT" ,
1316 "dat-node" : " ^3.5.4" ,
1417 "node-dat-archive" : " ^1.5.0"
1518 },
16- "build" :{
17- "appId" : " com.electron.${name}" ,
18- "win" : {
19- "target" : [{
20- "target" : " zip" ,
21- "arch" : [
22- " ia32"
23- ]
24- }],
25- "icon" : " favicon.ico"
26- }
19+ "build" : {
20+ "win" : {
21+ "target" : [
22+ {
23+ "target" : " zip" ,
24+ "arch" : [
25+ " ia32"
26+ ]
27+ }
28+ ],
29+ "icon" : " favicon.ico"
30+ }
31+ },
32+ "devDependencies" : {
33+ "electron" : " 1.7.9"
2734 }
2835}
Original file line number Diff line number Diff line change 11"use strict" ;
22
3+ // content of index.js
4+ const { shell} = require ( 'electron' ) ;
5+ const http = require ( 'http' ) ;
6+ var dat = require ( 'dat-node' ) ;
7+
38 var host = "127.0.0.1" ;
49 var port = "9989" ;
510
813
914 var rootDir = null ;
1015 var packDir = null ;
11-
12- if ( typeof process === 'object' ) {
13- if ( typeof process . versions === 'object' ) {
14- if ( typeof process . versions [ 'electron' ] !== 'undefined' ) {
15-
16- // content of index.js
17- const { shell} = require ( 'electron' ) ;
18- const http = require ( 'http' ) ;
19- var dat = require ( 'dat-node' ) ;
2016
2117 //var versionNumber = app.getVersion();
2218 //var appName = app.getName();
2319 //var appIcon = __dirname+'/logo_128.png';
20+ //app.getAppPath()
2421
2522 document . querySelectorAll ( "a.external-link" ) . forEach ( function ( el ) {
2623 el . onclick = function ( ) { shell . openExternal ( el . href ) ; return false ; } ;
@@ -47,7 +44,7 @@ const requestHandler = (request, response) => {
4744 }
4845*/
4946
50- dat ( __dirname + '/dats/' + currentURLhostNoTLD , {
47+ dat ( __dirname + '/../../ dats/' + currentURLhostNoTLD , {
5148 // 2. Tell Dat what link I want
5249 key : currentURLhostNoTLD , temp : false , sparse : true // (a 64 character hash from above)
5350} , function ( err , dat ) {
@@ -95,5 +92,3 @@ server.listen(port, (err) => {
9592
9693 console . log ( `server is listening on ${ port } ` ) ;
9794} ) ;
98-
99- } } }
You can’t perform that action at this time.
0 commit comments