Compare commits
4 Commits
c7d49b383a
..
v0.1.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 117eaddaa0 | |||
| 8af3d7eb04 | |||
| cba0df9439 | |||
| 0675c9f7d8 |
@@ -12,3 +12,4 @@ composer.lock
|
|||||||
|
|
||||||
# Build artifacts
|
# Build artifacts
|
||||||
*.zip
|
*.zip
|
||||||
|
tests/
|
||||||
|
|||||||
@@ -9,6 +9,25 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## [0.1.3] — 2026-05-27
|
||||||
|
|
||||||
|
### Fixed — Wink no longer gets stuck
|
||||||
|
|
||||||
|
The v0.1.1 wink was implemented as a static SVG render (left eye drawn as a closed curved line). Once the random 5% chance picked the `wink` tone, the page rendered with one eye closed and stayed that way until the next page reload — and 95% of subsequent reloads went back to a non-wink tone, but if the dashboard sat idle, Buddy was stuck mid-wink indefinitely. David reported it as *"buddy has the wink face but the eye does not unblink."*
|
||||||
|
|
||||||
|
v0.1.2's lower probability (30% → 5%) reduced how often you'd see the stuck state but did not fix the underlying issue.
|
||||||
|
|
||||||
|
v0.1.3 makes the wink a real CSS animation:
|
||||||
|
|
||||||
|
- **sprite.php** no longer renders the left eye as a closed path when tone is `wink` — both eyes are always open circles in the SVG.
|
||||||
|
- **buddy.css** has a new `@keyframes buddyWink` that briefly closes the left eye (`scaleY(0.1)`) for ~250 ms every 2.5 s. The right eye keeps its normal 5 s blink. That asymmetric pattern is what makes it read as a wink rather than a synchronised blink.
|
||||||
|
- The wink animation only runs when the parent has the `buddy-sprite--wink` class, which is still controlled by the same 5% probability gate from v0.1.2.
|
||||||
|
- The mouth (asymmetric smirk), cheek opacity (rosier), and mood label (`Cheeky 😉`) all still differ for the wink tone — those are valid static state changes. Only the eye behaviour moved from static-state to transient-animation.
|
||||||
|
|
||||||
|
Net effect: when the 5% chance fires, Buddy now actually winks (closes left eye, opens it, closes it, opens it, etc., every 2.5 s) instead of freezing one-eye-shut.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [0.1.2] — 2026-05-26
|
## [0.1.2] — 2026-05-26
|
||||||
|
|
||||||
### Tuned — Wink probability lowered from 30% to 5%
|
### Tuned — Wink probability lowered from 30% to 5%
|
||||||
|
|||||||
@@ -0,0 +1,338 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
<https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Moe Ghoul>, 1 April 1989
|
||||||
|
Moe Ghoul, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
@@ -24,6 +24,17 @@
|
|||||||
animation-duration: 7s; /* sadder Buddy blinks slower */
|
animation-duration: 7s; /* sadder Buddy blinks slower */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cheeky wink: when the mood-label picks the 'wink' tone, the LEFT eye
|
||||||
|
runs a faster, more dramatic keyframe that closes for ~250ms every
|
||||||
|
2.5s. The right eye keeps its normal 5s blink — that asymmetry is
|
||||||
|
what makes it read as a wink rather than a synchronised blink.
|
||||||
|
v0.1.3 fix: previously the wink was a static SVG render (left eye
|
||||||
|
drawn as a closed curve), which got stuck on the page until the next
|
||||||
|
render. Now it's a real transient animation, so Buddy unblinks. */
|
||||||
|
.buddy-sprite--wink .buddy-sprite__eye--left {
|
||||||
|
animation: buddyWink 2.5s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes buddyBob {
|
@keyframes buddyBob {
|
||||||
0%, 100% { transform: translateY(0); }
|
0%, 100% { transform: translateY(0); }
|
||||||
50% { transform: translateY(-4px); }
|
50% { transform: translateY(-4px); }
|
||||||
@@ -32,6 +43,10 @@
|
|||||||
0%, 92%, 100% { transform: scaleY(1); }
|
0%, 92%, 100% { transform: scaleY(1); }
|
||||||
94%, 98% { transform: scaleY(0.1); }
|
94%, 98% { transform: scaleY(0.1); }
|
||||||
}
|
}
|
||||||
|
@keyframes buddyWink {
|
||||||
|
0%, 80%, 100% { transform: scaleY(1); } /* eye open most of the cycle */
|
||||||
|
85%, 95% { transform: scaleY(0.1); } /* closes briefly = the wink */
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Dashboard widget ───────────────────────────────────────────── */
|
/* ── Dashboard widget ───────────────────────────────────────────── */
|
||||||
|
|
||||||
@@ -153,3 +168,84 @@
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
border-radius: 0 4px 4px 0;
|
border-radius: 0 4px 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── About page ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.buddy-about-intro {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 16px 0 28px;
|
||||||
|
padding: 18px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #ccd0d4;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.buddy-about-intro__sprite {
|
||||||
|
flex: 0 0 160px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.buddy-about-intro__body {
|
||||||
|
flex: 1 1 320px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.buddy-about-intro__body h2 { margin-top: 0; }
|
||||||
|
.buddy-about-intro__version {
|
||||||
|
color: #646970;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
.buddy-about-intro__cta {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buddy-about-card {
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #ccd0d4;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 20px 24px;
|
||||||
|
margin: 0 0 22px;
|
||||||
|
max-width: 720px;
|
||||||
|
}
|
||||||
|
.buddy-about-card h2 { margin: 0 0 10px; font-size: 16px; }
|
||||||
|
.buddy-about-card p:last-child { margin-bottom: 0; }
|
||||||
|
.buddy-about-card ul { margin: 8px 0 0 18px; list-style: disc; }
|
||||||
|
.buddy-about-card ul li { margin-bottom: 4px; }
|
||||||
|
.buddy-about-card--versions ul { list-style: none; margin-left: 0; }
|
||||||
|
.buddy-about-card--versions li { margin-bottom: 12px; }
|
||||||
|
.buddy-about-card--versions .ver { font-weight: 600; color: #2271b1; }
|
||||||
|
.buddy-about-card--versions .latest {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 6px;
|
||||||
|
padding: 1px 7px;
|
||||||
|
background: #00a32a;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.buddy-about-changelog-link {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #646970;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Settings page form + admin-page description ─────────────────── */
|
||||||
|
|
||||||
|
.buddy-admin-description {
|
||||||
|
max-width: 720px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buddy-settings-form {
|
||||||
|
max-width: 720px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 18px 22px;
|
||||||
|
border: 1px solid #ccd0d4;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
.buddy-settings-form h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
/**
|
/**
|
||||||
* Buddy — a friendly pet for your WordPress dashboard
|
* Buddy — a friendly pet for your WordPress dashboard
|
||||||
*
|
*
|
||||||
* Plugin Name: Buddy
|
* Plugin Name: RangerHQ Buddy
|
||||||
* Plugin URI: https://icanhelp.ie/buddy
|
* Plugin URI: https://davidtkeane.com/rangerhq-buddy
|
||||||
* Description: Adopt a small companion that lives in your WordPress dashboard. Its mood reflects your site's health — published posts feed it, outdated plugins make it sick, clearing spam makes it happy. Gamifies WordPress maintenance with a bit of charm.
|
* Description: Adopt a small companion that lives in your WordPress dashboard. Its mood reflects your site's health — published posts feed it, outdated plugins make it sick, clearing spam makes it happy. Gamifies WordPress maintenance with a bit of charm.
|
||||||
* Version: 0.1.2
|
* Version: 0.1.5
|
||||||
* Requires at least: 5.0
|
* Requires at least: 5.0
|
||||||
* Requires PHP: 7.4
|
* Requires PHP: 7.4
|
||||||
* Author: David Keane
|
* Author: David Keane
|
||||||
* Author URI: https://rangersmyth.xyz/
|
* Author URI: https://davidtkeane.com
|
||||||
* License: GPL v2 or later
|
* License: GPL v2 or later
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
* Text Domain: buddy
|
* Text Domain: rangerhq-buddy
|
||||||
*
|
*
|
||||||
* @package Buddy
|
* @package Buddy
|
||||||
*/
|
*/
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||||
|
|
||||||
// Plugin coordinates.
|
// Plugin coordinates.
|
||||||
if ( ! defined( 'BUDDY_VERSION' ) ) { define( 'BUDDY_VERSION', '0.1.2' ); }
|
if ( ! defined( 'BUDDY_VERSION' ) ) { define( 'BUDDY_VERSION', '0.1.5' ); }
|
||||||
if ( ! defined( 'BUDDY_FILE' ) ) { define( 'BUDDY_FILE', __FILE__ ); }
|
if ( ! defined( 'BUDDY_FILE' ) ) { define( 'BUDDY_FILE', __FILE__ ); }
|
||||||
if ( ! defined( 'BUDDY_PATH' ) ) { define( 'BUDDY_PATH', plugin_dir_path( __FILE__ ) ); }
|
if ( ! defined( 'BUDDY_PATH' ) ) { define( 'BUDDY_PATH', plugin_dir_path( __FILE__ ) ); }
|
||||||
if ( ! defined( 'BUDDY_URL' ) ) { define( 'BUDDY_URL', plugin_dir_url( __FILE__ ) ); }
|
if ( ! defined( 'BUDDY_URL' ) ) { define( 'BUDDY_URL', plugin_dir_url( __FILE__ ) ); }
|
||||||
@@ -33,7 +33,6 @@ require_once BUDDY_PATH . 'inc/dashboard-widget.php'; // the pet on WP Dashboard
|
|||||||
require_once BUDDY_PATH . 'inc/admin-page.php'; // dedicated Buddy admin page
|
require_once BUDDY_PATH . 'inc/admin-page.php'; // dedicated Buddy admin page
|
||||||
require_once BUDDY_PATH . 'inc/about.php'; // About page
|
require_once BUDDY_PATH . 'inc/about.php'; // About page
|
||||||
require_once BUDDY_PATH . 'inc/settings.php'; // Settings page
|
require_once BUDDY_PATH . 'inc/settings.php'; // Settings page
|
||||||
require_once BUDDY_PATH . 'inc/updater.php'; // self-hosted update checker against Gitea
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin menu registration. Buddy gets its own top-level menu — the pet
|
* Admin menu registration. Buddy gets its own top-level menu — the pet
|
||||||
@@ -44,8 +43,8 @@ require_once BUDDY_PATH . 'inc/updater.php'; // self-hosted update chec
|
|||||||
add_action( 'admin_menu', 'buddy_register_admin_menu' );
|
add_action( 'admin_menu', 'buddy_register_admin_menu' );
|
||||||
function buddy_register_admin_menu() {
|
function buddy_register_admin_menu() {
|
||||||
add_menu_page(
|
add_menu_page(
|
||||||
__( 'Buddy', 'buddy' ),
|
__( 'Buddy', 'rangerhq-buddy' ),
|
||||||
__( 'Buddy', 'buddy' ),
|
__( 'Buddy', 'rangerhq-buddy' ),
|
||||||
'read', // any logged-in user with read access can see their own pet
|
'read', // any logged-in user with read access can see their own pet
|
||||||
'buddy',
|
'buddy',
|
||||||
'buddy_render_main_page',
|
'buddy_render_main_page',
|
||||||
@@ -59,8 +58,8 @@ function buddy_register_admin_menu() {
|
|||||||
// form bug).
|
// form bug).
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'buddy',
|
'buddy',
|
||||||
__( 'My Buddy', 'buddy' ),
|
__( 'My Buddy', 'rangerhq-buddy' ),
|
||||||
__( 'My Buddy', 'buddy' ),
|
__( 'My Buddy', 'rangerhq-buddy' ),
|
||||||
'read',
|
'read',
|
||||||
'buddy',
|
'buddy',
|
||||||
''
|
''
|
||||||
@@ -68,8 +67,8 @@ function buddy_register_admin_menu() {
|
|||||||
|
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'buddy',
|
'buddy',
|
||||||
__( 'Settings', 'buddy' ),
|
__( 'Settings', 'rangerhq-buddy' ),
|
||||||
__( 'Settings', 'buddy' ),
|
__( 'Settings', 'rangerhq-buddy' ),
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'buddy-settings',
|
'buddy-settings',
|
||||||
'buddy_render_settings_page'
|
'buddy_render_settings_page'
|
||||||
@@ -77,8 +76,8 @@ function buddy_register_admin_menu() {
|
|||||||
|
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'buddy',
|
'buddy',
|
||||||
__( 'About', 'buddy' ),
|
__( 'About', 'rangerhq-buddy' ),
|
||||||
__( 'About', 'buddy' ),
|
__( 'About', 'rangerhq-buddy' ),
|
||||||
'read',
|
'read',
|
||||||
'buddy-about',
|
'buddy-about',
|
||||||
'buddy_render_about_page'
|
'buddy_render_about_page'
|
||||||
|
|||||||
+18
-60
@@ -13,53 +13,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|||||||
|
|
||||||
function buddy_render_about_page() {
|
function buddy_render_about_page() {
|
||||||
if ( ! current_user_can( 'read' ) ) {
|
if ( ! current_user_can( 'read' ) ) {
|
||||||
wp_die( esc_html__( 'You do not have permission to view this page.', 'buddy' ) );
|
wp_die( esc_html__( 'You do not have permission to view this page.', 'rangerhq-buddy' ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<style>
|
|
||||||
.buddy-about-intro {
|
|
||||||
display: flex;
|
|
||||||
gap: 24px;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin: 16px 0 28px;
|
|
||||||
padding: 18px;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #ccd0d4;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.buddy-about-intro__sprite {
|
|
||||||
flex: 0 0 160px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.buddy-about-intro__body {
|
|
||||||
flex: 1 1 320px;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
.buddy-about-intro__body h2 { margin-top: 0; }
|
|
||||||
|
|
||||||
.buddy-about-card {
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #ccd0d4;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 20px 24px;
|
|
||||||
margin: 0 0 22px;
|
|
||||||
max-width: 720px;
|
|
||||||
}
|
|
||||||
.buddy-about-card h2 { margin: 0 0 10px; font-size: 16px; }
|
|
||||||
.buddy-about-card p:last-child { margin-bottom: 0; }
|
|
||||||
.buddy-about-card ul { margin: 8px 0 0 18px; list-style: disc; }
|
|
||||||
.buddy-about-card ul li { margin-bottom: 4px; }
|
|
||||||
.buddy-about-card--versions ul { list-style: none; margin-left: 0; }
|
|
||||||
.buddy-about-card--versions li { margin-bottom: 12px; }
|
|
||||||
.buddy-about-card--versions .ver { font-weight: 600; color: #2271b1; }
|
|
||||||
.buddy-about-card--versions .latest { display:inline-block; margin-left:6px; padding:1px 7px; background:#00a32a; color:#fff; border-radius:9px; font-size:11px; font-weight:600; }
|
|
||||||
.buddy-about-changelog-link { display: inline-block; margin-top: 6px; font-size: 13px; color: #646970; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h1 class="wp-heading-inline"><?php esc_html_e( 'About', 'buddy' ); ?></h1>
|
<h1 class="wp-heading-inline"><?php esc_html_e( 'About', 'rangerhq-buddy' ); ?></h1>
|
||||||
<span class="page-title-action">v<?php echo esc_html( BUDDY_VERSION ); ?></span>
|
<span class="page-title-action">v<?php echo esc_html( BUDDY_VERSION ); ?></span>
|
||||||
<hr class="wp-header-end">
|
<hr class="wp-header-end">
|
||||||
</div>
|
</div>
|
||||||
@@ -70,50 +28,50 @@ function buddy_render_about_page() {
|
|||||||
<?php buddy_render_sprite( 'default', 'happy', 'lg' ); ?>
|
<?php buddy_render_sprite( 'default', 'happy', 'lg' ); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="buddy-about-intro__body">
|
<div class="buddy-about-intro__body">
|
||||||
<h2>Buddy <span style="color:#646970; font-weight:400;">v<?php echo esc_html( BUDDY_VERSION ); ?></span></h2>
|
<h2>Buddy <span class="buddy-about-intro__version">v<?php echo esc_html( BUDDY_VERSION ); ?></span></h2>
|
||||||
<p>A friendly little companion that lives in your WordPress dashboard. The idea: keep Buddy's stats up, eventually Buddy's mood will reflect how well you're taking care of your site itself. Gamifies WordPress maintenance with a bit of charm.</p>
|
<p>A friendly little companion that lives in your WordPress dashboard. The idea: keep Buddy's stats up, eventually Buddy's mood will reflect how well you're taking care of your site itself. Gamifies WordPress maintenance with a bit of charm.</p>
|
||||||
<p style="margin-bottom:0;">
|
<p class="buddy-about-intro__cta">
|
||||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=buddy' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Go to My Buddy →', 'buddy' ); ?></a>
|
<a href="<?php echo esc_url( admin_url( 'admin.php?page=buddy' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Go to My Buddy →', 'rangerhq-buddy' ); ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buddy-about-card">
|
<div class="buddy-about-card">
|
||||||
<h2><?php esc_html_e( 'What Buddy does', 'buddy' ); ?></h2>
|
<h2><?php esc_html_e( 'What Buddy does', 'rangerhq-buddy' ); ?></h2>
|
||||||
<p><?php esc_html_e( 'Buddy is a small virtual pet stored per-user in your WordPress site. Each WP admin gets their own Buddy with its own name, species, and stats. Everything lives in your site\'s own database — nothing leaves the server.', 'buddy' ); ?></p>
|
<p><?php esc_html_e( 'Buddy is a small virtual pet stored per-user in your WordPress site. Each WP admin gets their own Buddy with its own name, species, and stats. Everything lives in your site\'s own database — nothing leaves the server.', 'rangerhq-buddy' ); ?></p>
|
||||||
<p><?php esc_html_e( 'Right now (v0.1.0): Buddy exists. You can see them on the WordPress Dashboard widget and on the dedicated Buddy admin page. Coming next: feed / play / clean / sleep interactions, time-based stat decay, multiple species, and the killer feature — stats that react to your actual WordPress site health.', 'buddy' ); ?></p>
|
<p><?php esc_html_e( 'Right now (v0.1.0): Buddy exists. You can see them on the WordPress Dashboard widget and on the dedicated Buddy admin page. Coming next: feed / play / clean / sleep interactions, time-based stat decay, multiple species, and the killer feature — stats that react to your actual WordPress site health.', 'rangerhq-buddy' ); ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buddy-about-card">
|
<div class="buddy-about-card">
|
||||||
<h2><?php esc_html_e( 'Who Buddy is for', 'buddy' ); ?></h2>
|
<h2><?php esc_html_e( 'Who Buddy is for', 'rangerhq-buddy' ); ?></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong><?php esc_html_e( 'WordPress admins', 'buddy' ); ?></strong> <?php esc_html_e( 'who want a small daily reason to keep their site tidy.', 'buddy' ); ?></li>
|
<li><strong><?php esc_html_e( 'WordPress admins', 'rangerhq-buddy' ); ?></strong> <?php esc_html_e( 'who want a small daily reason to keep their site tidy.', 'rangerhq-buddy' ); ?></li>
|
||||||
<li><strong><?php esc_html_e( 'Freelancers', 'buddy' ); ?></strong> <?php esc_html_e( 'managing multiple client sites and wanting a visual gauge of each one\'s health.', 'buddy' ); ?></li>
|
<li><strong><?php esc_html_e( 'Freelancers', 'rangerhq-buddy' ); ?></strong> <?php esc_html_e( 'managing multiple client sites and wanting a visual gauge of each one\'s health.', 'rangerhq-buddy' ); ?></li>
|
||||||
<li><strong><?php esc_html_e( '90s kids', 'buddy' ); ?></strong> <?php esc_html_e( 'who remember when computers had pets in them.', 'buddy' ); ?></li>
|
<li><strong><?php esc_html_e( '90s kids', 'rangerhq-buddy' ); ?></strong> <?php esc_html_e( 'who remember when computers had pets in them.', 'rangerhq-buddy' ); ?></li>
|
||||||
<li><strong><?php esc_html_e( 'Anyone', 'buddy' ); ?></strong> <?php esc_html_e( 'who wants their WordPress admin to feel slightly less corporate.', 'buddy' ); ?></li>
|
<li><strong><?php esc_html_e( 'Anyone', 'rangerhq-buddy' ); ?></strong> <?php esc_html_e( 'who wants their WordPress admin to feel slightly less corporate.', 'rangerhq-buddy' ); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buddy-about-card buddy-about-card--versions">
|
<div class="buddy-about-card buddy-about-card--versions">
|
||||||
<h2><?php esc_html_e( 'Version history', 'buddy' ); ?></h2>
|
<h2><?php esc_html_e( 'Version history', 'rangerhq-buddy' ); ?></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<span class="ver">v0.1.2</span> — 26 May 2026 <span class="latest">latest</span><br>
|
<span class="ver">v0.1.2</span> — 26 May 2026 <span class="latest">latest</span><br>
|
||||||
<?php esc_html_e( 'Wink, tuned. The Easter-egg wink from v0.1.1 was firing at 30% per render — felt closer to "stuck" than "playful". Dropped to 5%: same cheeky face when it lands, just rare enough to feel like a treat.', 'buddy' ); ?>
|
<?php esc_html_e( 'Wink, tuned. The Easter-egg wink from v0.1.1 was firing at 30% per render — felt closer to "stuck" than "playful". Dropped to 5%: same cheeky face when it lands, just rare enough to feel like a treat.', 'rangerhq-buddy' ); ?>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="ver">v0.1.1</span> — 25 May 2026<br>
|
<span class="ver">v0.1.1</span> — 25 May 2026<br>
|
||||||
<?php esc_html_e( 'Cheeky face! New wink expression that occasionally appears when Buddy is in a good mood — one eye closed, asymmetric smirk, rosier cheeks. Pure SVG, no image files. Proof that the expression engine is properly extensible.', 'buddy' ); ?>
|
<?php esc_html_e( 'Cheeky face! New wink expression that occasionally appears when Buddy is in a good mood — one eye closed, asymmetric smirk, rosier cheeks. Pure SVG, no image files. Proof that the expression engine is properly extensible.', 'rangerhq-buddy' ); ?>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="ver">v0.1.0</span> — 25 May 2026<br>
|
<span class="ver">v0.1.0</span> — 25 May 2026<br>
|
||||||
<?php esc_html_e( 'First release. Phase A complete: Buddy exists. Dashboard widget + dedicated admin page show the SVG character, name, mood label, four stats bars. Self-hosted update checker wired up to Gitea from commit 1. No interactions yet — that\'s next.', 'buddy' ); ?>
|
<?php esc_html_e( 'First release. Phase A complete: Buddy exists. Dashboard widget + dedicated admin page show the SVG character, name, mood label, four stats bars. Self-hosted update checker wired up to Gitea from commit 1. No interactions yet — that\'s next.', 'rangerhq-buddy' ); ?>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a class="buddy-about-changelog-link"
|
<a class="buddy-about-changelog-link"
|
||||||
href="https://git.davidtkeane.com/ranger/a-buddy/src/branch/main/CHANGELOG.md"
|
href="https://git.davidtkeane.com/ranger/a-buddy/src/branch/main/CHANGELOG.md"
|
||||||
target="_blank" rel="noopener">
|
target="_blank" rel="noopener">
|
||||||
<?php esc_html_e( 'View the full CHANGELOG.md →', 'buddy' ); ?>
|
<?php esc_html_e( 'View the full CHANGELOG.md →', 'rangerhq-buddy' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
-9
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|||||||
*/
|
*/
|
||||||
function buddy_render_main_page() {
|
function buddy_render_main_page() {
|
||||||
if ( ! current_user_can( 'read' ) ) {
|
if ( ! current_user_can( 'read' ) ) {
|
||||||
wp_die( esc_html__( 'You do not have permission to view Buddy.', 'buddy' ) );
|
wp_die( esc_html__( 'You do not have permission to view Buddy.', 'rangerhq-buddy' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$state = buddy_get_state();
|
$state = buddy_get_state();
|
||||||
@@ -25,13 +25,13 @@ function buddy_render_main_page() {
|
|||||||
$tone = buddy_mood_label( $mood );
|
$tone = buddy_mood_label( $mood );
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h1 class="wp-heading-inline">🐾 <?php esc_html_e( 'Buddy', 'buddy' ); ?></h1>
|
<h1 class="wp-heading-inline">🐾 <?php esc_html_e( 'Buddy', 'rangerhq-buddy' ); ?></h1>
|
||||||
<span class="page-title-action">v<?php echo esc_html( BUDDY_VERSION ); ?></span>
|
<span class="page-title-action">v<?php echo esc_html( BUDDY_VERSION ); ?></span>
|
||||||
<hr class="wp-header-end">
|
<hr class="wp-header-end">
|
||||||
|
|
||||||
<p class="description" style="max-width: 720px;">
|
<p class="description buddy-admin-description">
|
||||||
<?php esc_html_e( 'Your dashboard pet. Keep its stats up — eventually they will reflect how well you take care of your WordPress site.', 'buddy' ); ?>
|
<?php esc_html_e( 'Your dashboard pet. Keep its stats up — eventually they will reflect how well you take care of your WordPress site.', 'rangerhq-buddy' ); ?>
|
||||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=buddy-about' ) ); ?>"><?php esc_html_e( 'Read more on the About page →', 'buddy' ); ?></a>
|
<a href="<?php echo esc_url( admin_url( 'admin.php?page=buddy-about' ) ); ?>"><?php esc_html_e( 'Read more on the About page →', 'rangerhq-buddy' ); ?></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="buddy-main">
|
<div class="buddy-main">
|
||||||
@@ -49,18 +49,19 @@ function buddy_render_main_page() {
|
|||||||
$age_days = (int) floor( $age_seconds / DAY_IN_SECONDS );
|
$age_days = (int) floor( $age_seconds / DAY_IN_SECONDS );
|
||||||
echo esc_html(
|
echo esc_html(
|
||||||
$age_days < 1
|
$age_days < 1
|
||||||
? __( 'Adopted today', 'buddy' )
|
? __( 'Adopted today', 'rangerhq-buddy' )
|
||||||
: sprintf( _n( '%d day old', '%d days old', $age_days, 'buddy' ), $age_days )
|
/* translators: %d is the number of days since the Buddy was adopted */
|
||||||
|
: sprintf( _n( '%d day old', '%d days old', $age_days, 'rangerhq-buddy' ), $age_days )
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buddy-main__card buddy-main__card--stats">
|
<div class="buddy-main__card buddy-main__card--stats">
|
||||||
<h2><?php esc_html_e( 'How is Buddy doing?', 'buddy' ); ?></h2>
|
<h2><?php esc_html_e( 'How is Buddy doing?', 'rangerhq-buddy' ); ?></h2>
|
||||||
<?php buddy_render_stats_bars( $state ); ?>
|
<?php buddy_render_stats_bars( $state ); ?>
|
||||||
<p class="buddy-main__note">
|
<p class="buddy-main__note">
|
||||||
<?php esc_html_e( 'Coming soon: feed, play, clean, and sleep actions to keep Buddy thriving. Also: stats will react to your WordPress site\'s health.', 'buddy' ); ?>
|
<?php esc_html_e( 'Coming soon: feed, play, clean, and sleep actions to keep Buddy thriving. Also: stats will react to your WordPress site\'s health.', 'rangerhq-buddy' ); ?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function buddy_register_dashboard_widget() {
|
|||||||
|
|
||||||
wp_add_dashboard_widget(
|
wp_add_dashboard_widget(
|
||||||
'buddy_dashboard_widget',
|
'buddy_dashboard_widget',
|
||||||
'🐾 ' . __( 'Buddy', 'buddy' ),
|
'🐾 ' . __( 'Buddy', 'rangerhq-buddy' ),
|
||||||
'buddy_render_dashboard_widget'
|
'buddy_render_dashboard_widget'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ function buddy_render_dashboard_widget() {
|
|||||||
<?php buddy_render_stats_bars( $state ); ?>
|
<?php buddy_render_stats_bars( $state ); ?>
|
||||||
<p class="buddy-widget__cta">
|
<p class="buddy-widget__cta">
|
||||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=buddy' ) ); ?>" class="button button-small">
|
<a href="<?php echo esc_url( admin_url( 'admin.php?page=buddy' ) ); ?>" class="button button-small">
|
||||||
<?php esc_html_e( 'Visit Buddy →', 'buddy' ); ?>
|
<?php esc_html_e( 'Visit Buddy →', 'rangerhq-buddy' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -56,10 +56,10 @@ function buddy_render_dashboard_widget() {
|
|||||||
*/
|
*/
|
||||||
function buddy_render_stats_bars( array $state ) {
|
function buddy_render_stats_bars( array $state ) {
|
||||||
$stats = array(
|
$stats = array(
|
||||||
'hunger' => array( 'label' => __( 'Hunger', 'buddy' ), 'icon' => '🍎' ),
|
'hunger' => array( 'label' => __( 'Hunger', 'rangerhq-buddy' ), 'icon' => '🍎' ),
|
||||||
'happiness' => array( 'label' => __( 'Happiness', 'buddy' ), 'icon' => '😊' ),
|
'happiness' => array( 'label' => __( 'Happiness', 'rangerhq-buddy' ), 'icon' => '😊' ),
|
||||||
'health' => array( 'label' => __( 'Health', 'buddy' ), 'icon' => '💚' ),
|
'health' => array( 'label' => __( 'Health', 'rangerhq-buddy' ), 'icon' => '💚' ),
|
||||||
'energy' => array( 'label' => __( 'Energy', 'buddy' ), 'icon' => '⚡' ),
|
'energy' => array( 'label' => __( 'Energy', 'rangerhq-buddy' ), 'icon' => '⚡' ),
|
||||||
);
|
);
|
||||||
echo '<ul class="buddy-stats">';
|
echo '<ul class="buddy-stats">';
|
||||||
foreach ( $stats as $key => $meta ) {
|
foreach ( $stats as $key => $meta ) {
|
||||||
@@ -73,8 +73,8 @@ function buddy_render_stats_bars( array $state ) {
|
|||||||
esc_html( $meta['icon'] ),
|
esc_html( $meta['icon'] ),
|
||||||
esc_html( $meta['label'] ),
|
esc_html( $meta['label'] ),
|
||||||
$low ? ' buddy-stat__fill--low' : '',
|
$low ? ' buddy-stat__fill--low' : '',
|
||||||
$val,
|
(int) $val,
|
||||||
$val
|
(int) $val
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|||||||
+7
-7
@@ -33,25 +33,25 @@ function buddy_handle_rename_post() {
|
|||||||
add_action( 'admin_notices', function () {
|
add_action( 'admin_notices', function () {
|
||||||
printf(
|
printf(
|
||||||
'<div class="notice notice-success is-dismissible"><p>%s</p></div>',
|
'<div class="notice notice-success is-dismissible"><p>%s</p></div>',
|
||||||
esc_html__( 'Buddy renamed.', 'buddy' )
|
esc_html__( 'Buddy renamed.', 'rangerhq-buddy' )
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
function buddy_render_settings_page() {
|
function buddy_render_settings_page() {
|
||||||
if ( ! current_user_can( 'read' ) ) {
|
if ( ! current_user_can( 'read' ) ) {
|
||||||
wp_die( esc_html__( 'You do not have permission to view this page.', 'buddy' ) );
|
wp_die( esc_html__( 'You do not have permission to view this page.', 'rangerhq-buddy' ) );
|
||||||
}
|
}
|
||||||
$state = buddy_get_state();
|
$state = buddy_get_state();
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h1><?php esc_html_e( 'Buddy Settings', 'buddy' ); ?></h1>
|
<h1><?php esc_html_e( 'Buddy Settings', 'rangerhq-buddy' ); ?></h1>
|
||||||
|
|
||||||
<form method="post" style="max-width: 720px; background:#fff; padding:18px 22px; border:1px solid #ccd0d4; border-radius:4px; margin-top: 16px;">
|
<form method="post" class="buddy-settings-form">
|
||||||
<?php wp_nonce_field( 'buddy_rename', 'buddy_rename_nonce' ); ?>
|
<?php wp_nonce_field( 'buddy_rename', 'buddy_rename_nonce' ); ?>
|
||||||
<h2 style="margin-top:0;"><?php esc_html_e( 'Name', 'buddy' ); ?></h2>
|
<h2><?php esc_html_e( 'Name', 'rangerhq-buddy' ); ?></h2>
|
||||||
<p>
|
<p>
|
||||||
<label for="buddy_name"><?php esc_html_e( 'What is your Buddy called?', 'buddy' ); ?></label><br>
|
<label for="buddy_name"><?php esc_html_e( 'What is your Buddy called?', 'rangerhq-buddy' ); ?></label><br>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
name="buddy_name"
|
name="buddy_name"
|
||||||
id="buddy_name"
|
id="buddy_name"
|
||||||
@@ -61,7 +61,7 @@ function buddy_render_settings_page() {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button type="submit" name="buddy_rename_submit" class="button button-primary">
|
<button type="submit" name="buddy_rename_submit" class="button button-primary">
|
||||||
<?php esc_html_e( 'Save name', 'buddy' ); ?>
|
<?php esc_html_e( 'Save name', 'rangerhq-buddy' ); ?>
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+14
-11
@@ -8,8 +8,10 @@
|
|||||||
* dog / dragon / sprite / etc.
|
* dog / dragon / sprite / etc.
|
||||||
*
|
*
|
||||||
* Mood tone changes the expression: 'happy' = open smile, 'neutral'
|
* Mood tone changes the expression: 'happy' = open smile, 'neutral'
|
||||||
* = flat mouth, 'sad' = downturned. Eyes blink via CSS keyframes
|
* = flat mouth, 'sad' = downturned, 'wink' = asymmetric smirk + rosier
|
||||||
* regardless of tone (it's always alive).
|
* cheeks + CSS-driven left-eye wink animation. Eyes blink via CSS
|
||||||
|
* keyframes regardless of tone (it's always alive); the wink keyframe
|
||||||
|
* lives in buddy.css alongside the regular blink.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||||
@@ -42,21 +44,22 @@ function buddy_render_sprite( $species = 'default', $tone = 'happy', $size = 'md
|
|||||||
viewBox="0 0 100 100"
|
viewBox="0 0 100 100"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
role="img"
|
role="img"
|
||||||
aria-label="<?php echo esc_attr( sprintf( __( 'Buddy is %s', 'buddy' ), $tone ) ); ?>">
|
aria-label="<?php
|
||||||
|
/* translators: %s is the Buddy's mood tone (happy / neutral / sad / wink) */
|
||||||
|
echo esc_attr( sprintf( __( 'Buddy is %s', 'rangerhq-buddy' ), $tone ) );
|
||||||
|
?>">
|
||||||
<!-- body -->
|
<!-- body -->
|
||||||
<circle cx="50" cy="55" r="32" fill="<?php echo esc_attr( $body_fill ); ?>" stroke="#c9941d" stroke-width="2" />
|
<circle cx="50" cy="55" r="32" fill="<?php echo esc_attr( $body_fill ); ?>" stroke="#c9941d" stroke-width="2" />
|
||||||
<!-- left eye -->
|
<!-- left eye — always an open circle in the SVG. When the
|
||||||
|
tone is 'wink', the buddy-sprite--wink class on the parent
|
||||||
|
triggers a CSS keyframe animation (buddyWink in buddy.css)
|
||||||
|
that briefly closes this eye every couple of seconds.
|
||||||
|
That way the wink is a transient action, not a stuck state. -->
|
||||||
<g class="buddy-sprite__eye buddy-sprite__eye--left">
|
<g class="buddy-sprite__eye buddy-sprite__eye--left">
|
||||||
<?php if ( $tone === 'wink' ) : ?>
|
|
||||||
<!-- Closed left eye for a wink: a downward curved line below the eye-circle's normal y. -->
|
|
||||||
<path d="M 35 46 Q 40 50 45 46"
|
|
||||||
stroke="#2c3338" stroke-width="2.4" fill="none" stroke-linecap="round" />
|
|
||||||
<?php else : ?>
|
|
||||||
<circle cx="40" cy="46" r="5" fill="#2c3338" />
|
<circle cx="40" cy="46" r="5" fill="#2c3338" />
|
||||||
<circle cx="41.2" cy="45" r="1.5" fill="#fff" />
|
<circle cx="41.2" cy="45" r="1.5" fill="#fff" />
|
||||||
<?php endif; ?>
|
|
||||||
</g>
|
</g>
|
||||||
<!-- right eye (always open, even during wink) -->
|
<!-- right eye — always open, normal slow blink even during wink -->
|
||||||
<g class="buddy-sprite__eye buddy-sprite__eye--right">
|
<g class="buddy-sprite__eye buddy-sprite__eye--right">
|
||||||
<circle cx="60" cy="46" r="5" fill="#2c3338" />
|
<circle cx="60" cy="46" r="5" fill="#2c3338" />
|
||||||
<circle cx="61.2" cy="45" r="1.5" fill="#fff" />
|
<circle cx="61.2" cy="45" r="1.5" fill="#fff" />
|
||||||
|
|||||||
+8
-8
@@ -21,7 +21,7 @@ const BUDDY_META_KEY = 'buddy_state';
|
|||||||
*/
|
*/
|
||||||
function buddy_default_state() {
|
function buddy_default_state() {
|
||||||
return array(
|
return array(
|
||||||
'name' => __( 'Buddy', 'buddy' ),
|
'name' => __( 'Buddy', 'rangerhq-buddy' ),
|
||||||
'species' => 'default',
|
'species' => 'default',
|
||||||
'hunger' => 80,
|
'hunger' => 80,
|
||||||
'happiness' => 80,
|
'happiness' => 80,
|
||||||
@@ -112,12 +112,12 @@ function buddy_overall_mood( array $state ) {
|
|||||||
* you'll catch it.
|
* you'll catch it.
|
||||||
*/
|
*/
|
||||||
function buddy_mood_label( $mood_score ) {
|
function buddy_mood_label( $mood_score ) {
|
||||||
if ( $mood_score >= 75 && mt_rand( 1, 100 ) <= 5 ) {
|
if ( $mood_score >= 75 && wp_rand( 1, 100 ) <= 5 ) {
|
||||||
return array( 'label' => __( 'Cheeky 😉', 'buddy' ), 'tone' => 'wink' );
|
return array( 'label' => __( 'Cheeky 😉', 'rangerhq-buddy' ), 'tone' => 'wink' );
|
||||||
}
|
}
|
||||||
if ( $mood_score >= 80 ) { return array( 'label' => __( 'Thriving', 'buddy' ), 'tone' => 'happy' ); }
|
if ( $mood_score >= 80 ) { return array( 'label' => __( 'Thriving', 'rangerhq-buddy' ), 'tone' => 'happy' ); }
|
||||||
if ( $mood_score >= 60 ) { return array( 'label' => __( 'Content', 'buddy' ), 'tone' => 'happy' ); }
|
if ( $mood_score >= 60 ) { return array( 'label' => __( 'Content', 'rangerhq-buddy' ), 'tone' => 'happy' ); }
|
||||||
if ( $mood_score >= 40 ) { return array( 'label' => __( 'Okay', 'buddy' ), 'tone' => 'neutral' ); }
|
if ( $mood_score >= 40 ) { return array( 'label' => __( 'Okay', 'rangerhq-buddy' ), 'tone' => 'neutral' ); }
|
||||||
if ( $mood_score >= 20 ) { return array( 'label' => __( 'Hungry', 'buddy' ), 'tone' => 'sad' ); }
|
if ( $mood_score >= 20 ) { return array( 'label' => __( 'Hungry', 'rangerhq-buddy' ), 'tone' => 'sad' ); }
|
||||||
return array( 'label' => __( 'Distressed', 'buddy' ), 'tone' => 'sad' );
|
return array( 'label' => __( 'Distressed', 'rangerhq-buddy' ), 'tone' => 'sad' );
|
||||||
}
|
}
|
||||||
|
|||||||
-239
@@ -1,239 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Buddy — self-hosted update checker against the Gitea repo.
|
|
||||||
*
|
|
||||||
* Direct port of the Logbook v3.3.5 updater (proven in production).
|
|
||||||
* Polls Gitea's /releases/latest, falls back to /tags?limit=1 when no
|
|
||||||
* formal Release object exists, compares against BUDDY_VERSION,
|
|
||||||
* renders an Updates panel on the Settings page. Cached 12h on
|
|
||||||
* success, 1h on negative responses.
|
|
||||||
*
|
|
||||||
* Repo coordinates are constants you can override via define() in
|
|
||||||
* wp-config.php if the repo ever moves.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|
||||||
|
|
||||||
if ( ! defined( 'BUDDY_GITEA_HOST' ) ) { define( 'BUDDY_GITEA_HOST', 'https://git.davidtkeane.com' ); }
|
|
||||||
if ( ! defined( 'BUDDY_GITEA_OWNER' ) ) { define( 'BUDDY_GITEA_OWNER', 'ranger' ); }
|
|
||||||
if ( ! defined( 'BUDDY_GITEA_REPO' ) ) { define( 'BUDDY_GITEA_REPO', 'a-buddy' ); }
|
|
||||||
|
|
||||||
function buddy_gitea_repo_url() {
|
|
||||||
return BUDDY_GITEA_HOST . '/' . BUDDY_GITEA_OWNER . '/' . BUDDY_GITEA_REPO;
|
|
||||||
}
|
|
||||||
function buddy_gitea_releases_url() {
|
|
||||||
return buddy_gitea_repo_url() . '/releases';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch the latest release/tag, normalised. Returns null on hard
|
|
||||||
* error, or an array including `version`. See Logbook updater for the
|
|
||||||
* full shape.
|
|
||||||
*/
|
|
||||||
function buddy_fetch_latest_release( $force_refresh = false ) {
|
|
||||||
$cache_key = 'buddy_gitea_latest';
|
|
||||||
|
|
||||||
if ( ! $force_refresh ) {
|
|
||||||
$cached = get_site_transient( $cache_key );
|
|
||||||
if ( is_array( $cached ) ) { return $cached; }
|
|
||||||
}
|
|
||||||
|
|
||||||
$base_api = BUDDY_GITEA_HOST . '/api/v1/repos/' . BUDDY_GITEA_OWNER . '/' . BUDDY_GITEA_REPO;
|
|
||||||
|
|
||||||
// Try formal Release first.
|
|
||||||
$response = wp_remote_get( $base_api . '/releases/latest', array( 'timeout' => 8 ) );
|
|
||||||
if ( is_wp_error( $response ) ) { return null; }
|
|
||||||
|
|
||||||
$code = (int) wp_remote_retrieve_response_code( $response );
|
|
||||||
$body = ( $code === 200 ) ? json_decode( wp_remote_retrieve_body( $response ), true ) : null;
|
|
||||||
|
|
||||||
// Fallback to /tags if no Release object exists yet.
|
|
||||||
if ( $code !== 200 || ! is_array( $body ) || empty( $body['tag_name'] ) ) {
|
|
||||||
$tags_response = wp_remote_get( $base_api . '/tags?limit=1', array( 'timeout' => 8 ) );
|
|
||||||
if ( ! is_wp_error( $tags_response )
|
|
||||||
&& (int) wp_remote_retrieve_response_code( $tags_response ) === 200 ) {
|
|
||||||
$tags = json_decode( wp_remote_retrieve_body( $tags_response ), true );
|
|
||||||
if ( is_array( $tags ) && ! empty( $tags[0]['name'] ) ) {
|
|
||||||
$body = array(
|
|
||||||
'tag_name' => $tags[0]['name'],
|
|
||||||
'html_url' => buddy_gitea_repo_url() . '/src/tag/' . rawurlencode( $tags[0]['name'] ),
|
|
||||||
'body' => isset( $tags[0]['message'] ) ? $tags[0]['message'] : '',
|
|
||||||
'published_at' => isset( $tags[0]['commit']['created'] ) ? $tags[0]['commit']['created'] : null,
|
|
||||||
'assets' => array(),
|
|
||||||
);
|
|
||||||
$code = 200;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $code !== 200 || ! is_array( $body ) || empty( $body['tag_name'] ) ) {
|
|
||||||
$info = array(
|
|
||||||
'version' => null,
|
|
||||||
'html_url' => buddy_gitea_releases_url(),
|
|
||||||
'download_url' => null,
|
|
||||||
'body' => '',
|
|
||||||
'published_at' => null,
|
|
||||||
'error_code' => $code,
|
|
||||||
);
|
|
||||||
set_site_transient( $cache_key, $info, HOUR_IN_SECONDS );
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
$version = ltrim( (string) $body['tag_name'], 'vV' );
|
|
||||||
|
|
||||||
// Prefer a .zip asset; fall back to Gitea source-archive URL.
|
|
||||||
$download_url = null;
|
|
||||||
if ( ! empty( $body['assets'] ) && is_array( $body['assets'] ) ) {
|
|
||||||
foreach ( $body['assets'] as $asset ) {
|
|
||||||
if ( isset( $asset['name'], $asset['browser_download_url'] )
|
|
||||||
&& substr( strtolower( $asset['name'] ), -4 ) === '.zip' ) {
|
|
||||||
$download_url = $asset['browser_download_url'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( ! $download_url ) {
|
|
||||||
$download_url = buddy_gitea_repo_url() . '/archive/' . rawurlencode( $body['tag_name'] ) . '.zip';
|
|
||||||
}
|
|
||||||
|
|
||||||
$info = array(
|
|
||||||
'version' => $version,
|
|
||||||
'html_url' => isset( $body['html_url'] ) ? esc_url_raw( $body['html_url'] ) : '',
|
|
||||||
'download_url' => esc_url_raw( $download_url ),
|
|
||||||
'body' => isset( $body['body'] ) ? wp_strip_all_tags( $body['body'] ) : '',
|
|
||||||
'published_at' => isset( $body['published_at'] ) ? $body['published_at'] : null,
|
|
||||||
);
|
|
||||||
|
|
||||||
set_site_transient( $cache_key, $info, 12 * HOUR_IN_SECONDS );
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buddy_update_status( $force_refresh = false ) {
|
|
||||||
$current = defined( 'BUDDY_VERSION' ) ? BUDDY_VERSION : '0.0.0';
|
|
||||||
$latest = buddy_fetch_latest_release( $force_refresh );
|
|
||||||
|
|
||||||
if ( ! $latest || empty( $latest['version'] ) ) {
|
|
||||||
$msg = __( 'No releases tagged on the Gitea repo yet.', 'buddy' );
|
|
||||||
if ( $latest && ! empty( $latest['error_code'] ) && (int) $latest['error_code'] !== 404 ) {
|
|
||||||
$msg = sprintf( __( 'Could not reach Gitea (HTTP %d). Try again in a few minutes.', 'buddy' ), (int) $latest['error_code'] );
|
|
||||||
}
|
|
||||||
return array(
|
|
||||||
'status' => 'unknown',
|
|
||||||
'current' => $current,
|
|
||||||
'message' => $msg,
|
|
||||||
'repo_url' => buddy_gitea_repo_url(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( version_compare( $latest['version'], $current, '>' ) ) {
|
|
||||||
return array(
|
|
||||||
'status' => 'available',
|
|
||||||
'current' => $current,
|
|
||||||
'latest' => $latest['version'],
|
|
||||||
'html_url' => $latest['html_url'],
|
|
||||||
'download_url' => $latest['download_url'],
|
|
||||||
'published_at' => $latest['published_at'],
|
|
||||||
'body' => $latest['body'],
|
|
||||||
'message' => sprintf( __( 'A new version (v%1$s) is available — you are on v%2$s.', 'buddy' ), $latest['version'], $current ),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'status' => 'up-to-date',
|
|
||||||
'current' => $current,
|
|
||||||
'latest' => $latest['version'],
|
|
||||||
'message' => sprintf( __( 'You are up to date (v%s).', 'buddy' ), $current ),
|
|
||||||
'repo_url' => buddy_gitea_repo_url(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action( 'wp_ajax_buddy_check_updates', 'buddy_ajax_check_updates' );
|
|
||||||
function buddy_ajax_check_updates() {
|
|
||||||
if ( ! current_user_can( 'manage_options' ) ) {
|
|
||||||
wp_send_json_error( 'Insufficient permissions.', 403 );
|
|
||||||
}
|
|
||||||
check_ajax_referer( 'buddy_check_updates', 'nonce' );
|
|
||||||
delete_site_transient( 'buddy_gitea_latest' );
|
|
||||||
wp_send_json_success( buddy_update_status( true ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
function buddy_render_updates_panel() {
|
|
||||||
$status = buddy_update_status( false );
|
|
||||||
$nonce = wp_create_nonce( 'buddy_check_updates' );
|
|
||||||
$repo_url = buddy_gitea_repo_url();
|
|
||||||
$rel_url = buddy_gitea_releases_url();
|
|
||||||
?>
|
|
||||||
<div class="buddy-updates" style="max-width:720px; margin-top:24px; padding:18px 20px; background:#fff; border:1px solid #ccd0d4; border-radius:4px;">
|
|
||||||
<h2 style="margin-top:0;"><?php esc_html_e( 'Updates', 'buddy' ); ?></h2>
|
|
||||||
<p style="margin:0 0 12px;">
|
|
||||||
<?php esc_html_e( 'Buddy is self-hosted on Gitea. Click Check now to ask the repo whether there is a newer release than the one you are running.', 'buddy' ); ?>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p id="buddy-update-status" style="margin:0 0 12px;">
|
|
||||||
<strong><?php esc_html_e( 'Status:', 'buddy' ); ?></strong>
|
|
||||||
<span id="buddy-update-status-text"><?php echo esc_html( $status['message'] ); ?></span>
|
|
||||||
<?php if ( $status['status'] === 'available' && ! empty( $status['download_url'] ) ) : ?>
|
|
||||||
<br>
|
|
||||||
<a href="<?php echo esc_url( $status['download_url'] ); ?>" class="button button-primary" style="margin-top:8px;">
|
|
||||||
<?php
|
|
||||||
/* translators: %s is the latest version number, e.g. "0.2.0" */
|
|
||||||
echo esc_html( sprintf( __( 'Download v%s (.zip)', 'buddy' ), $status['latest'] ) );
|
|
||||||
?>
|
|
||||||
</a>
|
|
||||||
<?php if ( ! empty( $status['html_url'] ) ) : ?>
|
|
||||||
<a href="<?php echo esc_url( $status['html_url'] ); ?>" target="_blank" rel="noopener" style="margin-left:8px;"><?php esc_html_e( 'View release notes →', 'buddy' ); ?></a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p style="margin:0 0 4px;">
|
|
||||||
<button type="button" id="buddy-check-updates-btn" class="button" data-nonce="<?php echo esc_attr( $nonce ); ?>">
|
|
||||||
↻ <?php esc_html_e( 'Check now', 'buddy' ); ?>
|
|
||||||
</button>
|
|
||||||
<a href="<?php echo esc_url( $repo_url ); ?>" target="_blank" rel="noopener" class="button" style="margin-left:6px;"><?php esc_html_e( 'View on Gitea', 'buddy' ); ?></a>
|
|
||||||
<a href="<?php echo esc_url( $rel_url ); ?>" target="_blank" rel="noopener" class="button" style="margin-left:6px;"><?php esc_html_e( 'View all releases', 'buddy' ); ?></a>
|
|
||||||
</p>
|
|
||||||
<p style="margin:10px 0 0; color:#646970; font-size:12px;">
|
|
||||||
<?php esc_html_e( 'Manual update path: download the .zip, deactivate the plugin in WordPress, upload via Plugins → Add New → Upload, reactivate. Your Buddy survives the upgrade (state is stored in user_meta).', 'buddy' ); ?>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
var btn = document.getElementById('buddy-check-updates-btn');
|
|
||||||
var statusText = document.getElementById('buddy-update-status-text');
|
|
||||||
if (!btn || !statusText) { return; }
|
|
||||||
|
|
||||||
btn.addEventListener('click', function () {
|
|
||||||
var nonce = btn.getAttribute('data-nonce');
|
|
||||||
btn.disabled = true;
|
|
||||||
var orig = btn.textContent;
|
|
||||||
btn.textContent = '↻ Checking…';
|
|
||||||
statusText.textContent = 'Asking Gitea…';
|
|
||||||
|
|
||||||
var fd = new FormData();
|
|
||||||
fd.append('action', 'buddy_check_updates');
|
|
||||||
fd.append('nonce', nonce);
|
|
||||||
|
|
||||||
fetch(ajaxurl, { method: 'POST', credentials: 'same-origin', body: fd })
|
|
||||||
.then(function (r) { return r.json(); })
|
|
||||||
.then(function (res) {
|
|
||||||
if (!res || !res.success) {
|
|
||||||
statusText.textContent = (res && res.data) ? String(res.data) : 'Check failed.';
|
|
||||||
} else {
|
|
||||||
statusText.textContent = res.data.message || 'Check complete.';
|
|
||||||
if (res.data.status === 'available' && res.data.download_url) {
|
|
||||||
setTimeout(function () { window.location.reload(); }, 400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(function () { statusText.textContent = 'Network error — try again in a moment.'; })
|
|
||||||
.finally(function () {
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = orig;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
=== RangerHQ Buddy ===
|
||||||
|
Contributors: ir240474
|
||||||
|
Tags: dashboard, pet, gamification, virtual-pet, fun
|
||||||
|
Requires at least: 5.0
|
||||||
|
Tested up to: 7.0
|
||||||
|
Requires PHP: 7.4
|
||||||
|
Stable tag: 0.1.5
|
||||||
|
License: GPLv2 or later
|
||||||
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
A friendly little companion that lives in your WordPress dashboard. Adopt a virtual pet whose mood reflects how your site is doing.
|
||||||
|
|
||||||
|
== Description ==
|
||||||
|
|
||||||
|
Adopt a small virtual companion that lives in your WordPress admin. Right now Buddy just exists — they bob, they blink, they show their mood. As the plugin grows, their stats will come to reflect how well you take care of your WordPress site itself: published posts feed them, outdated plugins make them sick, clearing spam makes them happy.
|
||||||
|
|
||||||
|
**Gamifies WordPress maintenance with a bit of charm.**
|
||||||
|
|
||||||
|
= What it does today =
|
||||||
|
|
||||||
|
* Dashboard widget shows your Buddy with name, mood, and four stat bars (hunger, happiness, health, energy).
|
||||||
|
* Dedicated Buddy admin page for the bigger view, with the same character and stats.
|
||||||
|
* Settings page where you can rename your Buddy.
|
||||||
|
* Each WP admin user gets their own Buddy stored per-user in `user_meta`. Nothing leaves your site database.
|
||||||
|
* About page explaining the plugin and the roadmap.
|
||||||
|
|
||||||
|
= What it does not do yet =
|
||||||
|
|
||||||
|
* No interactions — feed, play, clean, sleep are coming in Phase B.
|
||||||
|
* No time-based stat decay yet — that is Phase C.
|
||||||
|
* Only one species available right now — Phase D will add a dog, dragon, sprite, and more.
|
||||||
|
* The headline feature — having Buddy stats reflect your actual WP site health (post counts, outdated plugins, spam queue) — is Phase E.
|
||||||
|
|
||||||
|
= Privacy =
|
||||||
|
|
||||||
|
RangerHQ Buddy stores its data per-user in the WordPress `user_meta` table on your own site. No data is sent anywhere. No telemetry. No third-party JavaScript. No external services are contacted except the update checker, which queries the public Gitea release endpoint at git.davidtkeane.com to see if a new version is available.
|
||||||
|
|
||||||
|
= About the RangerHQ family =
|
||||||
|
|
||||||
|
RangerHQ Buddy is part of the RangerHQ plugin family by David Keane. Sister plugins include RangerHQ Radio (an admin-only internet radio player) and the upcoming RangerHQ Logbook.
|
||||||
|
|
||||||
|
== Installation ==
|
||||||
|
|
||||||
|
1. WordPress admin → Plugins → Add New → search for "RangerHQ Buddy" → Install Now → Activate.
|
||||||
|
2. Look for the paw-print icon in the admin sidebar (between Comments and your plugin entries).
|
||||||
|
3. Click Buddy → My Buddy to meet your new companion.
|
||||||
|
4. Visit Buddy → Settings to rename them.
|
||||||
|
|
||||||
|
That is it. There is no configuration required.
|
||||||
|
|
||||||
|
== Frequently Asked Questions ==
|
||||||
|
|
||||||
|
= Is each user's Buddy private? =
|
||||||
|
|
||||||
|
Yes. Buddy is stored per-user in `user_meta`. Other admins on the same site cannot see your Buddy, and you cannot see theirs.
|
||||||
|
|
||||||
|
= Does Buddy send any data off my site? =
|
||||||
|
|
||||||
|
No. The plugin stores everything in your own WordPress database. The only outbound network call is the update checker which queries the public Gitea release endpoint at git.davidtkeane.com to check for new versions. No personal data is sent.
|
||||||
|
|
||||||
|
= Will Buddy slow down my site? =
|
||||||
|
|
||||||
|
No. The plugin only loads on admin pages, never on the public front end. It uses inline SVG (no image files) and a small CSS file. There is no JavaScript framework involved.
|
||||||
|
|
||||||
|
= Can I have more than one Buddy? =
|
||||||
|
|
||||||
|
Not yet. Phase D will add a species picker (dog, dragon, sprite, etc.) but each user will still have one Buddy at a time.
|
||||||
|
|
||||||
|
= When will Buddy react to my site's actual health? =
|
||||||
|
|
||||||
|
That is Phase E on the roadmap. For now Buddy's stats just persist. Time-based decay is Phase C, interactions are Phase B.
|
||||||
|
|
||||||
|
= Is the source code open? =
|
||||||
|
|
||||||
|
Yes. The plugin is GPL v2 or later and the full source is published on Gitea at git.davidtkeane.com/ranger/rangerhq-buddy. You can inspect every line.
|
||||||
|
|
||||||
|
== Screenshots ==
|
||||||
|
|
||||||
|
1. Dashboard widget showing your Buddy with name, mood, and four stat bars.
|
||||||
|
2. Dedicated Buddy admin page with the bigger view.
|
||||||
|
3. Settings page where you rename your Buddy.
|
||||||
|
4. About page explaining the plugin and the roadmap.
|
||||||
|
|
||||||
|
== Changelog ==
|
||||||
|
|
||||||
|
= 0.1.5 =
|
||||||
|
* Moved the About page inline `<style>` block into the enqueued `buddy.css` stylesheet per WordPress.org reviewer feedback.
|
||||||
|
* Replaced inline `style="..."` attributes on the Settings form, Settings name heading, and main admin page description with proper CSS classes. The only remaining inline style is the dynamic stat-bar `width:%d%%` value in the Dashboard widget, which is runtime data.
|
||||||
|
|
||||||
|
= 0.1.4 =
|
||||||
|
* Renamed to RangerHQ Buddy as part of the RangerHQ plugin family naming convention.
|
||||||
|
* Updated Plugin URI and Author URI to davidtkeane.com.
|
||||||
|
* Added LICENSE file with full GPL v2 text.
|
||||||
|
* Added WordPress.org format readme.txt.
|
||||||
|
* Removed the self-hosted Gitea updater. WordPress.org-hosted plugins use the core update system instead.
|
||||||
|
* Cleaned up Plugin Check (PCP) findings — text domain alignment, output escaping, translator comments, replaced mt_rand with wp_rand for better randomness.
|
||||||
|
|
||||||
|
= 0.1.3 =
|
||||||
|
* Wink animation rebuilt as a real CSS animation, no longer sticks.
|
||||||
|
|
||||||
|
= 0.1.2 =
|
||||||
|
* Early development release.
|
||||||
|
|
||||||
|
= 0.1.1 =
|
||||||
|
* Early development release.
|
||||||
|
|
||||||
|
= 0.1.0 =
|
||||||
|
* First release — per-user state, dashboard widget, dedicated admin page, settings page with rename support, about page.
|
||||||
|
|
||||||
|
== Upgrade Notice ==
|
||||||
|
|
||||||
|
= 0.1.5 =
|
||||||
|
WordPress.org reviewer-feedback fix — all CSS now properly enqueued via wp_enqueue_style instead of inline. No user-visible behaviour changes.
|
||||||
|
|
||||||
|
= 0.1.4 =
|
||||||
|
Plugin renamed to RangerHQ Buddy and prepared for the WordPress.org Plugin Directory. No user-visible behaviour changes; existing Buddy state preserved.
|
||||||
Reference in New Issue
Block a user