These are chat archives for pi-hole/AdminLTE

4th
Jul 2016
Sander
@brantje
Jul 04 2016 06:03
Yea
That's angular =), it only loads the content that changes
Adam Warner
@PromoFaux
Jul 04 2016 06:06
A bit like using jquery to dynamically update content?
Sander
@brantje
Jul 04 2016 06:07
Yea, abit like that. Take for example an input field
In jquery you need to add an $(elem).on('keyup')
In angular you can use ng-model="myVar" and after the input: {{myVar}}
It will change at the same time when you change the input, without adding any code
Sander
@brantje
Jul 04 2016 17:16
https://github.com/kevinwestern/flask-angular => Nice base maybe for the frontend?
Flask - Angular template
Adam Warner
@PromoFaux
Jul 04 2016 17:40
Is it a visual template, or a behind the scenes template?
Mark Drobnak
@Mcat12
Jul 04 2016 17:41
It's a file structure template. A dev environment for Flask + Angular
Sander
@brantje
Jul 04 2016 17:41
behind the scenes (the flask logic)
Adam Warner
@PromoFaux
Jul 04 2016 17:41
Right.
Like starting a new project in VS
Sander
@brantje
Jul 04 2016 17:42
I think so, never used VS before
Adam Warner
@PromoFaux
Jul 04 2016 17:43
It's about the only IDE I have any real experience in!
Mark Drobnak
@Mcat12
Jul 04 2016 17:43
IntelliJ ftw!
Sander
@brantje
Jul 04 2016 17:44
PhpStorm / PyCharm
Adam Warner
@PromoFaux
Jul 04 2016 17:44
If you do a lot of c# (and I do) VS plus Resharper is the dogs nuts.
I'm half tempted to port pihole to .net/mono
Just for shits and giggles
Mark Drobnak
@Mcat12
Jul 04 2016 17:46
Just wait for Window's Linux sub system
Sander
@brantje
Jul 04 2016 17:46
Ghehe would be nice
Adam Warner
@PromoFaux
Jul 04 2016 17:46
Yeah I'm interested to try that next month!
Sander
@brantje
Jul 04 2016 17:46
What flask or windows build?
Adam Warner
@PromoFaux
Jul 04 2016 17:47
Using the Ubuntu sub system that will be baked into win 10
Sander
@brantje
Jul 04 2016 17:50
@Mcat12 i'll try making a new adminNG dir
@Mcat12 in index.html
Mark Drobnak
@Mcat12
Jul 04 2016 17:53
I just cloned your devel into it and changed the base url
Sander
@brantje
Jul 04 2016 17:53
change <base href="/admin/"/>
Mark Drobnak
@Mcat12
Jul 04 2016 17:53
yep
Sander
@brantje
Jul 04 2016 17:53
oh
xD
ok let met check
Mark Drobnak
@Mcat12
Jul 04 2016 17:54
And then the only other changes are the ones I mentioned for removing the hashtag
Sander
@brantje
Jul 04 2016 17:54
Yea =)
This should work (in /etc/lighttpd/lighttpd.conf)
$HTTP["url"] =~ "^/adminNG/" {
        # Create a response header for debugging using curl -I
    setenv.add-response-header = (
        "X-Pi-hole" => "The Pi-hole Web interface is working!",
        "X-Frame-Options" => "DENY"
    )
    url.rewrite-if-not-file = ( "(?!\.\w+$)" => "adminNG/index.html" )
}
Mark Drobnak
@Mcat12
Jul 04 2016 17:56
Ugh. I changed /admin/ to /adminNG/ everywhere but that rewrite line. -.-
Sander
@brantje
Jul 04 2016 17:56
=D
brantje @brantje gives @Mcat12 a coffee
Adam Warner
@PromoFaux
Jul 04 2016 17:57
:3
Mcat12 @Mcat12 hands back the coffee, since he doesn't drink that stuff. ;P
Sander
@brantje
Jul 04 2016 17:57
Let me know what you think of the System info page
haha xD
Redbull?
Mark Drobnak
@Mcat12
Jul 04 2016 17:58
Nope
One thing I've noticed is that the page doesn't change from one to another until the first page is finished loading.
Adam Warner
@PromoFaux
Jul 04 2016 17:58
Dear god man, how to you live without caffeine?
Mark Drobnak
@Mcat12
Jul 04 2016 17:58
¯\(ツ)
Adam Warner
@PromoFaux
Jul 04 2016 17:58
^i too had noticed that
Sander
@brantje
Jul 04 2016 17:58
Well
Adam Warner
@PromoFaux
Jul 04 2016 17:59
You dropped this... \
Sander
@brantje
Jul 04 2016 17:59
I got a bet with coworkers
Mark Drobnak
@Mcat12
Jul 04 2016 17:59
Too late. ;P
Sander
@brantje
Jul 04 2016 17:59
2 weeks without coffee
Adam Warner
@PromoFaux
Jul 04 2016 17:59
Ninja edit
2 weeks?
Sander
@brantje
Jul 04 2016 17:59
Yea, gonna be a hell
Adam Warner
@PromoFaux
Jul 04 2016 17:59
You'll surely die...
Sander
@brantje
Jul 04 2016 18:00
I tend to get 'active' if i don't my coffee
don't get my coffee*
Mark Drobnak
@Mcat12
Jul 04 2016 18:00
You get more active the less you have coffee?
Sander
@brantje
Jul 04 2016 18:00
Yea
ADHD

Adam Warner
@PromoFaux
Jul 04 2016 18:00
Yeah, they're weird in Holland.
Oh and that
Mark Drobnak
@Mcat12
Jul 04 2016 18:01
Oh, you'd think it would be the other way around
Sander
@brantje
Jul 04 2016 18:02
Oh man fuck it, i'm home why i shouldn't drink coffee? No one can check :P
Mark Drobnak
@Mcat12
Jul 04 2016 18:02
Interesting thing happening (was happening before I changed the config): http://prntscr.com/boqu2r
I was going to ask how'd they enforce the no-coffee rule
Adam Warner
@PromoFaux
Jul 04 2016 18:02
Blood tests
Sander
@brantje
Jul 04 2016 18:02
They don't
Mark Drobnak
@Mcat12
Jul 04 2016 18:02
lol
Sander
@brantje
Jul 04 2016 18:02
Only at work they can enforce
blob
Mark Drobnak
@Mcat12
Jul 04 2016 18:03
Hmm... After the page finished loading the domains the icons disappeared
Sander
@brantje
Jul 04 2016 18:03
Works here (tm)
Adam Warner
@PromoFaux
Jul 04 2016 18:03
"Works on my machine"
Mark Drobnak
@Mcat12
Jul 04 2016 18:03
Only happens when it's loading the log I guess
Sander
@brantje
Jul 04 2016 18:03
Works for me (tm)
Mark Drobnak
@Mcat12
Jul 04 2016 18:03
:P
Adam Warner
@PromoFaux
Jul 04 2016 18:04
You wouldn't believe the amount of repos I have to sort out at work
Sander
@brantje
Jul 04 2016 18:04
500/
I had that amount last
Migrating from beanstalk to bitbucket
Mark Drobnak
@Mcat12
Jul 04 2016 18:04
Though it looks like I'm getting a 500 error on the getAllQueries...
Sander
@brantje
Jul 04 2016 18:04
Sec
Works here, slow
Adam Warner
@PromoFaux
Jul 04 2016 18:05
Pretty much. There's one guy who checks stuff in, and I always check it out to sanity check and I have to fix so much. Lazy references, poor use of nuget package manager, no .got ignore etc
Sander
@brantje
Jul 04 2016 18:05
but i think that was normal/
Mark Drobnak
@Mcat12
Jul 04 2016 18:05
Aaaand, still getting the 404
Adam Warner
@PromoFaux
Jul 04 2016 18:06
.gitignore*
Sander
@brantje
Jul 04 2016 18:06
How do you deal with commit messages like 'Whoops' 'Meh drupal update' 'Update' 'Yolo'
We had a few 'Yolo' commits -_-
Mcat, 404 where?
Adam Warner
@PromoFaux
Jul 04 2016 18:07
These commits are usually 'hdhshdhdjsc'
Mark Drobnak
@Mcat12
Jul 04 2016 18:07
lol, I had to explain to a coworker that writing a paragraph for the commit message was ok, but only if they didn't put it all in the first line
/adminNG/queries
Sander
@brantje
Jul 04 2016 18:07
Hmm
Adam Warner
@PromoFaux
Jul 04 2016 18:07
Still, it's an improvement from when we were on SVN. So many blank commits
Sander
@brantje
Jul 04 2016 18:08
SVN runs
Adam Warner
@PromoFaux
Jul 04 2016 18:08
I've been migrating all of our source from SVN to git recently. To say it's been a steep learning curve is an understatement
Sander
@brantje
Jul 04 2016 18:09
btw, when using flask, are the api and frontend going to run in a seperate process?
Mark Drobnak
@Mcat12
Jul 04 2016 18:09
$HTTP["url"] =~ "^/adminNG/" {
    # Create a response header for debugging using curl -I
    setenv.add-response-header = (
        "X-Pi-hole" => "The Pi-hole Web interface is working!",
        "X-Frame-Options" => "DENY"
    )
    url.rewrite-if-not-file = ( ")?!\.\w+$" => "adminNG/index.html" )
}
Sander
@brantje
Jul 04 2016 18:09
Looks good
Mark Drobnak
@Mcat12
Jul 04 2016 18:09
you mean separate ports/virtual servers?
Sander
@brantje
Jul 04 2016 18:10
as in; api.py and frontend.py (for example)
Mark Drobnak
@Mcat12
Jul 04 2016 18:10
This message was deleted
Sander
@brantje
Jul 04 2016 18:10
But hmm yea, but 1 can use port 80
Mark Drobnak
@Mcat12
Jul 04 2016 18:11
Maybe it'll look like this: /admin/api/... for the api and /admin/... for the normal web stuff
Sander
@brantje
Jul 04 2016 18:11
yea nice =)
or we use the pi.hole domain?
api.pi.hole for api and pi.hole for frontend
Mark Drobnak
@Mcat12
Jul 04 2016 18:12
Maybe... Wouldn't we need 2 IP addresses for that to work? idk how that works under the hood exactly
Sander
@brantje
Jul 04 2016 18:13
I know how to do it with apache / nginx, so flask would be possible i think
Mark Drobnak
@Mcat12
Jul 04 2016 18:13
And if someone's using the web interface while not using Pi-hole for dns, it would fail
Sander
@brantje
Jul 04 2016 18:13
Hm true
Better /admin and /admin/api then
Mcat does it work?
Mark Drobnak
@Mcat12
Jul 04 2016 18:16
Checking now.
(Still loading stuff on first page)
Sander
@brantje
Jul 04 2016 18:16
What pi you use?
Mark Drobnak
@Mcat12
Jul 04 2016 18:16
Zero
Chrome dev tools shows a LOT of api calls happening right now
Sander
@brantje
Jul 04 2016 18:17
I need to dig up my pi 1 then
you
yea*
I can slim it down for the dashboard
Mark Drobnak
@Mcat12
Jul 04 2016 18:19
Undefined index: HTTP_ORIGIN in /var/www/html/adminNG/api.php on line 20
There's about 500 of those
(rough estimation)
Looks like it's doing api calls for cpu usage and other stuff while not on that page.
Well in the side bar
:P
CPU: 0.4, 0.27, 0.28
Mark Drobnak
@Mcat12
Jul 04 2016 18:21
ah
Sander
@brantje
Jul 04 2016 18:21
Updates every 10 sec
Mark Drobnak
@Mcat12
Jul 04 2016 18:22
doesn't seem too expensive. There's some other requests that are more expensive
Just pulled again
Still getting 404
Sander
@brantje
Jul 04 2016 18:23
So strange :/
Mark Drobnak
@Mcat12
Jul 04 2016 18:24
There's around 8 pending requests at once. Lots have summary in them. Do we need that many calls to summary? Hopefully flask will come to the rescue
Sander
@brantje
Jul 04 2016 18:25
Dashboard?
Mark Drobnak
@Mcat12
Jul 04 2016 18:25
Ya
BTW, CORS is only necessary for state-changing requests
Like whitelist/blacklisting
Or the token
But that token getting method should be changed anyways
Sander
@brantje
Jul 04 2016 18:26
Ah ok
I think i can combine the requests
Mark Drobnak
@Mcat12
Jul 04 2016 18:28
With flask + database, this should speed up as well
Sander
@brantje
Jul 04 2016 18:28
Yea like 200%
Mark Drobnak
@Mcat12
Jul 04 2016 18:29
Right now what's slowing down the page is the 10+ pending requests for stats and query info (overtime, topdomains, etc)
Speaking of flask, will we put the flask stuff all under /api/ or should we go with something like that template where Flask serves everything under / ?
I stopped the HTTP_ORIGIN errors by commenting out the CORS stuff in api.php
I'm going to reboot the pi
Sander
@brantje
Jul 04 2016 18:34
Other idea
Cache the api data in localstorage, when user revisits the page, it see's cached data until the data is refreshed
Mark Drobnak
@Mcat12
Jul 04 2016 18:36
Mainly it's the refreshing, not the first loading
Sander
@brantje
Jul 04 2016 18:38
Jup its in the History / Top X
Once we get a DB that is solved
Mark Drobnak
@Mcat12
Jul 04 2016 18:39
Or you could ask for all of the queries once and then do the calculating clientside. That's what we've been talking about moving to.
Looks complex
Sander
@brantje
Jul 04 2016 18:46
Pushed a fix for Undefined index: HTTP_ORIGIN
Mark Drobnak
@Mcat12
Jul 04 2016 18:47
We could probably just use the plain old sqlite stuff
Adam Warner
@PromoFaux
Jul 04 2016 18:49
@brantje .. on the query log page, is is posisble to only have the + expander on pi-holed domains?
Sander
@brantje
Jul 04 2016 18:50
Not sure, have to check
Adam Warner
@PromoFaux
Jul 04 2016 18:50
Otherwise it gets stuck in an infinite loading loop when you try and expand OK domains
Mark Drobnak
@Mcat12
Jul 04 2016 18:53
That client-side calculation will be critical in decreasing the load on the pi
Sander
@brantje
Jul 04 2016 18:53
Yea, nowadays we have powerfull clients
Mark Drobnak
@Mcat12
Jul 04 2016 18:53
BTW, still getting 404
Sander
@brantje
Jul 04 2016 18:54
+_+, i think its an lighthttpd issue
Mark Drobnak
@Mcat12
Jul 04 2016 18:54
Probably
Oh
duh
The last block in the config redirects everything not going to /admin/ to 404, overriding the other rewrite
Sander
@brantje
Jul 04 2016 18:55
Oh and you added it after?
Mark Drobnak
@Mcat12
Jul 04 2016 18:55
As long as it's an actual 404
I'm adding it now. It's part of the original config
Sander
@brantje
Jul 04 2016 18:55
blob
Much better
Mark Drobnak
@Mcat12
Jul 04 2016 18:56
I mean, I'm making sure that it's not overriding the /adminNG/ stuff
brb food timez
Adam Warner
@PromoFaux
Jul 04 2016 18:59
Where does the fa class come from? Is that bootstrap?
Just playing a bit with layout in dev-tools
Mark Drobnak
@Mcat12
Jul 04 2016 18:59
Probably icons
You might be able to see it in the styling info
Where it comes from, I mean
Adam Warner
@PromoFaux
Jul 04 2016 19:00
ah, font awesome
Mark Drobnak
@Mcat12
Jul 04 2016 19:05
After awhile of having the page open PHP can't keep up with the requests.
BTW, if we use SQLAclchemy we only need the abstraction layer.
So 2/3 of that page doesn't matter too much
Adam Warner
@PromoFaux
Jul 04 2016 19:12
What do you think of this:
blob
Rather than just the tick/stop icons
Maybe even the icons, and then expand on hover (Like the flairs on /r/pcmasterrace)
Mark Drobnak
@Mcat12
Jul 04 2016 19:14
Maybe make the buttons gray or something, so that when scanning the page you can still easily find the blocked and not blocked queries
Adam Warner
@PromoFaux
Jul 04 2016 19:14
But that's a bit beyond my CSS
Mark Drobnak
@Mcat12
Jul 04 2016 19:14
Just change the color. :P
Are you using Chrome dev tools?
It might not even matter, since the whole query is colored
Adam Warner
@PromoFaux
Jul 04 2016 19:14
blob
I mean like the expand on hover
Mark Drobnak
@Mcat12
Jul 04 2016 19:15
Ya
Adam Warner
@PromoFaux
Jul 04 2016 19:15
Not sure how I managed two different shades of grey.
They're both btn-default
Mark Drobnak
@Mcat12
Jul 04 2016 19:15
But that button way makes it a bit more intuitive. I didn't know that was what those icons were for until now
Adam Warner
@PromoFaux
Jul 04 2016 19:16
Yeah, I only found out by clicking them!
though the ng-click stuff doesn't seem to work with a <button>
<button type="button" class="btn btn-default btn-xs" ng-click="grid.appScope.blockDomain(row)" ng-show="grid.getCellValue(row, col) !=='Pi-holed'">
    <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>  
  Unblock
</button>
but then, I have no idea what I'm doing :D
Sander
@brantje
Jul 04 2016 19:18
You want that change/
Adam Warner
@PromoFaux
Jul 04 2016 19:18
I think so, Like @Mcat12 says, it makes it a bit more obvious what they do
Mark Drobnak
@Mcat12
Jul 04 2016 19:18
yep
Adam Warner
@PromoFaux
Jul 04 2016 19:20
Is there a better tool for editing pages in place than dev-tools?
It's a bit clunky
Sander
@brantje
Jul 04 2016 19:20
Afaik, no
Mark Drobnak
@Mcat12
Jul 04 2016 19:20
idk. I think it's better than manually making the changes on the server then reloading again
Adam Warner
@PromoFaux
Jul 04 2016 19:21
Yeah
For the amount of stuff I'm doing, definitely.
I'm a tweaker. I am by no means competent with web frameworks :D
Mark Drobnak
@Mcat12
Jul 04 2016 19:22
Would something like this only activate if the url doesn't start with /admin<optional stuff here, like NG>/? $HTTP["url"] =~ "^(?!/admin?)/.*" {
I have no idea on those regex things
Apparently it uses perl style regex
Adam Warner
@PromoFaux
Jul 04 2016 19:23
Mark Drobnak
@Mcat12
Jul 04 2016 19:24
:O
:D
Sander
@brantje
Jul 04 2016 19:24
I use regexr alot
Mark Drobnak
@Mcat12
Jul 04 2016 19:26
Are there some errors with the regex in the config? unescaped forward slashes
Sander
@brantje
Jul 04 2016 19:27
blob
Adam Warner
@PromoFaux
Jul 04 2016 19:27
no block icon?
Sander
@brantje
Jul 04 2016 19:27
searching for it
Adam Warner
@PromoFaux
Jul 04 2016 19:27
I couldn't find a bootstrap glyph that matched the one you had before
Sander
@brantje
Jul 04 2016 19:27
we can use fa-ban
Mark Drobnak
@Mcat12
Jul 04 2016 19:28
Might need a space between icon and text
I think that one is good. how does it look?
Adam Warner
@PromoFaux
Jul 04 2016 19:28
Yeah, I guess you can use fa fa-ban in place of glyphicon glyphicon-remove
Adam Warner
@PromoFaux
Jul 04 2016 19:29
blob
Sander
@brantje
Jul 04 2016 19:29
blob
Adam Warner
@PromoFaux
Jul 04 2016 19:29
:D
Sander
@brantje
Jul 04 2016 19:29
lol :P
Adam Warner
@PromoFaux
Jul 04 2016 19:29
I wonder now...
is it worth giving the buttons their own column?
Sander
@brantje
Jul 04 2016 19:30
hmm
Adam Warner
@PromoFaux
Jul 04 2016 19:30
and centering the status text
(and the buttons)
call the column "Action" or something
Mark Drobnak
@Mcat12
Jul 04 2016 19:31
Might be more actions that we can add later.
Adam Warner
@PromoFaux
Jul 04 2016 19:31
Yeah, not sure what though.. but we could make use of dropdowns
This message was deleted
Mark Drobnak
@Mcat12
Jul 04 2016 19:32
That would be best
Sander
@brantje
Jul 04 2016 19:33
Almost done
blob
Adam Warner
@PromoFaux
Jul 04 2016 19:37
Nice, how does it look centered?
Sander
@brantje
Jul 04 2016 19:37
Center both?
Mark Drobnak
@Mcat12
Jul 04 2016 19:37
It may not need to be centered, but it might look better
Adam Warner
@PromoFaux
Jul 04 2016 19:38
(I feel like such a project manager rn, with my over the shoulder coding ;))
Mark Drobnak
@Mcat12
Jul 04 2016 19:38
Here we go! ^(?!\/admin\S)\/.*
Though I don't know if I need to escape the forward slashes or not for lighttpd
Sander
@brantje
Jul 04 2016 19:39
I can handle project managers, as long they give me coffee
blob
Mark Drobnak
@Mcat12
Jul 04 2016 19:40
Can you search based on action? Maybe disable that, since it's the same as the status
Sander
@brantje
Jul 04 2016 19:41
Yea fixed that
In the future we can use a dropdown there
Just ordered some part to build a case for my pihole and pihole-backup
parts*
Mark Drobnak
@Mcat12
Jul 04 2016 19:44
So I got the regex to work, but it might also not be working because lighttpd doesn't see a file at /adminNG/queries and so just does the 404 anyways.
Sander
@brantje
Jul 04 2016 19:44
Mcat, i found that code by googling for 'lighthttpd angular'
maybe add also html5mode
Mark Drobnak
@Mcat12
Jul 04 2016 19:48
Got it to work!
url.rewrite-if-not-file = ( ".*" => "adminNG/index.html" )
Sander
@brantje
Jul 04 2016 19:49
XD
Yea that matches everything
Ghehe my girl asked to come sit with her at the tv
So i took the tablet
:')
Mark Drobnak
@Mcat12
Jul 04 2016 19:50
What tablet?
Sander
@brantje
Jul 04 2016 19:51
Android
Lenovo thingy
Mark Drobnak
@Mcat12
Jul 04 2016 19:51
Nexus 7 2013 ftw
Sander
@brantje
Jul 04 2016 19:51
Note 3 ftw
Mark Drobnak
@Mcat12
Jul 04 2016 19:52
That's no tablet! it's barely bigger than my phone
That one is
Mark Drobnak
@Mcat12
Jul 04 2016 19:57
;P Nice screen size though
Mark Drobnak
@Mcat12
Jul 04 2016 20:04
The Pi stays at a constant 90-100% CPU usage when the admin page is up (looking through htop)
@brantje another option for the API is to use the default web server that flask starts and host it on another port.
By the time that the pi is able to load the queries screen (going from dashboard), it's so overworked by the pending queries that the getAllQueries times out (30 seconds).
Sander
@brantje
Jul 04 2016 20:09
Wil setup a pi 1 tomorrow and give it a swing
Mark Drobnak
@Mcat12
Jul 04 2016 20:09
k
Sander
@brantje
Jul 04 2016 20:10
And look what i can improve
Mark Drobnak
@Mcat12
Jul 04 2016 20:11
:+1: No worries. Once the core side of the Pyhole rewrite is mostly done we should be able to start integrating angular with flask, and we'll get a lot of improvements from that!
Mark Drobnak
@Mcat12
Jul 04 2016 20:25
Hmmm... There's one thing wrong with that rewrite on admin... Any ad that's under /admin/ won't get redirected to the ad blocking page.